@Override public void afterFailure(Throwable t) { log.info("Container Failed"); containerRunnerException = t; listener.afterFailure(t); } });
@Override public void afterFailure(Throwable t) { log.info("Container Failed"); containerRunnerException = t; listener.afterFailure(t); } });
@Override public void afterFailure(Throwable t) { log.info("Container Failed"); containerRunnerException = t; listener.afterFailure(t); } });
@Override public void afterFailure(Throwable t) { log.info("Container Failed"); containerRunnerException = t; listener.afterFailure(t); } });
@Override public void afterFailure(Throwable t) { log.info("Container Failed"); containerRunnerException = t; listener.afterFailure(t); } });
@Override public void onCoordinatorFailure(Throwable throwable) { synchronized (lock) { LOGGER.info(String.format("Coordinator: %s failed with an exception. Stopping the stream processor: %s. Original exception:", jobCoordinator, processorId), throwable); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } processorListener.afterFailure(throwable); } };
@Override public void onCoordinatorFailure(Throwable throwable) { synchronized (lock) { LOGGER.info(String.format("Coordinator: %s failed with an exception. Stopping the stream processor: %s. Original exception:", jobCoordinator, processorId), throwable); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } processorListener.afterFailure(throwable); } };
@Override public void onCoordinatorFailure(Throwable throwable) { synchronized (lock) { LOGGER.info(String.format("Coordinator: %s failed with an exception. Stopping the stream processor: %s. Original exception:", jobCoordinator, processorId), throwable); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } processorListener.afterFailure(throwable); } };
@Override public void onCoordinatorFailure(Throwable throwable) { synchronized (lock) { LOGGER.info(String.format("Coordinator: %s failed with an exception. Stopping the stream processor: %s. Original exception:", jobCoordinator, processorId), throwable); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } processorListener.afterFailure(throwable); } };
@Override public void onCoordinatorFailure(Throwable throwable) { synchronized (lock) { LOGGER.info(String.format("Coordinator: %s failed with an exception. Stopping the stream processor: %s. Original exception:", jobCoordinator, processorId), throwable); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } processorListener.afterFailure(throwable); } };
@Override public void onCoordinatorStop() { synchronized (lock) { LOGGER.info("Shutting down the executor service of the stream processor: {}.", processorId); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } if (containerException != null) processorListener.afterFailure(containerException); else processorListener.afterStop(); }
@Override public void onCoordinatorStop() { synchronized (lock) { LOGGER.info("Shutting down the executor service of the stream processor: {}.", processorId); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } if (containerException != null) processorListener.afterFailure(containerException); else processorListener.afterStop(); }
@Override public void onCoordinatorStop() { synchronized (lock) { LOGGER.info("Shutting down the executor service of the stream processor: {}.", processorId); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } if (containerException != null) processorListener.afterFailure(containerException); else processorListener.afterStop(); }
@Override public void onCoordinatorStop() { synchronized (lock) { LOGGER.info("Shutting down the executor service of the stream processor: {}.", processorId); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } if (containerException != null) processorListener.afterFailure(containerException); else processorListener.afterStop(); }
@Override public void onCoordinatorStop() { synchronized (lock) { LOGGER.info("Shutting down the executor service of the stream processor: {}.", processorId); boolean hasContainerShutdown = stopSamzaContainer(); // we only want to interrupt when container shutdown times out. if (!hasContainerShutdown) { containerExcecutorService.shutdownNow(); } state = State.STOPPED; } if (containerException != null) processorListener.afterFailure(containerException); else processorListener.afterStop(); }
private void handleProcessorShutdown(Throwable error) { if (processors.isEmpty()) { // all processors are shutdown, setting the application final status setApplicationFinalStatus(); } if (error != null) { // current processor shutdown with a failure userDefinedProcessorLifecycleListener.afterFailure(error); } else { // current processor shutdown successfully userDefinedProcessorLifecycleListener.afterStop(); } if (processors.isEmpty()) { // no processor is still running. Notify callers waiting on waitForFinish() shutdownLatch.countDown(); } }
private void handleProcessorShutdown(Throwable error) { if (processors.isEmpty()) { // all processors are shutdown, setting the application final status setApplicationFinalStatus(); } if (error != null) { // current processor shutdown with a failure userDefinedProcessorLifecycleListener.afterFailure(error); } else { // current processor shutdown successfully userDefinedProcessorLifecycleListener.afterStop(); } if (processors.isEmpty()) { // no processor is still running. Notify callers waiting on waitForFinish() shutdownLatch.countDown(); } }
private void handleProcessorShutdown(Throwable error) { if (processors.isEmpty()) { // all processors are shutdown, setting the application final status setApplicationFinalStatus(); } if (error != null) { // current processor shutdown with a failure userDefinedProcessorLifecycleListener.afterFailure(error); } else { // current processor shutdown successfully userDefinedProcessorLifecycleListener.afterStop(); } if (processors.isEmpty()) { // no processor is still running. Notify callers waiting on waitForFinish() shutdownLatch.countDown(); } }
private void handleProcessorShutdown(Throwable error) { if (processors.isEmpty()) { // all processors are shutdown, setting the application final status setApplicationFinalStatus(); } if (error != null) { // current processor shutdown with a failure userDefinedProcessorLifecycleListener.afterFailure(error); } else { // current processor shutdown successfully userDefinedProcessorLifecycleListener.afterStop(); } if (processors.isEmpty()) { // no processor is still running. Notify callers waiting on waitForFinish() shutdownLatch.countDown(); } }
@Test public void testCoordinatorFailureShouldStopTheStreamProcessor() { JobCoordinator mockJobCoordinator = Mockito.mock(JobCoordinator.class); ProcessorLifecycleListener lifecycleListener = Mockito.mock(ProcessorLifecycleListener.class); SamzaContainer mockSamzaContainer = Mockito.mock(SamzaContainer.class); MapConfig config = new MapConfig(ImmutableMap.of("task.shutdown.ms", "0")); StreamProcessor streamProcessor = new StreamProcessor("TestProcessorId", config, new HashMap<>(), null, lifecycleListener, mockJobCoordinator); Exception failureException = new Exception("dummy exception"); streamProcessor.container = mockSamzaContainer; streamProcessor.state = State.RUNNING; streamProcessor.jobCoordinatorListener.onCoordinatorFailure(failureException); Mockito.doNothing().when(mockSamzaContainer).shutdown(); Mockito.when(mockSamzaContainer.hasStopped()).thenReturn(false); assertEquals(State.STOPPED, streamProcessor.state); Mockito.verify(lifecycleListener).afterFailure(failureException); Mockito.verify(mockSamzaContainer).shutdown(); }