Shutdown connector.

This method wait when all resources will be closed.
You can call this method any time.
No problem and exceptions if you try to shutdown connector twice without start.
766798
public void shutdown() {
        if (workers == null) {
            if (LOGGER.isLoggable(Level.INFO))
                LOGGER.info(name + " already been shutdown");
            return;
        }

        if (LOGGER.isLoggable(Level.INFO))
            LOGGER.info("Starting shutdown " + name);

        for (final Thread worker : workers) {
            worker.interrupt();
            try {
                worker.join();
            } catch (InterruptedException exception) {
                Thread.currentThread().interrupt();
            }
        }
        workers = null;

        TcpServerHandler handler;
        while ((handler = handlers.poll()) != null) handler.destroy();
        handlers = null;

        if (LOGGER.isLoggable(Level.INFO))
            LOGGER.info(name + " was shutdown");
    }
1028613
private void checkCloseConnection(ChannelFuture future) {
        // If this connection is closing and the graceful shutdown has completed, close the connection
        // once this operation completes.
        if (closeListener != null && isGracefulShutdownComplete()) {
            ChannelFutureListener closeListener = this.closeListener;
            // This method could be called multiple times
            // and we don't want to notify the closeListener multiple times.
            this.closeListener = null;
            try {
                closeListener.operationComplete(future);
            } catch (Exception e) {
                throw new IllegalStateException("Close listener threw an unexpected exception", e);
            }
        }
    }
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();
        }
    }
926917
void shutdown()
    {
        synchronized (this)
        {
            ivPoolCapacity = -1;
        }

        if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled())
            Tr.debug(tc, "shutdown : " + this);

        EntityManager em = ivPool.poll();

        while (em != null)
        {
            if (em.isOpen())
            {
                em.close();
            }
            em = ivPool.poll();
        }

        synchronized (this)
        {
            ivPoolSize = 0;
        }
    }
1342549
def shutdown(self):
        
        if self.cycle is None or self.cycle.response_complete:
            event = h11.ConnectionClosed()
            self.conn.send(event)
            self.transport.close()
        else:
            self.cycle.keep_alive = False
281888
async def on_shutdown(app):
    
    for method in app.get("close_methods", []):
        logger.debug("Calling < %s >", method)
        if asyncio.iscoroutinefunction(method):
            await method()
        else:
            method()
784609
public static base_response Shutdown(nitro_service client, shutdown resource) throws Exception {
		shutdown Shutdownresource = new shutdown();
		return Shutdownresource.perform_operation(client);
	}
1303509
def shutdown(opts):
    '''
    
    '''
    try:
        if not NETWORK_DEVICE.get('UP', False):
            raise Exception('not connected!')
        NETWORK_DEVICE.get('DRIVER').close()
    except Exception as error:
        port = NETWORK_DEVICE.get('OPTIONAL_ARGS', {}).get('port')
        log.error(
            'Cannot close connection with %s%s! Please check error: %s',
            NETWORK_DEVICE.get('HOSTNAME', '[unknown hostname]'),
            ':{0}'.format(port) if port else '',
            error
        )

    return True
268029
@Override
	public void stop()
    {
        super.stop();
        if (connectorServer != null)
        {
            try
            {
                connectorServer.stop();
            }
            catch (Exception e)
            {
                log.error("Could not stop JMX connector server",e);
            }
            finally
            {
            	connectorServer = null;
            }
        }
        if (registry != null)
        {
	        try
	        {
	        	String jndiName = "jmxconnector-"+agentName;
	            registry.unbind(jndiName);
	        }
	        catch (Exception e)
	        {
	        	// Ignore
	        }
	        finally
	        {
	        	registry = null;
	        }
        }
        if (mBeanServerSocketFactory != null)
        {
        	try
            {
        		mBeanServerSocketFactory.close();
            }
        	catch (Exception e)
            {
                log.error("Could not close MBeans server socket factory",e);
            }
        	finally
            {
        		mBeanServerSocketFactory = null;
            }
        }
    }
1286465
def on_shutdown(self, broker):
        
        _v and LOG.debug('%r.on_shutdown()', self)
        fire(self, 'shutdown')
        self.on_disconnect(broker)
748131
def shutdown(self):
        
        with self._lock:
            if self.is_shutdown:
                return
            else:
                self.is_shutdown = True

        # PYTHON-673. If shutdown was called shortly after session init, avoid
        # a race by cancelling any initial connection attempts haven't started,
        # then blocking on any that have.
        for future in self._initial_connect_futures:
            future.cancel()
        wait_futures(self._initial_connect_futures)

        for pool in tuple(self._pools.values()):
            pool.shutdown()
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);
        }
    }
534191
public void shutdownAndWait() {
		try {
			client.shutdown().get();
			LOG.info("The Queryable State Client was shutdown successfully.");
		} catch (Exception e) {
			LOG.warn("The Queryable State Client shutdown failed: ", e);
		}
	}
658320
def close(self):
        """"""
        if not self.connected: return True

        self._close()
        self.connected = False
        self.log("Closed Connection {}", self.connection_config.interface_name)
        return True
9214
public static void shutdown() {
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.entry(tc, "shutdown");
        }
        synchronized (oneAtATime) {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "have lock"); // running with fixes (2)");
            }

            if (aioInitialized == AIO_INITIALIZED) {
                // mark the library as shutdown
                aioInitialized = AIO_SHUTDOWN;
                // Shut down sequence for the library...
                closeAllCompletionPorts();
                try {
                    aio_shutdown();
                } catch (AsyncException ae) {
                    // ignore shutdown errors
                    if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                        Tr.debug(tc, "AsyncException occured while shutting down: " + ae.getMessage());
                    }
                }
            }
        } // end-sync
        if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) {
            Tr.exit(tc, "shutdown");
        }
    }
1004704
public void shutdown() {
        for (Connection connection : _connectionMap.values()) {
            connection.shutdown();
        }

        for (Connection connection : _privilegedConnectionMap.values()) {
            connection.shutdown();
        }

        _factory.releaseExternalResources();
    }
120701
def close(self):
        
        log.debug("Closing socket connection for %s:%d" % (self.host, self.port))
        if self._sock:
            # Call shutdown to be a good TCP client
            # But expect an error if the socket has already been
            # closed by the server
            try:
                self._sock.shutdown(socket.SHUT_RDWR)
            except socket.error:
                pass

            # Closing the socket should always succeed
            self._sock.close()
            self._sock = None
        else:
            log.debug("No socket found to close!")