Fixed issue with registration timeout == 0 (it will now wait indefinitely)
This commit is contained in:
parent
448223f4c8
commit
c609bb7328
|
@ -70,13 +70,23 @@ class EndPointClient extends EndPoint {
|
||||||
|
|
||||||
// have to BLOCK (must be outside of the synchronize call), we don't want the client to run before registration is complete
|
// have to BLOCK (must be outside of the synchronize call), we don't want the client to run before registration is complete
|
||||||
try {
|
try {
|
||||||
|
if (connectionTimeout > 0) {
|
||||||
if (!registration.await(connectionTimeout, TimeUnit.MILLISECONDS)) {
|
if (!registration.await(connectionTimeout, TimeUnit.MILLISECONDS)) {
|
||||||
closeConnection();
|
closeConnection();
|
||||||
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds");
|
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
registration.await();
|
||||||
|
}
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
|
if (connectionTimeout > 0) {
|
||||||
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e);
|
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
throw new IOException("Unable to complete registration.", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -334,8 +334,7 @@ class RmiGlobalTest extends BaseTest {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
// client.connect(5000);
|
client.connect(5000);
|
||||||
client.connect(0);
|
|
||||||
waitForThreads();
|
waitForThreads();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -122,8 +122,7 @@ class TestClient
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
client.connect(0);
|
client.connect(3000);
|
||||||
|
|
||||||
client.waitForShutdown();
|
client.waitForShutdown();
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user