aspose file tools*
The moose likes Java in General and the fly likes Implementing sleep() like funtionality in a non threaded class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Implementing sleep() like funtionality in a non threaded class" Watch "Implementing sleep() like funtionality in a non threaded class" New topic
Author

Implementing sleep() like funtionality in a non threaded class

Jay Dilla
Ranch Hand

Joined: Aug 12, 2004
Posts: 201
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: 4467
    
    8

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: 136
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: 201
yea saw i could use sleep still after i posted this....my bad!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Implementing sleep() like funtionality in a non threaded class