/* (non-Javadoc)
@see net.timewalker.ffmq4.common.connection.AbstractConnection#onConnectionClose()
10118
@Override
	protected void onConnectionClose()
    {
    	super.onConnectionClose();
    	
    	try
        {
        	if (transport != null && !transport.isClosed())
        	{
	            log.debug("#"+id+" Closing transport");
	            this.transport.close();
        	}
        }
        catch (Exception e)
        {
            log.error("Could not close transport",e);
        }
    }
780785
final public void close() {
		List<C> connsToClose;
		synchronized(poolLock) {
			// Prevent any new connections
			isClosed = true;
			// Find any connections that are available and open
			connsToClose = new ArrayList<>(availableConnections.size());
			for(PooledConnection<C> availableConnection : availableConnections) {
				synchronized(availableConnection) {
					C conn = availableConnection.connection;
					if(conn!=null) {
						availableConnection.connection = null;
						connsToClose.add(conn);
					}
				}
			}
			poolLock.notifyAll();
		}
		// Close all of the connections
		for(C conn : connsToClose) {
			try {
				close(conn);
			} catch(Exception err) {
				logger.log(Level.WARNING, null, err);
			}
		}
	}
951521
protected void finishConnection() {
    this.connector.dispose();
    this.connector = null;
    for (ConnectionListener listener : this.connectionListeners) {
      listener.connectionEnded(this);
    }
    if (this.executors != null) {
      this.executors.destroy();
    }
  }
1313767
protected void releaseCommPortConnection()
    {
        //get reference
        Connection<CommPortAdapter> connection=this.commConnection;
        this.commConnection=null;

        if(connection!=null)
        {
            //get logger
            Logger logger=this.getLogger();

            try
            {
                //release connection
                logger.logInfo(new Object[]{"Closing COMM port connection."},null);
                connection.close();
            }
            catch(Exception exception)
            {
                logger.logError(new Object[]{"Error while closing COMM port connection."},exception);
            }
        }
    }
1330967
@Override
  public StateConnection onCloseRead()
  {
    ConnectionProtocol request = request();
    
    if (request != null) {
      request.onCloseRead();
    }
    
    _sequenceClose.set(_sequenceRead.get());
    
    if (_sequenceFlush.get() < _sequenceClose.get()) {
      _isClosePending.set(true);
      
      if (_sequenceFlush.get() < _sequenceClose.get()) {
        return StateConnection.CLOSE_READ_S;
      }
      else {
        _isClosePending.set(false);
        
        return StateConnection.CLOSE;
      }
    }
    else {
      return StateConnection.CLOSE;
    }
  }
1264834
private void releaseConnection()
   {
      if (m_rs != null)
      {
         try
         {
            m_rs.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_rs = null;
      }

      if (m_ps != null)
      {
         try
         {
            m_ps.close();
         }

         catch (SQLException ex)
         {
            // silently ignore errors on close
         }

         m_ps = null;
      }
   }
1085688
public void onConnectionClosed() {
        logger.debug("[onConnectionClosed] '{}', isConnected = {}", uri, isConnected());

        webSocketConnectionManager.stop();

        timer = new Timer();

        timer.schedule(new TimerTask() {
            @Override
            public void run() {
                logger.debug("[onConnectionClosed:run]");

                synchronized (webSocketHandler.getNotifyConnectionObject()) {
                    webSocketConnectionManager.start();

                    try {
                        webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT));
                    } catch (InterruptedException e) {
                        logger.debug("[onConnectionClose]", e);
                    }

                    if (isConnected()) {
                        logger.debug("[onConnectionClosed:run] connected");

                        clusterListener.onServerReconnected(getServerId(), uri);
                        this.cancel();
                    } else {
                        logger.debug("[onConnectionClosed:run] NOT connected");

                        webSocketConnectionManager.stop();
                    }
                }
            }
        }, TimeUnit.SECONDS.toMillis(WEBSOCKET_TIMEOUT), TimeUnit.SECONDS.toMillis(WEBSOCKET_RECONNECT_TIMEOUT));
    }
319547
protected void closeConnection() throws SQLException {
        if (connection != null && !connection.isClosed()) {
            connection.close();
            connection = null;
        }

    }
302432
@Override
    public void closeConnection(Object connection) {
        if (connection!=null) {
            ((SoccomClient)connection).close();
            connection = null;
        }
    }
663738
@Override
    public Object onClose(WsRequest wsRequest, byte[] bytes, ChannelContext channelContext) throws Exception {
        TioWebsocketMethodMapper onClose = methods.getOnClose();
        if (onClose != null) {
            onClose.getMethod().invoke(onClose.getInstance(), channelContext);
        }
        log.debug("onClose");
        Tio.remove(channelContext, "onClose");
        return null;
    }
568577
@Override
    public void closeConnection() {
        // Closes the channel, triggering an exception in the network-handling thread triggering connectionClosed()
        try {
            vCloseRequested = true;
            socket.close();
        } catch (IOException e) {
            throw new RuntimeException(e);
        }
    }
1015148
void finishConnection() {
    NioSocketConnector conn = this.connector;
    if (conn != null) {
      this.connector = null;
      conn.dispose();
      for (ConnectionListener listener : this.connectionListeners) {
        listener.connectionEnded(this);
      }
    }
    ExecutorFilter execs = this.executors;
    if (execs != null) {
      this.executors = null;
      execs.destroy();

    }
  }
1141020
public void onCloseLocal(CloseInfo closeInfo) {
        boolean open = false;
        synchronized (this) {
            ConnectionState initialState = this.state;
            if (LOG.isDebugEnabled())
                LOG.debug("onCloseLocal({}) : {}", closeInfo, initialState);
            if (initialState == ConnectionState.CLOSED) {
                // already closed
                if (LOG.isDebugEnabled())
                    LOG.debug("already closed");
                return;
            }

            if (initialState == ConnectionState.CONNECTED) {
                // fast close. a local close request from end-user onConnect/onOpen method
                if (LOG.isDebugEnabled())
                    LOG.debug("FastClose in CONNECTED detected");
                open = true;
            }
        }

        if (open)
            openAndCloseLocal(closeInfo);
        else
            closeLocal(closeInfo);
    }
1057141
protected void closeConnection(final String meUuid) 
    {
        final String methodName = "closeConnection";
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) 
        {
            SibTr.entry(this, TRACE, methodName, meUuid);
        }
        
        closeConnection (meUuid, false);
        
        if (TraceComponent.isAnyTracingEnabled() && TRACE.isEntryEnabled()) 
        {
            SibTr.exit(this, TRACE, methodName);
        }
    }
907373
@Override
  public void close() throws IOException {
    try {
      try {
        if (this.failed && this.conn != null) {
          this.conn.rollback();
        }
      } finally {
        if (this.conn != null) {
          this.conn.close();
        }
      }
    } catch (SQLException e) {
      throw new RuntimeException(e);
    }
  }
1185683
protected void connectionClosed (Connection conn)
    {
        // remove this connection from our mappings (it is automatically removed from the Selector
        // when the socket is closed)
        _handlers.remove(conn.selkey);
        _connections.remove(conn.getConnectionId());
        _oflowqs.remove(conn);
        synchronized (this) {
            _stats.closes++;
        }
    }
748702
@Override
    public void releaseConnection() {
        if (apacheHttpResponse != null) {
            try {
                apacheHttpResponse.close();
                apacheHttpResponse = null;
            } catch (IOException e) {
                logger.error("error closing Apache HttpResponse - {}", e);
            }
        }
    }