@Override public void afterFailure(Throwable t) { processors.remove(processor); // the processor stopped with failure, this is logging the first processor's failure as the cause of // the whole application failure if (failure.compareAndSet(null, t)) { // shutdown the other processors processors.forEach(StreamProcessor::stop); } // handle the current processor's shutdown failure. handleProcessorShutdown(t); }
@Override public void run() { try { List<JobConfig> jobConfigs = planner.prepareJobs(); // create the StreamProcessors if (jobConfigs.isEmpty()) { throw new SamzaException("No jobs to run."); } jobConfigs.forEach(jobConfig -> { LOG.debug("Starting job {} StreamProcessor with config {}", jobConfig.getName(), jobConfig); StreamProcessor processor = createStreamProcessor(jobConfig, appDesc, sp -> new LocalStreamProcessorLifecycleListener(sp, jobConfig)); processors.add(processor); }); numProcessorsToStart.set(processors.size()); // start the StreamProcessors processors.forEach(StreamProcessor::start); } catch (Throwable throwable) { appStatus = ApplicationStatus.unsuccessfulFinish(throwable); shutdownLatch.countDown(); throw new SamzaException(String.format("Failed to start application: %s", new ApplicationConfig(appDesc.getConfig()).getGlobalAppId()), throwable); } }
@Override public void run() { try { List<JobConfig> jobConfigs = planner.prepareJobs(); // create the StreamProcessors if (jobConfigs.isEmpty()) { throw new SamzaException("No jobs to run."); } jobConfigs.forEach(jobConfig -> { LOG.debug("Starting job {} StreamProcessor with config {}", jobConfig.getName(), jobConfig); StreamProcessor processor = createStreamProcessor(jobConfig, appDesc, sp -> new LocalStreamProcessorLifecycleListener(sp, jobConfig)); processors.add(processor); }); numProcessorsToStart.set(processors.size()); // start the StreamProcessors processors.forEach(StreamProcessor::start); } catch (Throwable throwable) { appStatus = ApplicationStatus.unsuccessfulFinish(throwable); shutdownLatch.countDown(); throw new SamzaException(String.format("Failed to start application: %s", new ApplicationConfig(appDesc.getConfig()).getGlobalAppId()), throwable); } }
@Override public void run() { try { List<JobConfig> jobConfigs = planner.prepareJobs(); // create the StreamProcessors if (jobConfigs.isEmpty()) { throw new SamzaException("No jobs to run."); } jobConfigs.forEach(jobConfig -> { LOG.debug("Starting job {} StreamProcessor with config {}", jobConfig.getName(), jobConfig); StreamProcessor processor = createStreamProcessor(jobConfig, appDesc, sp -> new LocalStreamProcessorLifecycleListener(sp, jobConfig)); processors.add(processor); }); numProcessorsToStart.set(processors.size()); // start the StreamProcessors processors.forEach(StreamProcessor::start); } catch (Throwable throwable) { appStatus = ApplicationStatus.unsuccessfulFinish(throwable); shutdownLatch.countDown(); throw new SamzaException(String.format("Failed to start application: %s", new ApplicationConfig(appDesc.getConfig()).getGlobalAppId()), throwable); } }
@Override public void run() { try { List<JobConfig> jobConfigs = planner.prepareJobs(); // create the StreamProcessors if (jobConfigs.isEmpty()) { throw new SamzaException("No jobs to run."); } jobConfigs.forEach(jobConfig -> { LOG.debug("Starting job {} StreamProcessor with config {}", jobConfig.getName(), jobConfig); StreamProcessor processor = createStreamProcessor(jobConfig, appDesc, sp -> new LocalStreamProcessorLifecycleListener(sp, jobConfig)); processors.add(processor); }); numProcessorsToStart.set(processors.size()); // start the StreamProcessors processors.forEach(StreamProcessor::start); } catch (Throwable throwable) { appStatus = ApplicationStatus.unsuccessfulFinish(throwable); shutdownLatch.countDown(); throw new SamzaException(String.format("Failed to start application: %s", new ApplicationConfig(appDesc.getConfig()).getGlobalAppId()), throwable); } }
@Override public void run(ExternalContext externalContext) { try { List<JobConfig> jobConfigs = planner.prepareJobs(); // create the StreamProcessors if (jobConfigs.isEmpty()) { throw new SamzaException("No jobs to run."); } jobConfigs.forEach(jobConfig -> { LOG.debug("Starting job {} StreamProcessor with config {}", jobConfig.getName(), jobConfig); StreamProcessor processor = createStreamProcessor(jobConfig, appDesc, sp -> new LocalStreamProcessorLifecycleListener(sp, jobConfig), Optional.ofNullable(externalContext)); processors.add(processor); }); numProcessorsToStart.set(processors.size()); // start the StreamProcessors processors.forEach(StreamProcessor::start); } catch (Throwable throwable) { appStatus = ApplicationStatus.unsuccessfulFinish(throwable); shutdownLatch.countDown(); throw new SamzaException(String.format("Failed to start application: %s", new ApplicationConfig(appDesc.getConfig()).getGlobalAppId()), throwable); } }
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(); } }
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(); } }
@Override public void afterFailure(Throwable t) { processors.remove(processor); // the processor stopped with failure, this is logging the first processor's failure as the cause of // the whole application failure if (failure.compareAndSet(null, t)) { // shutdown the other processors processors.forEach(StreamProcessor::stop); } // handle the current processor's shutdown failure. handleProcessorShutdown(t); }
@Override public void afterFailure(Throwable t) { processors.remove(processor); // the processor stopped with failure, this is logging the first processor's failure as the cause of // the whole application failure if (failure.compareAndSet(null, t)) { // shutdown the other processors processors.forEach(StreamProcessor::stop); } // handle the current processor's shutdown failure. handleProcessorShutdown(t); }
@Override public void afterStop() { processors.remove(processor); // successful shutdown handleProcessorShutdown(null); }
@Override public void afterFailure(Throwable t) { processors.remove(processor); // the processor stopped with failure, this is logging the first processor's failure as the cause of // the whole application failure if (failure.compareAndSet(null, t)) { // shutdown the other processors processors.forEach(StreamProcessor::stop); } // handle the current processor's shutdown failure. handleProcessorShutdown(t); }
@Override public void afterStop() { processors.remove(processor); // successful shutdown handleProcessorShutdown(null); }
@Override public void afterStop() { processors.remove(processor); // successful shutdown handleProcessorShutdown(null); }
@Override public void afterStop() { processors.remove(processor); // successful shutdown handleProcessorShutdown(null); }
@Override public void afterStop() { processors.remove(processor); // successful shutdown handleProcessorShutdown(null); }
@Override public void afterFailure(Throwable t) { processors.remove(processor); // the processor stopped with failure, this is logging the first processor's failure as the cause of // the whole application failure if (failure.compareAndSet(null, t)) { // shutdown the other processors processors.forEach(StreamProcessor::stop); } // handle the current processor's shutdown failure. handleProcessorShutdown(t); }