public void closeConnection(long timeout) throws JMSException, AMQException
{
final AMQStateManager stateManager = _conn.getProtocolHandler().getStateManager();
final AMQState currentState = stateManager.getCurrentState();
if (currentState.equals(AMQState.CONNECTION_CLOSED))
{
_logger.debug("Connection already closed.");
}
else if (currentState.equals(AMQState.CONNECTION_CLOSING))
{
_logger.debug("Connection already closing, awaiting closed state.");
final StateWaiter closeWaiter = new StateWaiter(stateManager, currentState, EnumSet.of(AMQState.CONNECTION_CLOSED));
try
{