0

I want to make my program sleep for 30 miutes or 1 hour . I can do that by using Thread.sleep() but is there any alternate way?

3
Contributors
4
Replies
6
Views
6 Years
Discussion Span
Last Post by harinath_2007
0

you could use a Timer.
or have a method like this:

public static void sleep(int milliSeconds){
  for ( int i = 0; i < milliSeconds; i++ ){}
}

this is just an example, not the most efficient way, and most likely an int is not the best type to use for this, but it can get you the idea.

but why not using the sleep method?

Edited by stultuske: just a question

1

Just set a java.util.Timer to run your method after an initial delay of 30 minutes or whatever.


@stultuske: what are you smoking? Did you miss something out of that code, or was it pure Monty Python?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.