Should use as destroy method. Disconnects from a Service Locator server.
All endpoints that were registered before are removed from the server.
Set property locatorClient to null.

@throws InterruptedException
@throws ServiceLocatorException
502236
@PreDestroy
    public void disconnectLocator() throws InterruptedException,
            ServiceLocatorException {
        if (LOG.isLoggable(Level.FINE)) {
            LOG.fine("Destroy Locator client");
        }

        if (endpointCollector != null) {
            endpointCollector.stopScheduledCollection();
        }
        
        if (locatorClient != null) {
            locatorClient.disconnect();
            locatorClient = null;
        }
    }
764737
@Override
    public void destroy()
    {
        this.externalProperties = null;
        Object connection = getConnectionPoolOrConnection();

        if (connection != null)
        {
            ((TransportClient) connection).close();

        }
    }
534745
public void stop() throws InterruptedException
    {
        if (_selectorThread != null)
            _selectorThread.doStop();
            
        super.stop();
        log.info("Stopped SocketChannelListener on " + getHost()+":"+getPort());
    }
1265168
public static void destroyEndpoints() {
        EndPointMgrImpl _this = (EndPointMgrImpl) getRef();
        synchronized (_this.endpoints) {
            _this.destroyEndpointMBeans();
            _this.endpoints.clear();
        }
    }
276457
protected void disconnect()
    {
        if (localWrapperProxyState != null) // F58064
        {
            localWrapperProxyState.disconnect();
        }

        if (ivBusinessLocalWrapperProxyStates != null) // F58064
        {
            for (WrapperProxyState state : ivBusinessLocalWrapperProxyStates)
            {
                state.disconnect();
            }
        }

        if (ivRemoteObjectWrapper != null)
        { // synchronized on the remote Wrapper to set the isRemoteRegistered flag
            synchronized (ivRemoteObjectWrapper)
            {
                if (isRemoteRegistered)
                {
                    try
                    {
                        // @PQ98903A
                        // On zOS even though we don't call the object
                        // adapter to register the servant, we need
                        // to call it to unregister it if the wrapper
                        // is connected to the ORB (i.e. it has a Tie).
                        if ((!isZOS) || (ivRemoteObjectWrapper.intie != null)) // @PQ98903C
                        {
                            ivRemoteObjectWrapper.container.getEJBRuntime().unregisterServant(ivRemoteObjectWrapper);
                        }
                        isRemoteRegistered = false;
                    } catch (Exception ex)
                    {
                        FFDCFilter.processException(ex, CLASS_NAME +
                                                        ".unregisterServant",
                                                    "207", this);
                        if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                        {
                            Tr.event(tc, "Failed to unregister wrapper instance",
                                     new Object[] { ivRemoteObjectWrapper, ex });
                        }
                    }
                }
            }
        }

        // d416391 start
        // Unregister any BusinessRemoteWrapper objects that are registered with ORB.
        if (ivBusinessRemote != null) // d416391 d424839
        {
            int numWrappers = ivBusinessRemote.length;
            for (int i = 0; i < numWrappers; ++i)
            {
                BusinessRemoteWrapper wrapper = ivBusinessRemote[i];
                synchronized (wrapper)
                {
                    if (ivBusinessRemoteRegistered[i])
                    {
                        try
                        {
                            // On zOS even though we don't call the object adapter to register
                            // the servant, we need to call it to unregister it if the wrapper
                            // is connected to the ORB (i.e. it has a Tie).
                            if ((!isZOS) || (wrapper.intie != null))
                            {
                                wrapper.container.getEJBRuntime().unregisterServant(wrapper);
                            }
                            ivBusinessRemoteRegistered[i] = false;
                        } catch (Throwable ex)
                        {
                            FFDCFilter.processException(ex, CLASS_NAME + ".unregisterServant",
                                                        "516", this);
                            if (TraceComponent.isAnyTracingEnabled() && tc.isEventEnabled())
                            {
                                Tr.event(tc, "Failed to unregister wrapper instance",
                                         new Object[] { wrapper, ex });
                            }
                        }
                    }
                } // end synchronized
            } // end for
        } // d416391 end
    }
1363849
public void contextDestroyed(ServletContextEvent event) {
        // Output a simple message to the server's console
        System.out.println("The Simple Web App. Has Been Removed");
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
                "/client.xml");
        LocatorService client = (LocatorService) context
                .getBean("locatorService");

        String serviceHost = this.context.getInitParameter("serviceHost");

        try {
            client.unregisterEndpoint(new QName("http://talend.org/esb/examples/", "GreeterService"), serviceHost);
        } catch (InterruptedExceptionFault e) {
            e.printStackTrace();
        } catch (ServiceLocatorFault e) {
            e.printStackTrace();
        }
        this.context = null;
    }
1277045
public void disconnect(Destination d) throws KNXLinkClosedException
	{
		if (detached)
			throw new KNXIllegalStateException("TL detached");
		if (d.getState() != Destination.DESTROYED
			&& d.getState() != Destination.DISCONNECTED)
			disconnectIndicate(getProxy(d), true);
	}
88273
@Override
    public void stop() {
        // Run jersey shutdown lifecycle
        if (container != null) {
            container.stop();
            container = null;
        }
        // Destroy the jersey service locator
        if (jerseyHandler != null && jerseyHandler.getDelegate() != null) {
            ServiceLocatorFactory.getInstance().destroy(jerseyHandler.getDelegate().getServiceLocator());
            jerseyHandler = null;
        }
        if (server != null) {
            server.close();
            server = null;
        }
    }
276215
private void removeListenersOfAllPendingCachedRequests() throws InterruptedException {
        synchronized (mapPendingRequestToRequestListener) {
            if (!mapPendingRequestToRequestListener.isEmpty()) {
                for (final CachedSpiceRequest<?> cachedSpiceRequest : mapPendingRequestToRequestListener.keySet()) {

                    final Set<RequestListener<?>> setRequestListeners = mapPendingRequestToRequestListener.get(cachedSpiceRequest);
                    if (setRequestListeners != null) {
                        Ln.d("Removing listeners of pending request : " + cachedSpiceRequest.toString() + " : " + setRequestListeners.size());
                        spiceService.dontNotifyRequestListenersForRequest(cachedSpiceRequest, setRequestListeners);
                    }
                }
                mapPendingRequestToRequestListener.clear();
            }
        }
        Ln.v("Cleared listeners of all pending requests");
    }
778650
@Handler(priority = -10000)
    public void onStop(Stop event) throws InterruptedException {
        synchronized (this) {
            if (runner == null) {
                return;
            }
            runner.interrupt();
            synchronized (this) {
                if (registered) {
                    unregisterAsGenerator();
                    registered = false;
                }
            }
            runner = null;
        }
    }
302496
@Override
    public void close() {
        try {
            if (clientSidePolicy != null) {
                clientSidePolicy.removePropertyChangeListener(this);
            }

        } finally {
            if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) {
                Tr.debug(tc, "Finished servicing http request on conduit. ");
            }
            //clean up address within threadlocal of EndPointInfo
            endpointInfo.resetAddress();    //Liberty #3669
        }

    }
532379
protected void disconnect() {
        disconnect0(connectedAddress.holder().getFamily());
        connected = false;
        connectedAddress = null;
        connectedPort = -1;
    }
545657
@Override
    public boolean shutdown() throws InterruptedException {
        // Prevent shutdown before the server has properly started
        managerLatch.await();

        if (manager == null)
            return false;

        manager.shutdownFramework();
        manager.waitForShutdown();
        return true;
    }
517040
public void close() {
        lock.lock();
        try {
            if (this.closed) {
                return;
            }

            if (!this.inited) {
                return;
            }

            if (logStatsThread != null) {
                logStatsThread.interrupt();
            }

            if (createConnectionThread != null) {
                createConnectionThread.interrupt();
            }

            if (destroyConnectionThread != null) {
                destroyConnectionThread.interrupt();
            }

            if (destroySchedulerFuture != null) {
                destroySchedulerFuture.cancel(true);
            }

            for (int i = 0; i < poolingCount; ++i) {
                try {
                    DruidConnectionHolder connHolder = connections[i];

                    for (PreparedStatementHolder stmtHolder : connHolder.getStatementPool().getMap().values()) {
                        connHolder.getStatementPool().closeRemovedStatement(stmtHolder);
                    }
                    connHolder.getStatementPool().getMap().clear();

                    Connection physicalConnection = connHolder.getConnection();
                    physicalConnection.close();
                    connections[i] = null;
                    destroyCount.incrementAndGet();
                } catch (Exception ex) {
                    LOG.warn("close connection error", ex);
                }
            }
            poolingCount = 0;

            // close elasticsearch client
            if (this.client != null) {
                this.client.close();
            }

            unregisterMbean();

            enable = false;
            notEmpty.signalAll();
            notEmptySignalCount++;

            this.closed = true;
            this.closeTimeMillis = System.currentTimeMillis();

            for (Filter filter : filters) {
                filter.destroy();
            }
        } finally {
            lock.unlock();
        }

        if (LOG.isInfoEnabled()) {
            LOG.info("{dataSource-" + this.getID() + "} closed");
        }
    }
914662
public void destroy() {
        JmsUtils.closeSession(session);

        if (connection != null) {
            ConnectionFactoryUtils.releaseConnection(connection, endpointConfiguration.getConnectionFactory(), true);
        }
    }
376428
@Override
	public final Promise disconnect() {
		if (client != null) {
			client.close();
			client = null;
		} else if (clusteredClient != null) {
			clusteredClient.close();
			clusteredClient = null;
		}
		return super.disconnect();
	}
786929
void tearDown() throws InterruptedException {
    if (cancelFuture != null) {
      cancelFuture.cancel(false);
    }
    executor.shutdown();
    executor.awaitTermination(10, TimeUnit.SECONDS);
  }