public void ShouldBeAbleToOverrideTheExceptionHandlerForAEventProcessor() { var testException = new Exception(); var eventHandler = new ExceptionThrowingEventHandler(testException); _disruptor.HandleEventsWith(eventHandler); var reference = new AtomicReference <Exception>(); var exceptionHandler = new StubExceptionHandler(reference); _disruptor.HandleExceptionsFor(eventHandler).With(exceptionHandler); PublishEvent(); WaitFor(reference); }
public void ShouldApplyDefaultExceptionHandlerToExistingEventProcessors() { var eventHandled = new AtomicReference <Exception>(); IExceptionHandler <object> exceptionHandler = new StubExceptionHandler(eventHandled); var testException = new Exception(); var handler = new ExceptionThrowingEventHandler(testException); _disruptor.HandleEventsWith(handler); _disruptor.SetDefaultExceptionHandler(exceptionHandler); PublishEvent(); var actualException = WaitFor(eventHandled); Assert.AreSame(testException, actualException); }
public void ShouldSupportSpecifyingAExceptionHandlerForEventProcessors() { var eventHandled = new AtomicReference <Exception>(); IExceptionHandler <object> exceptionHandler = new StubExceptionHandler(eventHandled); var testException = new Exception(); var handler = new ExceptionThrowingEventHandler(testException); _disruptor.HandleExceptionsWith(exceptionHandler); _disruptor.HandleEventsWith(handler); PublishEvent(); var actualException = WaitFor(eventHandled); Assert.AreSame(testException, actualException); }
public void ShouldOnlyApplyExceptionsHandlersSpecifiedViaHandleExceptionsWithOnNewEventProcessors() { var eventHandled = new AtomicReference <Exception>(); IExceptionHandler <object> exceptionHandler = new StubExceptionHandler(eventHandled); var testException = new Exception(); var handler = new ExceptionThrowingEventHandler(testException); _disruptor.HandleExceptionsWith(exceptionHandler); _disruptor.HandleEventsWith(handler); _disruptor.HandleExceptionsWith(new FatalExceptionHandler()); PublishEvent(); var actualException = WaitFor(eventHandled); Assert.AreSame(testException, actualException); }