Hi!
I want to pause the execution of the program for 5 seconds. The pause is actually required because I am reading from a device from telnet and I need to wait 5 seconds before the response comes in and I send another command.
My method is multi-threaded so Thread.sleep(5000) does not work because according to
http://download.oracle.com/javase/tutorial/essential/concurrency/sleep.html
it says the sleep time is not guaranteed.
I have found this from the web to really sleep for the time specified:
From: http://www.markstechstuff.com/2006/09/java-pause-method.htm
But problem with this code is that it is doing looping and it blocks the other threads from executing.
Anyone has any ideas to really pause the thread for exactly the time specified?
Thanks
I want to pause the execution of the program for 5 seconds. The pause is actually required because I am reading from a device from telnet and I need to wait 5 seconds before the response comes in and I send another command.
My method is multi-threaded so Thread.sleep(5000) does not work because according to
http://download.oracle.com/javase/tutorial/essential/concurrency/sleep.html
it says the sleep time is not guaranteed.
I have found this from the web to really sleep for the time specified:
From: http://www.markstechstuff.com/2006/09/java-pause-method.htm
But problem with this code is that it is doing looping and it blocks the other threads from executing.
Anyone has any ideas to really pause the thread for exactly the time specified?
Thanks