Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help with Thread.sleep()

 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to run the following code but with the condition that after sending each 500 emails thread should sleep for 14 seconds and then start sending to next 500 emails until it finish

Any help will be highly appreciated

Thanks & best regards


[ October 16, 2008: Message edited by: Farakh khan ]
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You're already using a variable to keep count, so just use it:
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Rob I am really grateful to your favorable reply

I want to clear my concept that what does that mean
if (count > 0 && count % 500 == 0)

Thanks again & Regard
 
Rob Spoor
Sheriff
Pie
Posts: 20667
65
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
count % 500 == 0 means that count is a multiple of 500. You should search on the modulo or remainder operator - you'll really appreciate it.

As for the count > 0, I put that in to make sure that you won't start with a 14 second sleep - since 0 is also a multiple of 500.
 
Farakh khan
Ranch Hand
Posts: 833
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
wow! great!
really appreciated

Thanks a lot
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic