Skip to content
Browse files

Fix initial sleep for client thread. closes #4

  • Loading branch information...
1 parent 4d4a991 commit 537c0226c957489528f4a0b2b57fd6b54f6d30c9 @brianfrankcooper brianfrankcooper committed Apr 25, 2010
Showing with 8 additions and 6 deletions.
  1. +8 −6 src/com/yahoo/ycsb/Client.java
View
14 src/com/yahoo/ycsb/Client.java
@@ -207,16 +207,18 @@ public void run()
//spread the thread operations out so they don't all hit the DB at the same time
try
{
- if (_target>0)
- {
- sleep(random.nextInt((int)(1.0/_target)));
- }
+ //GH issue 4 - throws exception if _target>1 because random.nextInt argument must be >0
+ //and the sleep() doesn't make sense for granularities < 1 ms anyway
+ if ( (_target>0) && (_target<=1.0) )
+ {
+ sleep(random.nextInt((int)(1.0/_target)));
+ }
}
catch (InterruptedException e)
{
- //do nothing
+ //do nothing
}
-
+
try
{
if (_dotransactions)

0 comments on commit 537c022

Please sign in to comment.
Something went wrong with that request. Please try again.