AbstractChannel#close() should be no-op if already closed. Fixes #53.

This commit is contained in:
Shikhar Bhushan
2012-06-06 22:55:35 +01:00
parent b44631ea97
commit a877ec1448

View File

@@ -258,13 +258,15 @@ public abstract class AbstractChannel
throws ConnectionException, TransportException {
openCloseLock.lock();
try {
try {
sendClose();
} catch (TransportException e) {
if (!closeEvent.inError())
throw e;
if (isOpen()) {
try {
sendClose();
} catch (TransportException e) {
if (!closeEvent.inError())
throw e;
}
closeEvent.await(conn.getTimeout(), TimeUnit.SECONDS);
}
closeEvent.await(conn.getTimeout(), TimeUnit.SECONDS);
} finally {
openCloseLock.unlock();
}