fixed issue where registration could beat the check. It is more robust now

This commit is contained in:
nathan 2016-03-02 01:27:48 +01:00
parent 48707e6a73
commit 04bfaf1c70

View File

@ -315,10 +315,12 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
// have to BLOCK // have to BLOCK
// don't want the client to run before registration is complete // don't want the client to run before registration is complete
synchronized (this.registrationLock) { synchronized (this.registrationLock) {
try { if (!registrationComplete) {
this.registrationLock.wait(connectionTimeout); try {
} catch (InterruptedException e) { this.registrationLock.wait(connectionTimeout);
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e); } catch (InterruptedException e) {
throw new IOException("Unable to complete registration within '" + connectionTimeout + "' milliseconds", e);
}
} }
} }