shutdown datastreamer and responseprocessor threads.
979833
private void closeThreads() throws IOException {
    try {
      if (streamer != null) {
        streamer.close();
        streamer.join();
      }

      // shutdown response after streamer has exited.
      if (response != null) {
        response.close();
        response.join();
        response = null;
      }
    } catch (InterruptedException e) {
      throw new InterruptedIOException("Failed to shutdown response thread");
    }
  }
590244
public void shutdown() {
    this.flowTriggerExecutorService.shutdown();
    this.cancelExecutorService.shutdown();
    this.timeoutService.shutdown();

    this.flowTriggerExecutorService.shutdownNow();
    this.cancelExecutorService.shutdownNow();
    this.timeoutService.shutdownNow();

    this.triggerProcessor.shutdown();
    this.triggerPluginManager.shutdown();
    this.cleaner.shutdown();
  }
470934
public void shutdown() {
    LOGGER.info("Responder shutting down: [" + _runtimeId + "]");
    for (Transport t : _transports) {
      try {
        t.shutdown();
      } catch (TransportException e) {
        LOGGER.warn( "Error shutting down transport: [" + t.transportName() + "]", e);
      }
    }
  }
1099481
def shutdown(self):
        """"""
        for wsock in self.wsocks:
            wsock.shutdown()
        for api in self.apis:
            api.shutdown()
571992
public static synchronized void shutDown() {
    if (sInstance != null) {
      sInstance.getBitmapMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
      sInstance.getEncodedMemoryCache().removeAll(AndroidPredicates.<CacheKey>True());
      sInstance = null;
    }
  }
1056041
void shutdownNow() {
    shutdown = true;
    for (int i = 0; i < clients.length; i++) {
      clients[i].close();
    }
    fixedThreadPool.shutdownNow();
    system.terminate();
  }
885753
public void stop() {
    if (inputThread != null) {
      if (inputStreamPumper != null) {
        inputStreamPumper.stopProcessing();
      }
      // #33 Interrupt reading from a PipedInputStream to unblock the pumping thread
      inputThread.interrupt();
      log.trace("Joining input thread {}...", inputThread);
      try {
        inputThread.join();
        inputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (outputThread != null) {
      log.trace("Joining output thread {}...", outputThread);
      try {
        outputThread.join();
        outputThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    if (errorThread != null) {
      log.trace("Joining error thread {}...", errorThread);
      try {
        errorThread.join();
        errorThread = null;
      }
      catch (InterruptedException e) {
        // ignore
      }
    }

    flush();
  }
103552
public void shutdown() {
        asyncExecutorService.shutdown(); // Disable new health checks from being submitted
        try {
            // Give some time to the current healtch checks to finish gracefully
            if (!asyncExecutorService.awaitTermination(1, TimeUnit.SECONDS)) {
                asyncExecutorService.shutdownNow();
            }
        } catch (InterruptedException ie) {
            asyncExecutorService.shutdownNow();
            Thread.currentThread().interrupt();
        }
    }
539465
@Override
    public void shutdown()
    {
        m_stopCollector = true;
        if( m_collectorThread != null ) m_collectorThread.interrupt();

        try
        {
            //
            //  Remove MBean
            //
            if( m_mbeanServer != null && m_mbeanServer.isRegistered(getJMXName()) )
                m_mbeanServer.unregisterMBean(getJMXName());
        }
        catch (Exception e)
        {
            log.error("Failed to unregister MBean", e);
        }
    }
667509
def stop_execution(self):
        
        super(LoadDataset, self).stop_execution()
        self._loader = None
        self._iterator = None
1121151
public void stop() {
        if (shutdownExecutorOnStop) {
            executor.shutdown(); // Disable new tasks from being submitted
            try {
                // Wait a while for existing tasks to terminate
                if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
                    executor.shutdownNow(); // Cancel currently executing tasks
                    // Wait a while for tasks to respond to being cancelled
                    if (!executor.awaitTermination(1, TimeUnit.SECONDS)) {
                        System.err.println(getClass().getSimpleName() + ": ScheduledExecutorService did not terminate");
                    }
                }
            } catch (InterruptedException ie) {
                // (Re-)Cancel if current thread also interrupted
                executor.shutdownNow();
                // Preserve interrupt status
                Thread.currentThread().interrupt();
            }
        } else {
            // The external manager(like JEE container) responsible for lifecycle of executor
            synchronized (this) {
                if (this.scheduledFuture == null) {
                    // was never started
                    return;
                }
                if (this.scheduledFuture.isCancelled()) {
                    // already cancelled
                    return;
                }
                // just cancel the scheduledFuture and exit
                this.scheduledFuture.cancel(false);
            }
        }
    }
489986
def off_datastream(self, datastream):
        
        url = '/datastream/' + str(datastream) + '/off'
        response = self.http.post(url,"")
        return response
555383
public function shutdown()
    {
        $this->dispatcher->shutdown();

        // make sure that no other output messes up the data
        ob_end_clean();

        $this->response->sendHeaders();
        echo $this->response->getContent();

        // exit since we don't want anymore output
        exit;
    }
1010938
public void close() {
        SHUTDOWN_EXECUTOR.execute(new Runnable() {
            
            @Override
            public void run() {
                try {
                    executorService.shutdown();
                    while (!executorService.awaitTermination(5, TimeUnit.SECONDS)) {
                        executorService.shutdownNow();
                    }
                } catch (final InterruptedException ex) {
                    Thread.currentThread().interrupt();
                }
            }
        });
    }
727582
def shutdown(self):
        
        # Remove reference to inputQueue (raises exception if inputQueue is used after method call)
        inputQueue = self.inputQueue
        self.inputQueue = None
        for i in range(self.numWorkers):
            inputQueue.put(None)
        for thread in self.workerThreads:
            thread.join()
        BatchSystemSupport.workerCleanup(self.workerCleanupInfo)
541033
def Stop(self):
    """"""
    self._Close()

    if self._rpc_thread.isAlive():
      self._rpc_thread.join()
    self._rpc_thread = None
1327885
public final synchronized void shutdown() {  // synchronize on 'this' to avoid races with registerStreams
        stopped = true;
        // If the cleanup task is running tell it to stop looping, and then remove it from the scheduled executor
        if (cleanupTaskFuture != null) {
            cleanupTaskFuture.cancel(false);
        }

        // Close remaining streams
        for (Map.Entry<InputStreamKey, TimedStreamEntry> entry : streamMap.entrySet()) {
            InputStreamKey key = entry.getKey();
            TimedStreamEntry timedStreamEntry = entry.getValue();
            //noinspection SynchronizationOnLocalVariableOrMethodParameter
            synchronized (timedStreamEntry) { // ensure there's no race with a request that got a ref before we removed it
                closeStreamEntry(timedStreamEntry, key.requestId, key.index);
            }
        }
    }