@Override public void close() { connector.shutdown(); } };
public void close() { consumer.shutdown(); }
@Override public void close() throws IOException { consumer.shutdown(); } }
void shutdown() { _consumer.shutdown(); }
void shutdown() { _consumer.shutdown(); }
@Override public void doStop() { stopped = true; serverEventBus.unregister(this); if (stopLatch != null) { try { // unpause the processors if they are blocked. this will cause them to see that we are stopping, even if they were paused. if (pausedLatch != null && pausedLatch.getCount() > 0) { pausedLatch.countDown(); } final boolean allStoppedOrderly = stopLatch.await(5, TimeUnit.SECONDS); stopLatch = null; if (!allStoppedOrderly) { // timed out LOG.info( "Stopping Kafka input timed out (waited 5 seconds for consumer threads to stop). Forcefully closing connection now. " + "This is usually harmless when stopping the input."); } } catch (InterruptedException e) { LOG.debug("Interrupted while waiting to stop input."); } } if (cc != null) { cc.shutdown(); cc = null; } }
@Override public void shutDown() { if (this.consumer != null) { this.consumer.shutdown(); } if (this.executor != null) { ExecutorsUtils.shutdownExecutorService(this.executor, Optional.of(log), 5000, TimeUnit.MILLISECONDS); } try { this.shutdownMetrics(); } catch (IOException ioe) { log.warn("Failed to shutdown metrics for " + this.getClass().getSimpleName()); } }
public static void closeAllConsumers() { try { // Shutdown all consumers synchronized (KafkaConsumerManager.class) { LOGGER.info("Trying to shutdown all the kafka consumers"); Iterator<ConsumerAndIterator> consumerIterator = CONSUMER_AND_ITERATOR_FOR_CONFIG_KEY.values().iterator(); while (consumerIterator.hasNext()) { ConsumerAndIterator consumerAndIterator = consumerIterator.next(); LOGGER.info("Trying to shutdown consumer/iterator {}", consumerAndIterator.getId()); try { consumerAndIterator.getConsumer().shutdown(); } catch (Exception e) { LOGGER .warn("Caught exception while shutting down Kafka consumer with id {}", consumerAndIterator.getId(), e); } consumerIterator.remove(); } CONSUMER_AND_ITERATOR_FOR_CONFIG_KEY.clear(); CONSUMER_RELEASE_TIME.clear(); } } catch (Exception e) { LOGGER.warn("Caught exception during shutting down all kafka consumers", e); } } }
consumerAndIterator.getConsumer().shutdown(); } catch (Exception e) { LOGGER.warn("Caught exception while shutting down Kafka consumer with id {}",
@OnStopped public void shutdownConsumer() { this.consumerStreamsReady.set(false); if (consumer != null) { try { consumer.commitOffsets(); } finally { consumer.shutdown(); } } if (this.executor != null) { this.executor.shutdown(); try { if (!this.executor.awaitTermination(30000, TimeUnit.MILLISECONDS)) { this.executor.shutdownNow(); getLogger().warn("Executor did not stop in 30 sec. Terminated."); } this.executor = null; } catch (InterruptedException e) { Thread.currentThread().interrupt(); } } }
/** * Shutdown the KafkaIngesterConsumer. */ public void shutdown() { logger.info("Consumer thread {} shutting down", getName()); try { consumer.shutdown(); if (deduplicator != null) { deduplicator.close(); } // Wait for consumer stream to drain and run loop to end. Thread.sleep(200); if (shutdownComplete.getCount() == 1) { // This is to avoid any deadlock or hangs in consumer shutdown. interrupt(); } shutdownComplete.await(); } catch (InterruptedException ie) { logger.debug("Shutdown for {} was interrupted", getName()); } catch (Exception e) { logger.warn("Exception when shutting down KafkaIngesterConsumer thread {} {}", getName(), e); } logger.info("Consumer thread {} successfully shut down", getName()); }
@Override public void close() { connector.shutdown(); } };
ConsumerConnector consumerConnector = kafkaConsumersFuture.get(groupId); if(consumerConnector!=null) { consumerConnector.shutdown(); kafkaConsumersFuture.remove(groupId); }
@Override public void close() throws IOException { connector.shutdown(); } };
/** * {@inheritDoc} */ @Override public void destroy() throws StreamingException { if (consumerConnector != null) { consumerConnector.shutdown(); } }
/** * Stops this {@link SynchronousConsumer} immediately. * * @throws Exception */ @Override public void stop() throws Exception { LOG.trace("Shutting down Connector"); connector.shutdown(); LOG.trace("Connector shut down"); }
@Override public void close() { if (standardConsumer != null && standardConsumer.values() != null) { for (ConsumerConnector consumerConnector : standardConsumer.values()) { consumerConnector.shutdown(); } } if (consumerThreadExecutor != null) { consumerThreadExecutor.shutdown(); } }
public void stop() { if(executor != null) executor.shutdownNow(); try { Thread.sleep(SLEEPING_INTERVAL); } catch (InterruptedException e) { logger.error(e.getMessage(), e); } if(consumer != null) consumer.shutdown(); }
@Override public void shutdown() { stop(); connector.shutdown(); }
public void close() { holdingBuffer.clear(); consumer.shutdown(); }