public void destroy() {
    synchronized (failLock) {
      if (destroyed) {
        return;
      }
    }

    destroyed = true;

    internalClose();

    synchronized (sendLock) {
      callClosingListeners();
    }
  }
  public void fail(final ActiveMQException me) {
    synchronized (failLock) {
      if (destroyed) {
        return;
      }

      destroyed = true;
    }

    ActiveMQServerLogger.LOGGER.connectionFailureDetected(me.getMessage(), me.getType());
    // Then call the listeners
    callFailureListeners(me);

    callClosingListeners();

    internalClose();
  }