File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes end waiting for message (timer class?) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "end waiting for message (timer class?)" Watch "end waiting for message (timer class?)" New topic

end waiting for message (timer class?)

Joel Carklin

Joined: Jun 15, 2001
Posts: 28
Hi All,
My situation is this:
I send an xml message to another server and then expect a reply xml message. I need to set a timeout so that if the I don't get a response mesaage after say 5 seconds then my method will return null, rather than continuing to wait for the response.
I looked at the java util Timer class, but it confused me in this particular scenario.
Any help / suggestions appreciated.
Jason Menard

Joined: Nov 09, 2000
Posts: 6450
If you don't need to spawn another thread and if you do not need a timer that is precise to the millisecond, you could do something simple like the following:

jQuery in Action, 2nd edition
subject: end waiting for message (timer class?)
Similar Threads
timer class doesn't invoke actionperformed
Timer starts twice when it should start only once
Timer starts twice when it should start only once
Timer & TimerTask - Name of Timer Object
what is the best way to run a schedule??