This method will terminate background thread AND will destroy attached workspace (if any)

PLEASE NOTE: After shutdown() call, this instance can't be used anymore
766109
public void shutdown() {
        buffer.clear();


        if (thread != null)
            thread.interrupt();
        try {
            // Shutdown() should be a synchronous operation since the iterator is reset after shutdown() is
            // called in AsyncLabelAwareIterator.reset().
            if (thread != null)
                thread.join();
        } catch (InterruptedException e) {
            Thread.currentThread().interrupt();
            throw new RuntimeException(e);
        }
        thread.shutdown();
        buffer.clear();
    }
160733
public void close() {
        if (running) {
            taskPool.clear();
            running = false;
            for (PoolThread thread : threadPool) {
                thread.interrupt();
            }
        }
    }
959010
def shutdown(self, skip_hooks=False):
        

        if not self._exited:
            self._exited = True

            if not skip_hooks:
                self._run_events(shutdown=True)

            _shutdown_pipe(self._pipe)
            self._task.stop()
            raise SystemExit
1205332
public static synchronized void shutdown()
    {
        if( c_factories == null ) return; // Nothing to do

        for( Iterator<Entry<String, StopWatchFactory>> i = c_factories.entrySet().iterator(); i.hasNext() ; )
        {
            Map.Entry<String,StopWatchFactory> e = i.next();

            StopWatchFactory swf = e.getValue();
            swf.internalShutdown();

            i.remove();
        }

        c_factories = null;
    }
887267
public static void stop(){
    //--Close logger
    isClosed = true; // <- not a thread-safe boolean
    Thread.yield(); //poor man's synchronization attempt (let everything else log that wants to)
    Thread.yield();
    //--Close Tracks
    while(depth > 0){
      depth -= 1;
      //(send signal to handlers)
      handlers.process(null, MessageType.END_TRACK, depth, System.currentTimeMillis());
    }
    //--Shutdown
    handlers.process(null, MessageType.SHUTDOWN, 0, System.currentTimeMillis());
  }
1013306
@Override
  public void stop() {
    threadPoolExecutor.shutdown();
    BlockingQueue<Runnable> taskQueue = threadPoolExecutor.getQueue();
    int bufferSizeBeforeShutdown = threadPoolExecutor.getQueue().size();
    boolean gracefulShutdown = true;
    try {
      gracefulShutdown = threadPoolExecutor.awaitTermination(shutdownTimeout, TimeUnit.SECONDS);
    }
    catch(InterruptedException e) {
      // we are anyways cleaning up
    }
    finally {
      int bufferSizeAfterShutdown = taskQueue.size();
      if(!gracefulShutdown || bufferSizeAfterShutdown > 0) {
        String errorMsg = "Kinesis Log4J Appender (" + name + ") waited for " + shutdownTimeout
                          + " seconds before terminating but could send only "
                          + (bufferSizeAfterShutdown - bufferSizeBeforeShutdown) + " logevents, it failed to send "
                          + bufferSizeAfterShutdown + " pending log events from it's processing queue";
        addError(errorMsg);
      }
    }
    client.shutdown();
  }
897202
@Override
    public void stop(){
        if (isStarted.compareAndSet(true,false)) {
            this.syncService.shutdown();
            getCache().clear();
            getMetadataKeyCache().clear();
        }
    }
562401
def terminate(self):
        
        self.handle, handle = None, self.handle
        if threading.current_thread() is self._event_thread:
            # Handle special case to allow event handle to be detached.
            # This is necessary since otherwise the event thread would deadlock itself.
            grim_reaper = threading.Thread(target=lambda: _mpv_terminate_destroy(handle))
            grim_reaper.start()
        else:
            _mpv_terminate_destroy(handle)
            if self._event_thread:
                self._event_thread.join()
233026
public synchronized void shutdown() {
    
    LOG.info("Shutting down all AsyncDiskService threads...");
    
    for (Map.Entry<String, ThreadPoolExecutor> e
        : executors.entrySet()) {
      e.getValue().shutdown();
    }
  }
213568
public void destroyOnShutdownHook()
    {
        Runtime.getRuntime().addShutdownHook(new Thread()
        {
            @Override
            public void run()
            {
                try {
                    LifeCycleManager.this.destroy();
                }
                catch (Exception e) {
                    System.err.print("Exception in life cycle shutdown handler ");
                    e.printStackTrace(System.err);
                }
            }
        });
    }
321629
public void shutdown()
  {
    log.info("Shutting down...");
    isShutdownRequested = true;

    try
    {
      mainThread.join();
    }
    catch (InterruptedException e)
    {
      log.error(
        "Interrupted which waiting on main daemon thread to complete.");
    }
  }
1004485
Future<Boolean> shutdown() {
        // Create a simple executor that will do the backgrounding for us ...
        final ExecutorService executor = Executors.newSingleThreadExecutor(new NamedThreadFactory("modeshape-repository-stop"));
        try {
            // Submit a runnable to terminate all sessions ...
            return executor.submit(() -> doShutdown(false));
        } finally {
            // Now shutdown the executor and return the future ...
            executor.shutdown();
        }
    }
1056041
void shutdownNow() {
    shutdown = true;
    for (int i = 0; i < clients.length; i++) {
      clients[i].close();
    }
    fixedThreadPool.shutdownNow();
    system.terminate();
  }
1002717
def shutdown(self):
        

        if not self._exited:
            self._exited = True
            _shutdown_pipe(self._pipe)
            self._task.stop()
            raise SystemExit
543362
def thread_stopped(self):
		
		if self.__current_task is not None:
			task = self.__task_chain[self.__current_task]
			task.stop()
			self.__current_task = None
947079
void stop() {
    stopAsync();
    try {
      // stopperThread is not null for sure
      // join() does nothing if thread already finished
      stopperThread.join();
      lifecycle.tryToMoveTo(Lifecycle.State.STOPPED);
    } catch (InterruptedException e) {
      Thread.currentThread().interrupt();
    }
    exit.exit(0);
  }
1282763
@PreDestroy
    public void stop() {
        logger.info("Stop...");
        lifecycleLock.writeLock().lock();
        try {
            if (!State.STARTED.equals(state)) {
                logger.debug("Ignore stop() command for " + state + " instance");
                return;
            }
            logger.info("Unregister shutdown hook");
            this.shutdownHook.unregisterFromRuntime();

            logger.info("Shutdown collectScheduledExecutor and exportScheduledExecutor...");
            // no need to `shutdown()` and `awaitTermination()` before `shutdownNow()` as we invoke `collectMetrics()` and `exportCollectedMetrics()`
            // `shutdownNow()` can be invoked before `collectMetrics()` and `exportCollectedMetrics()`
            collectScheduledExecutor.shutdownNow();
            exportScheduledExecutor.shutdownNow();

            try {
                logger.info("Collect metrics...");
                collectMetrics();
                logger.info("Export metrics...");
                exportCollectedMetrics();
            } catch (RuntimeException e) {
                logger.warn("Ignore failure collecting and exporting metrics during stop", e);
            }

            // queries and outputwriters can be stopped even if exports threads are running thanks to the lifecycleLock
            logger.info("Stop queries...");
            for (Query query : queries) {
                try {
                    query.stop();
                } catch (Exception e) {
                    logger.warn("Ignore exception stopping query {}", query, e);
                }
            }

            logger.info("Stop output writers...");
            for (OutputWriter outputWriter : outputWriters) {
                try {
                    outputWriter.stop();
                } catch (Exception e) {
                    logger.warn("Ignore exception stopping outputWriters", e);
                }
            }

            state = State.STOPPED;
            logger.info("Set state to {}", state);
        } catch (RuntimeException e) {
            state = State.ERROR;
            if (logger.isDebugEnabled()) {
                // to troubleshoot JMX call errors or equivalent, it may be useful to log and rethrow
                logger.warn("Exception stopping EmbeddedJmxTrans", e);
            }
            throw e;
        } finally {
            lifecycleLock.writeLock().unlock();
        }
        logger.info("Stopped");
    }