Starts a new privilege-escalated environment, execute a closure, and shut it down.
5604
public static <V,T extends Throwable> V execute(TaskListener listener, String rootUsername, String rootPassword, final Callable<V, T> closure) throws T, IOException, InterruptedException {
        VirtualChannel ch = start(listener, rootUsername, rootPassword);
        try {
            return ch.call(closure);
        } finally {
            ch.close();
            ch.join(3000); // give some time for orderly shutdown, but don't block forever.
        }
    }
177289
public void shutdown() {
		Iterator<ExclusionFilterFactory> itr = factories.iterator();
		while (itr.hasNext()) {
			ExclusionFilterFactory i = itr.next();
			i.shutdown();
		}
	}
288492
def shutdown(self, collector, success):
        """"""
        self.event.delegate(success)
        if collector is not None:
            collector.queue.put(None)
            collector.join()
        if not success:
            sys.exit(1)
228845
def shutdown(self):
        ''' 
        '''
        logging.info('Shutdown procedures being run!')
        for func in self.shutdown_cleanup.values():
            func()
        session_time = round((time.time() - self.start_time)/60, 0)
        logging.info('session time: {0} minutes'.format(session_time))
        logging.info('End..')
1032064
@Override
	public void onStart(TestContext<Object> context) {
		oldErr = System.err;
		oldOut = System.out;
		try {
			System.setErr(remplacementErr);
			System.setOut(remplacementOut);
		} catch (SecurityException e) {
			// ignored
		}
	}
344608
def stop(self):
        
        if self._stack:
            try:
                self._stack.teardown()
            except Exception:
                self.fatal(sys.exc_info())

        super().stop()
142063
public static void shutdownActive(ExitCode exitCode, 
                                    String msg)
  {
    shutdownActive(ShutdownModeAmp.GRACEFUL, exitCode, msg, null);
  }
358555
public static void addShutdownHook(Object self, Closure closure) {
        Runtime.getRuntime().addShutdownHook(new Thread(closure));
    }
364400
def shutdown(self):
        
        for connection in self.connections.copy():
            connection.shutdown()

        self.connections = None

        self.context.term()
        self.context = None
        if self.trigger:
            try:
                self.reactor.removeSystemEventTrigger(self.trigger)
            except Exception:
                pass
213536
async def on_shutdown(app):
    
    # Remove webhook.
    await bot.delete_webhook()

    # Close Redis connection.
    await dp.storage.close()
    await dp.storage.wait_closed()
1239878
public void shutdownNow() {
        allChannels.close();
        workerGroup.shutdownGracefully();
        bossGroup.shutdownGracefully();
        clientGroup.shutdownGracefully();
        if (pipeliningGroup != null) {
            pipeliningGroup.shutdownGracefully();
        }
    }
76408
def shutdown(self):
        """"""
        sys.stdout = self.old_stdout
        sys.stdin = self.old_stdin
        self.skt.close()
        self.set_continue()
1254294
public static void shutdownAndAwaitTermination() {
		shutdown();
		if (pool != null) {
			try {
				// wait a while for existing tasks to terminate
				if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) {
					pool.shutdownNow(); // cancel currently executing tasks
					// wait a while for tasks to respond to being canceled
					if (!pool.awaitTermination(60L, TimeUnit.SECONDS)) {
						logger.warn("BioJava ConcurrencyTools thread pool did not terminate");
					}
				}
			} catch (InterruptedException ie) {
				pool.shutdownNow(); // (re-)cancel if current thread also interrupted
				Thread.currentThread().interrupt(); // preserve interrupt status
			}
		}
	}
498727
@Override
    public void run () {
        try {
            this.closed = true;
            close();
        }
        catch ( CIFSException e ) {
            log.warn("Failed to close context on shutdown", e);
        }
    }
202799
public void shutdown() {
    gossipServiceRunning.set(false);
    gossipThreadExecutor.shutdown();
    if (passiveGossipThread != null) {
      passiveGossipThread.shutdown();
    }
    if (activeGossipThread != null) {
      activeGossipThread.shutdown();
    }
    try {
      boolean result = gossipThreadExecutor.awaitTermination(1000, TimeUnit.MILLISECONDS);
      if (!result) {
        LOGGER.error("executor shutdown timed out");
      }
    } catch (InterruptedException e) {
      LOGGER.error(e);
    }
  }
1331363
protected void deactivate(ComponentContext context) {
        appListener.unregister(this);

        // shut down instances that were created
        if (!clients.isEmpty())
            AccessController.doPrivileged(new PrivilegedAction<Void>() {
                @Override
                public Void run() {
                    Method shutdown = null;
                    for (Object client : clients.values())
                        try {
                            if (shutdown == null)
                                shutdown = client.getClass().getMethod("shutdown");
                            shutdown.invoke(client);
                        } catch (Throwable x) {
                            // FFDC will be logged, otherwise ignore
                        }
                    return null;
                }
            });

        containerAuthDataRef.deactivate(context);
        sslConfig.deactivate(context);
    }
338655
static void endInitialization(WeldContainer container, boolean isShutdownHookEnabled) {
        container.complete();
        // If needed, register one shutdown hook for all containers
        if (shutdownHook == null && isShutdownHookEnabled) {
            synchronized (LOCK) {
                if (shutdownHook == null) {
                    shutdownHook = new ShutdownHook();
                    SecurityActions.addShutdownHook(shutdownHook);
                }
            }
        }
        container.fireContainerInitializedEvent();
    }