@Override public void close() throws IOException { // the http client uses this MultiThreadedHttpConnectionManager for handling http connections // and we should ensure its shutdown to not leak connections/threads MultiThreadedHttpConnectionManager.shutdownAll(); } }
@Override protected void doDestroy() { Database.Static.getAll().forEach(database -> { try { database.close(); } catch (Exception error) { LOGGER.info( String.format("Can't close [%s] database!", database), error); } }); SqlDatabase.closeAll(); SqlDatabase.Static.deregisterAllDrivers(); // Clean up after incorrect use of Apache HttpClient 3.x. try { LOGGER.info("Shutting down [{}]", MultiThreadedHttpConnectionManager.class); MultiThreadedHttpConnectionManager.shutdownAll(); } catch (NoClassDefFoundError error) { // Not using the library at all. } }
/** * distroy the ConfigurationContext */ @Override public void destroy() { //stoping listner manager try { if (configContext != null) { configContext.terminate(); } } catch (AxisFault axisFault) { log.info(axisFault.getMessage()); } try { super.destroy(); } catch (Exception e) { log.info(e.getMessage()); } // AXIS2-4898: MultiThreadedHttpConnectionManager starts a thread that is not stopped by the // shutdown of the connection manager. If we want to avoid a resource leak, we need to call // shutdownAll here. // TODO - This action need be changed according to current HTTPClient. String clientVersion = getHTTPClientVersion(); if (clientVersion != null && HTTPTransportConstants.HTTP_CLIENT_4_X_VERSION.equals(clientVersion)) { // TODO - Handle for HTTPClient 4 } else { MultiThreadedHttpConnectionManager.shutdownAll(); } }
executor.shutdown(); connectionManager.shutdown(); MultiThreadedHttpConnectionManager.shutdownAll();
@Override protected void doDispose() { if (!disableCleanupThread) { connectionCleaner.shutdown(); if (!muleContext.getConfiguration().isStandalone()) { MultiThreadedHttpConnectionManager.shutdownAll(); } } if (this.connectionManager != null) { connectionManager.dispose(); connectionManager = null; } super.doDispose(); }
MultiThreadedHttpConnectionManager.shutdownAll();
MultiThreadedHttpConnectionManager.shutdownAll();
/** * This should *never* be called, except in tests, or if you are importing or seting up for the first time. The * reason this is called is to ensure that all the managers are reinitialised after the license has changed. * <p/> * Note: Make sure the scheduler is shutdown */ public static synchronized void globalRefresh() { log.debug("ManagerFactory.globalRefresh"); getIndexLifecycleManager().shutdown(); // shutdown task manager final TaskManager taskManager = ComponentManager.getInstance().getTaskManager(); taskManager.shutdownAndWait(0); ComponentAccessor.getComponent(ClusterServicesManager.class).stopServices(); ComponentManager.getInstance().stop(); ComponentManager.getInstance().dispose(); // JDEV-29269 Cleanup resources kept by MultiThreadedHttpConnectionManager - the only // (civilized) way to get rid of the MultiThreadedHttpConnectionManager cleanup thread. MultiThreadedHttpConnectionManager.shutdownAll(); // Look for possible memory leaks new MemoryInspector().inspectMemoryAfterJiraShutdown(); // Rebuild all the registered objects ComponentManager.getInstance().initialise(); // clear the method cache for JRA-16750 ValueStack.clearMethods(); // Need to bootstrap all the components that need initialising ComponentManager.getInstance().start(); CoreFactory.globalRefresh(); getConstantsManager().refresh(); }