wood burning stoves 2.0*
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 OCA/OCP Java SE 7 Programmer I & II Study Guide this week in the OCPJP forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "end waiting for message (timer class?)" Watch "end waiting for message (timer class?)" New topic
Author

end waiting for message (timer class?)

Joel Carklin
Greenhorn

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.
Thanks
Joel
Jason Menard
Sheriff

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:

HTH
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: end waiting for message (timer class?)