Shut down the engine for the given SSL connection link.

@param connLink
@param isServer
@param isConnected
5867
public static void shutDownSSLEngine(SSLConnectionLink connLink, boolean isServer, boolean isConnected) {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "shutDownSSLEngine: isServer: " + isServer
                         + " isConnected: " + isConnected + " " + connLink);
        }
        SSLEngine engine = connLink.getSSLEngine();

        if (engine != null) {

            if (isServer) {
                if (!engine.isInboundDone()) {
                    if (isConnected) {
                        engine.closeOutbound();
                        WsByteBuffer buffer = allocateByteBuffer(
                                                                 engine.getSession().getPacketBufferSize(), false);
                        flushCloseDown(engine, buffer, connLink);
                        buffer.release();
                    }
                    try {
                        engine.closeInbound();
                    } catch (SSLException se) {
                        // no FFDC required, should indicate that we're closing before
                        // the remote end started the close process
                    }
                }
            } else {
                // client side closing
                if (!engine.isOutboundDone()) {
                    engine.closeOutbound();
                }
                if (isConnected) {
                    WsByteBuffer buffer = allocateByteBuffer(
                                                             engine.getSession().getPacketBufferSize(), false);
                    flushCloseDown(engine, buffer, connLink);
                    buffer.release();
                    // Note: ideally we would do a read/unwrap at this point to pull the
                    // server side CLOSE message off the network but that shouldn't be
                    // necessary
                }
            }
        } else {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
                Tr.debug(tc, "SSLEngine is null, must be shutdown already.");
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "shutDownSSLEngine");
        }
    }
1233781
public synchronized void close() throws IOException {
        if(getStatus().equals(ConnectionStatus.CLOSED)){
            return ;
        }
        if (LOGGER.isDebugEnabled()) {
            LOGGER.debug("Closing client for session: 0x"
                      + getSessionId());
        }
        connectRun.set(false);

        try{
            clientSocket.cleanup();
        }catch(Exception e){
            LOGGER.warn("Close the WSDirectorySocket get error.", e);
        }

        try {
            setStatus(ConnectionStatus.CLOSED);
            sendCloseSession();
            closeSession();
            eventThread.queueEventOfDeath();
        } catch (ServiceException e) {
            LOGGER.warn("Execute the CloseSession Protocol failed when close", e);
        }
    }
1371303
public static void close(Connection conn) {
        if (conn != null) {
            try {
                conn.close();
            } catch (SQLException ex) {
                logger.error("", ex);
            }
        }
    }
691168
public final void shutdown() throws IOException {
    if (this.shutdown) {
      return;
    }
    this.shutdown0();
    this.shutdown = true;
    this.connector.shuttingDown();
    this.connector.quitAllSessions();
    this.connector.stop();
    this.memcachedHandler.stop();
    XMemcachedMbeanServer.getInstance().shutdown();
    if (AddrUtil.isEnableShutDownHook() && !this.isHutdownHookCalled) {
      try {
        Runtime.getRuntime().removeShutdownHook(this.shutdownHookThread);
      } catch (Exception e) {
        // ignore;
      }
    }
  }
1000288
static void shutDown() {
        ServerRequestQueue.shutDown();
        PrefHelper.shutDown();
        BranchUtil.shutDown();
        DeviceInfo.shutDown();

        // BranchStrongMatchHelper.shutDown();
        // BranchViewHandler.shutDown();
        // DeepLinkRoutingValidator.shutDown();
        // InstallListener.shutDown();
        // InstantAppUtil.shutDown();
        // IntegrationValidator.shutDown();
        // ShareLinkManager.shutDown();
        // UniversalResourceAnalyser.shutDown();

        // Release these contexts immediately.
        if (branchReferral_ != null) {
            branchReferral_.context_ = null;
            branchReferral_.currentActivityReference_ = null;
        }

        // Reset all of the statics.
        branchReferral_ = null;
        customReferrableSettings_ = CUSTOM_REFERRABLE_SETTINGS.USE_DEFAULT;
        bypassCurrentActivityIntentState_ = false;
        disableInstantDeepLinking = false;
        isActivityLifeCycleCallbackRegistered_ = false;
        isAutoSessionMode_ = false;

        isForcedSession_ = false;
        isSimulatingInstalls_ = false;

        checkInstallReferrer_ = true;
    }
484630
public void shutdown() {
        final Connection connection;
        synchronized (this) {
            if(shutdown) return;
            shutdown = true;
            connection = this.connection;
            if(connectTask != null) {
                connectTask.shutdown();
            }
        }
        if (connection != null) {
            connection.closeAsync();
        }
    }
332023
function(sourceWasAnError, shouldNotReconnect) {
      log.error("[Endpoint] Connection closed " + (sourceWasAnError ? 'because of an error:' + sourceWasAnError : ''));

      this.connected = false;
      this.handshaken = false;
      this.connecting = false;

      if (!shouldNotReconnect) {
        log.debug('onClose():: reconnecting...');
        this.handshakenBackoff.reset();
        this.reconnectBackoff.backoff();
      } else {
        log.debug('onClose():: don\'t reconnect');
        this.handshakenBackoff.reset();
        this.reconnectBackoff.reset();
      }

      this.emit('close', sourceWasAnError);
    }
274278
protected void removeConnection(ConnectionImpl connection) {
        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.entry(tc, "removeConnection", connection);

        synchronized (_connections) {
            _connections.remove(connection);
        }

        if (TraceComponent.isAnyTracingEnabled()
            && tc.isEntryEnabled())
            SibTr.exit(tc, "removeConnection");
    }
254600
public void shutdown() {
		synchronized (lock) {
			if (isShutdown) {
				return;
			}

			LOG.info("Shutting down the network environment and its components.");

			// terminate all network connections
			try {
				LOG.debug("Shutting down network connection manager");
				connectionManager.shutdown();
			}
			catch (Throwable t) {
				LOG.warn("Cannot shut down the network connection manager.", t);
			}

			// shutdown all intermediate results
			try {
				LOG.debug("Shutting down intermediate result partition manager");
				resultPartitionManager.shutdown();
			}
			catch (Throwable t) {
				LOG.warn("Cannot shut down the result partition manager.", t);
			}

			// make sure that the global buffer pool re-acquires all buffers
			networkBufferPool.destroyAllBufferPools();

			// destroy the buffer pool
			try {
				networkBufferPool.destroy();
			}
			catch (Throwable t) {
				LOG.warn("Network buffer pool did not shut down properly.", t);
			}

			isShutdown = true;
		}
	}
988918
public void shutdown(boolean join) {
        setShutdownInProgress();
        nullifyWatchdog();
        if (sshConnection != null) {
            logger.info("Shutting down the ssh connection.");
            try {
                sshConnection.disconnect();
            } catch (Exception ex) {
                logger.warn("Error when disconnecting sshConnection.", ex);
            }
        }
        if (join) {
            try {
                this.join();
            } catch (InterruptedException ex) {
                logger.warn("Got interrupted while waiting for shutdown.", ex);
            }
        }
    }
945107
private void remove(PollController conn)
  {
    if (conn == null) {
      return;
    }

    JniSocketImpl socket = (JniSocketImpl) conn.getSocket();
    int nativeFd = socket.getNativeFd();

    if (_lifecycle.isDestroyed()) {
      return;
    }

    _activeCount.incrementAndGet();

    if (nativeFd > 0) {
      try {
        removeNative(_fd, nativeFd);
      } catch (Throwable e) {
        log.log(Level.WARNING, e.toString(), e);
        _lifecycle.toError();
      }
    }
    
    conn.toKeepaliveClose();

    if (_activeCount.decrementAndGet() == 0 && _lifecycle.isDestroyed()) {
      destroy();
    }
  }
626765
@PreDestroy
    public void releaseConnections() throws JMSException {
        LOGGER.debug("Tearing down: {}", this.getClass().getCanonicalName());

        producer.close();
        jmsSession.close();
        connection.close();
        eventBus.unregister(this);
    }
1095712
public synchronized void shutdown(){

		if (!this.poolShuttingDown){
			logger.info("Shutting down connection pool...");
			this.poolShuttingDown = true;
			this.shutdownStackTrace = captureStackTrace(SHUTDOWN_LOCATION_TRACE);
			this.keepAliveScheduler.shutdownNow(); // stop threads from firing.
			this.maxAliveScheduler.shutdownNow(); // stop threads from firing.
			this.connectionsScheduler.shutdownNow(); // stop threads from firing.
			this.asyncExecutor.shutdownNow();

			try {
				this.connectionsScheduler.awaitTermination(5, TimeUnit.SECONDS);

				this.maxAliveScheduler.awaitTermination(5, TimeUnit.SECONDS);
				this.keepAliveScheduler.awaitTermination(5, TimeUnit.SECONDS);
				this.asyncExecutor.awaitTermination(5, TimeUnit.SECONDS);
				
				if (this.closeConnectionExecutor != null){
					this.closeConnectionExecutor.shutdownNow();
					this.closeConnectionExecutor.awaitTermination(5, TimeUnit.SECONDS);
				}
				
			} catch (InterruptedException e) {
				// do nothing
			}
			this.connectionStrategy.terminateAllConnections();
			unregisterDriver();
			registerUnregisterJMX(false);
			if (finalizableRefQueue != null) {
				finalizableRefQueue.close();
			}
			    logger.info("Connection pool has been shutdown.");
		}
	}
873743
private void closeEngine(SSLEngine engine) {
        // PK13349 - close the engine we created during discrimination. We do not
        // need to flush any data however
        if (null != engine) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Closing discrimination engine");
            }
            engine.closeOutbound();
            if (!engine.isInboundDone()) {
                try {
                    engine.closeInbound();
                } catch (SSLException se) {
                    // no ffdc required
                    if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled()) {
                        Tr.event(tc, "Error closing inbound engine side; " + se);
                    }
                }
            }
        }
    }
1348702
public void close() {
        if (connected) {
            try {
                transport.close();
            }
            catch (IOException ex) {
                logger.debug("close()", ex);
            }
            finally {
                connected = false;
            }
        }
    }
1285637
private void closeOutboundInternal() {

        if ((debug != null) && Debug.isOn("ssl")) {
            System.out.println(threadName() + ", closeOutboundInternal()");
        }

        /*
         * Already closed, ignore
         */
        if (writer.isOutboundDone()) {
            return;
        }

        switch (connectionState) {

        /*
         * If we haven't even started yet, don't bother reading inbound.
         */
        case cs_START:
            writer.closeOutbound();
            inboundDone = true;
            break;

        case cs_ERROR:
        case cs_CLOSED:
            break;

        /*
         * Otherwise we indicate clean termination.
         */
        // case cs_HANDSHAKE:
        // case cs_DATA:
        // case cs_RENEGOTIATE:
        default:
            warning(Alerts.alert_close_notify);
            writer.closeOutbound();
            break;
        }

        // See comment in changeReadCiphers()
        writeCipher.dispose();

        connectionState = cs_CLOSED;
    }
872387
protected synchronized void fireConnectionChangeEvent(boolean isConnected) {
        ConnectionChangeEvent cce = new ConnectionChangeEvent(this, isConnected);

        for (ConnectionChangeListener ccl : connectionListeners) {
            ccl.connectionChangeEventReceived(cce);
        }
    }