| Author |
Implementing sleep() like funtionality in a non threaded class
|
Jay Dilla
Ranch Hand
Joined: Aug 12, 2004
Posts: 196
|
|
What is the best approach to this?
Is it even possible?
I'm trying to find the sleep() implementation but now realizing it might not even be relevant if it's not a thread.
Are there any other java methods that pause action for a specified period of time?
|
 |
Matthew Brown
Bartender
Joined: Apr 06, 2010
Posts: 3793
|
|
|
All code runs in a thread, so you can always call sleep() to wait for a while. Just be aware that if that's the only thread in the application then nothing will happen while it sleeps.
|
 |
Gaurav Raje
Ranch Hand
Joined: Jul 23, 2010
Posts: 131
|
|
|
sleep will sleep a thread... regardless of whether other threads exist or not. Make sure you catch the exception
|
 |
Jay Dilla
Ranch Hand
Joined: Aug 12, 2004
Posts: 196
|
|
yea saw i could use sleep still after i posted this....my bad!
|
 |
 |
|
|
subject: Implementing sleep() like funtionality in a non threaded class
|
|
|