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,6 +258,7 @@ public abstract class AbstractChannel
throws ConnectionException, TransportException { throws ConnectionException, TransportException {
openCloseLock.lock(); openCloseLock.lock();
try { try {
if (isOpen()) {
try { try {
sendClose(); sendClose();
} catch (TransportException e) { } catch (TransportException e) {
@@ -265,6 +266,7 @@ public abstract class AbstractChannel
throw e; throw e;
} }
closeEvent.await(conn.getTimeout(), TimeUnit.SECONDS); closeEvent.await(conn.getTimeout(), TimeUnit.SECONDS);
}
} finally { } finally {
openCloseLock.unlock(); openCloseLock.unlock();
} }