@Override public void halt() { running.set(false); sequenceBarrier.alert(); }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
/** * Specify the {@link ExceptionHandler} to use with the event handler. * * @param exceptionHandler the exception handler to use. */ @SuppressWarnings("unchecked") public void with(ExceptionHandler<? super T> exceptionHandler) { final EventProcessor eventProcessor = consumerRepository.getEventProcessorFor(eventHandler); if (eventProcessor instanceof BatchEventProcessor) { ((BatchEventProcessor<T>) eventProcessor).setExceptionHandler(exceptionHandler); consumerRepository.getBarrierFor(eventHandler).alert(); } else { throw new RuntimeException( "EventProcessor: " + eventProcessor + " is not a BatchEventProcessor " + "and does not support exception handlers"); } } }
sequenceBarrier.alert(); t.join();
@Test public void shouldSetAndClearAlertStatus() { SequenceBarrier sequenceBarrier = ringBuffer.newBarrier(); assertFalse(sequenceBarrier.isAlerted()); sequenceBarrier.alert(); assertTrue(sequenceBarrier.isAlerted()); sequenceBarrier.clearAlert(); assertFalse(sequenceBarrier.isAlerted()); }
@Override public void halt() { running.set(false); sequenceBarrier.alert(); }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
public EventResultDisruptor waitFor() { SequenceBarrier barrier = ringBuffer.newBarrier(); try { long a = barrier.waitFor(waitAtSequence); if (ringBuffer != null) return ringBuffer.get(a); } catch (Exception e) { e.printStackTrace(); } finally { barrier.alert(); } return null; }
/** * not really block, the waiting time is longer than not block. */ public EventResultDisruptor waitForBlocking() { SequenceBarrier barrier = ringBuffer.newBarrier(); try { long a = barrier.waitFor(waitAtSequence); if (ringBuffer != null) return ringBuffer.get(a); } catch (Exception e) { e.printStackTrace(); } finally { barrier.alert(); } return null; }
/** * Specify the {@link ExceptionHandler} to use with the event handler. * * @param exceptionHandler the exception handler to use. */ @SuppressWarnings("unchecked") public void with(ExceptionHandler<? super T> exceptionHandler) { final EventProcessor eventProcessor = consumerRepository.getEventProcessorFor(eventHandler); if (eventProcessor instanceof BatchEventProcessor) { ((BatchEventProcessor<T>) eventProcessor).setExceptionHandler(exceptionHandler); consumerRepository.getBarrierFor(eventHandler).alert(); } else { throw new RuntimeException( "EventProcessor: " + eventProcessor + " is not a BatchEventProcessor " + "and does not support exception handlers"); } } }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
@Override public void halt() { running.set(false); sequenceBarrier.alert(); }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
@Override public void halt() { running.set(false); sequenceBarrier.alert(); }
@Override public void halt() { running.set(HALTED); sequenceBarrier.alert(); }
@Override public void halt() { running.set(false); sequenceBarrier.alert(); }
@Override public void halt() { running.set(false); processor.barrier.alert(); }
/** * Specify the {@link ExceptionHandler} to use with the event handler. * * @param exceptionHandler the exception handler to use. */ public void with(ExceptionHandler exceptionHandler) { ((BatchEventProcessor<?>) consumerRepository.getEventProcessorFor(eventHandler)).setExceptionHandler(exceptionHandler); consumerRepository.getBarrierFor(eventHandler).alert(); } }
/** * Specify the {@link ExceptionHandler} to use with the event handler. * * @param exceptionHandler the exception handler to use. */ public void with(ExceptionHandler<? super T> exceptionHandler) { ((BatchEventProcessor<T>) consumerRepository.getEventProcessorFor(eventHandler)) .setExceptionHandler(exceptionHandler); consumerRepository.getBarrierFor(eventHandler).alert(); } }