@Override public void destroy() { disruptor.shutdown(); }
@Override public void destroy() { disruptor.shutdown(); }
@Override public void destroy() { disruptor.shutdown(); }
@Override public void handleOnStartException(Throwable ex) { logger.error("Failed to start the DisruptorCommandBus.", ex); disruptor.shutdown(); }
@Override public void shutdown() { disruptor.shutdown(); if (reserveExecutor != null) { reserveExecutor.shutdownNow(); } } }
@Override public void shutdown() { disruptor.shutdown(); if (reserveExecutor != null) { reserveExecutor.shutdownNow(); } } }
/** * <p>Waits until all events currently in the disruptor have been processed by all event processors * and then halts the processors. It is critical that publishing to the ring buffer has stopped * before calling this method, otherwise it may never return.</p> * * <p>This method will not shutdown the executor, nor will it await the final termination of the * processor threads.</p> */ public void shutdown() { try { shutdown(-1, TimeUnit.MILLISECONDS); } catch (final TimeoutException e) { exceptionHandler.handleOnShutdownException(e); } }
@Override protected void doShutdown() throws IOException { // Shutdown the disruptor. Will stop after all entries have been processed. Make sure we // have stopped incoming appends before calling this else it will not shutdown. We are // conservative below waiting a long time and if not elapsed, then halting. if (this.disruptor != null) { long timeoutms = conf.getLong("hbase.wal.disruptor.shutdown.timeout.ms", 60000); try { this.disruptor.shutdown(timeoutms, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { LOG.warn("Timed out bringing down disruptor after " + timeoutms + "ms; forcing halt " + "(It is a problem if this is NOT an ABORT! -- DATALOSS!!!!)"); this.disruptor.halt(); this.disruptor.shutdown(); } } if (LOG.isDebugEnabled()) { LOG.debug("Closing WAL writer in " + FSUtils.getPath(walDir)); } if (this.writer != null) { this.writer.close(); this.writer = null; } }
@After public void tearDown() { disruptor.shutdown(); }
/** * Shuts down the command bus. It no longer accepts new commands, and finishes processing commands that have * already been published. This method <b>will not</b> shut down any executor that has been provided as part of the * Builder process. */ public void stop() { if (!started) { return; } started = false; long lastChangeDetected = System.currentTimeMillis(); long lastKnownCursor = disruptor.getRingBuffer().getCursor(); while (System.currentTimeMillis() - lastChangeDetected < coolingDownPeriod && !Thread.interrupted()) { if (disruptor.getRingBuffer().getCursor() != lastKnownCursor) { lastChangeDetected = System.currentTimeMillis(); lastKnownCursor = disruptor.getRingBuffer().getCursor(); } } disruptorShutDown = true; disruptor.shutdown(); if (executorService != null) { executorService.shutdown(); } }
@Test(expected = TimeoutException.class, timeout = 2000) public void shouldThrowTimeoutExceptionIfShutdownDoesNotCompleteNormally() throws Exception { //Given final DelayedEventHandler delayedEventHandler = createDelayedEventHandler(); disruptor.handleEventsWith(delayedEventHandler); publishEvent(); //When disruptor.shutdown(1, SECONDS); //Then }
disruptor.shutdown();
disruptor.shutdown();
@Override public void close() { closed = true; disruptor.shutdown(); }
@Override public void destroy() { disruptor.shutdown(); }
public static void main(String[] args) throws TimeoutException, InterruptedException { Disruptor<LongEvent> disruptor = new Disruptor<LongEvent>( LongEvent.FACTORY, 16, DaemonThreadFactory.INSTANCE ); CountDownLatch shutdownLatch = new CountDownLatch(2); disruptor.handleEventsWith(new Handler(shutdownLatch)).then(new Handler(shutdownLatch)); disruptor.start(); long next = disruptor.getRingBuffer().next(); disruptor.getRingBuffer().get(next).set(next); disruptor.getRingBuffer().publish(next); disruptor.shutdown(10, TimeUnit.SECONDS); shutdownLatch.await(); System.out.println(value); } }
@Override public void close() throws IOException { isClosed = true; LOG.info("Shutting down QueryLoggerDisruptor.."); try { //we can wait for 2 seconds, so that backlog can be committed disruptor.shutdown(2, TimeUnit.SECONDS); } catch (TimeoutException e) { throw new IOException(e); } }
@Override public void shutdown() { logger.info(String.format("Stopping %s auditMsg reporter...", getType())); disruptor.shutdown(); reportExecutor.shutdown(); }
/** * <p>Waits until all events currently in the disruptor have been processed by all event processors * and then halts the processors. It is critical that publishing to the ring buffer has stopped * before calling this method, otherwise it may never return.</p> * * <p>This method will not shutdown the executor, nor will it await the final termination of the * processor threads.</p> */ public void shutdown() { try { shutdown(-1, TimeUnit.MILLISECONDS); } catch (final TimeoutException e) { exceptionHandler.handleOnShutdownException(e); } }
/** * Stops the disruptor. */ private void stopDisruptor() { disruptor.shutdown(); }