This method stops the brokers interaction with the kafka stream
425926
def stop(self):
        
        self.loop.run_until_complete(self._consumer.stop())
        self.loop.run_until_complete(self._producer.stop())

        # attempt
        try:
            # to cancel the service
            self._consumer_task.cancel()
        # if there was no service
        except AttributeError:
            # keep going
            pass
985493
def stopProducing(self):
        
        _legacy_twisted_log.msg("Disconnecting from the AMQP broker")
        yield self.pauseProducing()
        yield self.close()
        self._consumers = {}
        self._channel = None
313428
def stop(self, stopSparkContext=True, stopGraceFully=False):
        
        while self._on_stop_cb:
            cb = self._on_stop_cb.pop()
            log.debug('calling on_stop_cb {}'.format(cb))
            cb()

        IOLoop.current().stop()

        StreamingContext._activeContext = None
324497
@Override
    protected void stopInner() {
        /*
         * TODO REST-Server Need to handle inflight operations. What happens to
         * the existing async operations when a channel.close() is issued in
         * Netty?
         */
        if(this.nettyServerChannel != null) {
            this.nettyServerChannel.close();
        }

        if(allChannels != null) {
            allChannels.close().awaitUninterruptibly();
        }
        this.bootstrap.releaseExternalResources();
    }
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();
  }
146780
def stop(self):
        
        log.info("%r: Stopping %r clients", self.container_id, len(self.clients))
        self.stopped = True
        self._close_clients()
437003
def close(self):
        
        self.logger.info("Closing Rest Service")
        self.closed = True

        # close threads
        self._close_thread(self._redis_thread, "Redis setup")
        self._close_thread(self._heartbeat_thread, "Heartbeat")
        self._close_thread(self._kafka_thread, "Kafka setup")
        self._close_thread(self._consumer_thread, "Consumer")

        # close kafka
        if self.consumer is not None:
            self.logger.debug("Closing kafka consumer")
            self.consumer.close()
        if self.producer is not None:
            self.logger.debug("Closing kafka producer")
            self.producer.close(timeout=10)
1301709
def stop(self):
        
        self.publish.setsockopt(zmq.LINGER, 1)
        self.publish.close()
        return self
578503
def stop(self):
        
        err = _pa.Pa_StopStream(self._stream)
        if err == _pa.paStreamIsStopped:
            return
        self._handle_error(err)
1285698
public static br_broker stop(nitro_service client, br_broker resource) throws Exception
	{
		return ((br_broker[]) resource.perform_operation(client, "stop"))[0];
	}
1169001
public synchronized void stop() {
        if (isRunning()) {
            VirtualCdj.getInstance().removeUpdateListener(updateListener);
            running.set(false);
            pendingUpdates.clear();
            queueHandler.interrupt();
            queueHandler = null;

            // Report the loss of our hot cached metadata on the proper thread, outside our lock
            final Set<DeckReference> dyingCache = new HashSet<DeckReference>(hotCache.keySet());
            SwingUtilities.invokeLater(new Runnable() {
                @Override
                public void run() {
                    for (DeckReference deck : dyingCache) {
                        if (deck.hotCue == 0) {
                            deliverTrackMetadataUpdate(deck.player, null);
                        }
                    }

                }
            });
            hotCache.clear();
            deliverLifecycleAnnouncement(logger, false);
        }
    }
439441
def stop(self):
        
        if not self._consumers_ready.ready():
            _log.debug('stopping while consumer is starting %s', self)

            stop_exc = QueueConsumerStopped()

            # stopping before we have started successfully by brutally
            # killing the consumer thread as we don't have a way to hook
            # into the pre-consumption startup process
            self._gt.kill(stop_exc)

        self.wait_for_providers()

        try:
            _log.debug('waiting for consumer death %s', self)
            self._gt.wait()
        except QueueConsumerStopped:
            pass

        super(QueueConsumer, self).stop()
        _log.debug('stopped %s', self)
890340
void close(ClientSocket stream)
  {
    if (log.isLoggable(Level.FINER))
      log.finer("close " + stream);

    _activeCount.decrementAndGet();
  }
125017
def stop_broker(host, connection, stop_command, verbose):
    """"""
    _, stdout, stderr = connection.sudo_command(stop_command)
    if verbose:
        report_stdout(host, stdout)
        report_stderr(host, stderr)
1318512
public void shutdown() {
        for (Topic topic : _topics.values()) {
            if (topic.getConsumerConnector() != null) {
                topic.getConsumerConnector().shutdown();
            }
            topic.getStreamExecutorService().shutdownNow();
            try {
                topic.getStreamExecutorService().awaitTermination(60, TimeUnit.SECONDS);
            } catch (InterruptedException e) {
                _logger.warn("Stream executor service was interrupted while awaiting termination. This should never happen.");
            }
        }
        _logger.debug("Pushing unflushed messages back to Kafka.");

        Producer producer = new Producer(_configuration);

        for (Map.Entry<String, Topic> entry : _topics.entrySet()) {
            String topicName = entry.getKey();
            Topic topic = entry.getValue();
            List<String> unflushedMessages = new ArrayList<String>();

            if (!topic.getMessages().isEmpty()) {
                topic.getMessages().drainTo(unflushedMessages);
                producer.enqueue(topicName, unflushedMessages);
            }
            _logger.debug("{} messages for topic {} enqueued on Kafka queue", unflushedMessages.size(), topicName);
        }
        producer.shutdown();
    }
686313
def close(self):
        """"""
        _LOGGER.debug("Closing stream")
        if not hasattr(self, "footer"):
            raise SerializationError("Footer not read")
        super(StreamDecryptor, self).close()
1056406
def _broker_shutdown(self):
        
        for _, (side, _) in self.poller.readers + self.poller.writers:
            self._call(side.stream, side.stream.on_shutdown)

        deadline = time.time() + self.shutdown_timeout
        while self.keep_alive() and time.time() < deadline:
            self._loop_once(max(0, deadline - time.time()))

        if self.keep_alive():
            LOG.error('%r: some streams did not close gracefully. '
                      'The most likely cause for this is one or '
                      'more child processes still connected to '
                      'our stdout/stderr pipes.', self)