Changed endpoint.close -> endpoint.closeConnections for clarity on behavior

This commit is contained in:
nathan 2016-03-10 23:50:34 +01:00
parent 17efc50a06
commit 537d76bc8f
3 changed files with 24 additions and 11 deletions

View File

@ -277,7 +277,7 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
public
void reconnect(int connectionTimeout) throws IOException {
// close out all old connections
close();
closeConnections();
connect(connectionTimeout);
}
@ -468,15 +468,26 @@ class Client<C extends Connection> extends EndPointClient<C> implements Connecti
}
/**
* Closes all connections ONLY (keeps the server/client running).
* Closes all connections ONLY (keeps the client running). To STOP the client, use stop().
* <p/>
* This is used, for example, when reconnecting to a server.
*/
@Override
public
void closeConnections() {
synchronized (this.registrationLock) {
this.registrationLock.notify();
}
}
/**
* Closes all connections ONLY (keeps the client running). To STOP the client, use stop().
* <p/>
* This is used, for example, when reconnecting to a server.
*/
@Override
public
void close() {
synchronized (this.registrationLock) {
this.registrationLock.notify();
}
closeConnections();
}
}

View File

@ -528,12 +528,14 @@ class EndPoint<C extends Connection> {
ConnectionBridgeBase send();
/**
* Closes all connections ONLY (keeps the server/client running).
* Closes all connections ONLY (keeps the server/client running). To STOP the client/server, use stop().
* <p/>
* This is used, for example, when reconnecting to a server. The server should ALWAYS use STOP.
* This is used, for example, when reconnecting to a server.
* <p/>
* The server should ALWAYS use STOP.
*/
public
void close() {
void closeConnections() {
// give a chance to other threads.
Thread.yield();
@ -621,7 +623,7 @@ class EndPoint<C extends Connection> {
// make sure we are not trying to stop during a startup procedure.
// This will wait until we have finished starting up/shutting down.
synchronized (this.shutdownInProgress) {
close();
closeConnections();
this.logger.info("Stopping endpoint");

View File

@ -106,7 +106,7 @@ class ReuseTest extends BaseTest {
}
}
client.close();
client.closeConnections();
}
assertEquals(count * 2 * 2, this.clientCount.get() + this.serverCount.get());
@ -177,7 +177,7 @@ class ReuseTest extends BaseTest {
}
}
client.close();
client.closeConnections();
}
assertEquals(count * 2, this.clientCount.get() + this.serverCount.get());