Stops the environment, closing down any resources.

The resources are closed in the reverse order that they're started
768187
@Override
  public void stop()
  {
    if (! getLifecycle().toStop()) {
      return;
    }
    
    ArrayList<EnvLoaderListener> listeners = getEnvironmentListeners();

    Thread thread = Thread.currentThread();
    ClassLoader oldLoader = thread.getContextClassLoader();
    thread.setContextClassLoader(this);

    try {
      // closing down in reverse
      if (listeners != null) {
        for (int i = listeners.size() - 1; i >= 0; i--) {
          EnvLoaderListener listener = listeners.get(i);

          try {
            listener.environmentStop(this);
          } catch (Throwable e) {
            log().log(Level.WARNING, e.toString(), e);
          }
        }
      }
      
      super.stop();
    } finally {
      thread.setContextClassLoader(oldLoader);

      // drain the thread pool for GC
      // XXX: ExecutorThreadPoolBaratine.getThreadPool().stopEnvironment(this);
    }
  }
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;
		}
	}
183097
public void shutdown() {
    this.shouldRun = false;
    this.namespaceSliceDUMap.clear();
    if(this.refreshUsed != null) {
      this.refreshUsed.interrupt();
      try {
        this.refreshUsed.join();
        this.refreshUsed = null;
      } catch (InterruptedException ie) {
      }
    }
  }
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;
        }
    }
1237592
@Override
	public void close() throws Exception {
		if (enterUnlessClosed()) {
			try {
				try {
					// this class' own cleanup logic
					resourceManagerLeaderElectionService.shutdown();
					dispatcher.shutdownNow();
				}
				finally {
					// in any case must we call the parent cleanup logic
					super.close();
				}
			}
			finally {
				exit();
			}
		}
	}
1317246
def shutdown(self):
        
        self._storage.clear()
        self._scheduler.shutdown(wait=False)
        self._workers.shutdown(wait=False)
27017
public void stop() {
        synchronized (this.startStopMonitor) {
            doStop();

            // If we registered a JVM shutdown hook, we don't need it anymore now:
            // We've already explicitly closed the context.
            if (this.shutdownHook != null) {
                try {
                    Runtime.getRuntime().removeShutdownHook(this.shutdownHook);
                } catch (final IllegalStateException ex) {
                    // ignore - VM is already shutting down
                }
            }
        }
    }
699664
def stop(self):
        
        if self.is_run:
            self._service.shutdown()
            self._service.server_close()
874588
public void shutdown() {
        // as resources are returned we need to shut them down
        T t;
        synchronized (lock) {
            isRunning = false;
            t = idleResources.poll();
        }
        while (t != null) {
            returnResource(t, true);
            synchronized (lock) {
                t = idleResources.poll();
            }
        }
    }
1093624
@Override
    public synchronized void stop() {
        if (engine != null) {
            Future<Boolean> shutdown = engine.shutdown();
            final int SHUTDOWN_TIMEOUT = 30;
            try {
                LOGGER.debug("Shutting down engine to stop resource adapter");
                if ( ! shutdown.get(SHUTDOWN_TIMEOUT, TimeUnit.SECONDS)) {
                    // ModeShapeEngine somehow remained running, nothing to be done about it.
                    LOGGER.error(JcaI18n.unableToStopEngine);
                }
            } catch (TimeoutException e) {
                // Exception can be expected, but stack trace is logged to find where limit was defined
                LOGGER.error(e, JcaI18n.unableToStopEngineWithinTimeLimit, SHUTDOWN_TIMEOUT);
            } catch (InterruptedException e) {
                LOGGER.error(e, JcaI18n.interruptedWhileStoppingJcaAdapter,e.getMessage());
            } catch (ExecutionException e) {
                LOGGER.error(e, JcaI18n.errorWhileStoppingJcaAdapter,e.getMessage());
            }
            engine = null;
        }
    }
876761
public void stop() {
        if (future != null) {
            future.cancel(true);
        }
        if (executor != null) {
            executor.shutdownNow();
        }
    }
219802
private void shutdown(){
    parent.workerThreads.get(plan).remove(this);
    if (zk != null) {
      try {
        logger.debug("closing " + zk.getSessionId());
        zk.close();
        zk = null;
      } catch (InterruptedException e1) {
        logger.debug(e1);
      }
      logger.debug("shutdown complete");
    }
  }
563774
public void reduceThis(){
		if (elements==null || elements.isEmpty())
			throw new AssertionError("Can't reduce this environment");
		elements.remove(elements.size()-1);
	}
354901
void shutdown() throws IOException {
        synchronized (this) {
            for (BdbEnvironmentInfo envInfo : this.envInfos) {
                try {
                    envInfo.getClassCatalog().close();
                } catch (DatabaseException ignore) {
                    LOGGER.log(Level.SEVERE, "Failure closing class catalog", ignore);
                }
                envInfo.closeAndRemoveAllDatabaseHandles();
                
                try (Environment env = envInfo.getEnvironment()) {
                    if (this.deleteOnExit) {
                        FileUtil.deleteDirectory(env.getHome());
                    }
                }
            }
            this.envInfos.clear();
        }
    }
1284632
def stopping(self):
        
        ident = self.ident()
        print('{} for "{}" shutting down. Consumed {} tasks.'.format(
            ident,
            self.to_consume,
            self.tasks_complete
        ))
180256
def stop(self):
        """"""
        self.reconnect = False
        self.logger.debug("Shutting down.")
        if self.transport:
            self.transport.close()
1123000
def shutdown(self):
        
        self.stop = True
        if self.stats:
            self.stats.shutDownStats()
        self.join()