Checking in Ray's update to ServiceWaiter.
git-svn-id: https://samskivert.googlecode.com/svn/trunk@2374 6335cc39-0255-0410-8fd6-9bcaacd3b74c
This commit is contained in:
@@ -143,25 +143,23 @@ public class ServiceWaiter<T>
|
|||||||
{
|
{
|
||||||
if (_success == 0) {
|
if (_success == 0) {
|
||||||
synchronized (this) {
|
synchronized (this) {
|
||||||
while (_success == 0) {
|
try {
|
||||||
try {
|
// wait for the response, timing out after a while
|
||||||
// wait for the response, timing out after a while
|
if (_timeout == NO_TIMEOUT) {
|
||||||
if (_timeout == NO_TIMEOUT) {
|
wait();
|
||||||
wait();
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
wait(1000L * _timeout);
|
wait(1000L * _timeout);
|
||||||
}
|
|
||||||
|
|
||||||
// if we get here without some sort of response, then
|
|
||||||
// we've timed out
|
|
||||||
if (_success == 0) {
|
|
||||||
throw new TimeoutException();
|
|
||||||
}
|
|
||||||
|
|
||||||
} catch (InterruptedException ie) {
|
|
||||||
// fall through and wait again
|
|
||||||
}
|
}
|
||||||
|
// if we get here without some sort of response, then
|
||||||
|
// we've timed out
|
||||||
|
if (_success == 0) {
|
||||||
|
throw new TimeoutException();
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (InterruptedException ie) {
|
||||||
|
throw (TimeoutException)
|
||||||
|
new TimeoutException().initCause(ie);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user