private void registerShutdownHook( final CascadingService service ) { if( service == null ) return; ShutdownUtil.addHook( new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.SERVICE_PROVIDER; } @Override public void execute() { try { service.stopService(); } catch( Throwable throwable ) { // safe to throw exception here so message is logged LOG.error( "failed stopping cascading service", throwable ); throw new CascadeException( "failed stopping cascading service", throwable ); } } } ); }
public static void addHook( Hook hook ) { if( hook == null ) throw new IllegalArgumentException( "hook may not be null" ); registerShutdownHook(); queue.add( hook ); }
private void deregisterShutdownHook() { if( !isStopJobsOnExit() || stop ) return; ShutdownUtil.removeHook( shutdownHook ); }
private void registerShutdownHook() { if( !isStopJobsOnExit() ) return; shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.WORK_PARENT; } @Override public void execute() { logInfo( "shutdown hook calling stop on cascade" ); BaseCascade.this.stop(); } }; ShutdownUtil.addHook( shutdownHook ); }
private void deregisterShutdownHook() { if( !isStopJobsOnExit() || stop ) return; ShutdownUtil.removeHook( shutdownHook ); }
protected void registerShutdownHook() { if( !isStopJobsOnExit() ) return; shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.WORK_CHILD; } @Override public void execute() { logInfo( "shutdown hook calling stop on flow" ); BaseFlow.this.stop(); } }; ShutdownUtil.addHook( shutdownHook ); }
private static synchronized void registerHadoopShutdownHook( Flow flow ) { if( !flow.isStopJobsOnExit() ) return; // guaranteed singleton here if( shutdownHook != null ) return; getHdfsShutdownHook(); shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.LAST; // very last thing to happen } @Override public void execute() { callHdfsShutdownHook(); } }; ShutdownUtil.addHook( shutdownHook ); }
private static synchronized void registerHadoopShutdownHook( Flow flow ) { if( !flow.isStopJobsOnExit() ) return; // guaranteed singleton here if( shutdownHook != null ) return; getHdfsShutdownHook(); shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.LAST; // very last thing to happen } @Override public void execute() { callHdfsShutdownHook(); } }; ShutdownUtil.addHook( shutdownHook ); }
private static synchronized void registerHadoopShutdownHook( Flow flow ) { if( !flow.isStopJobsOnExit() ) return; // guaranteed singleton here if( shutdownHook != null ) return; getHdfsShutdownHook(); shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.LAST; // very last thing to happen } @Override public void execute() { callHdfsShutdownHook(); } }; ShutdownUtil.addHook( shutdownHook ); }
private static synchronized void registerHadoopShutdownHook( Flow flow ) { if( !flow.isStopJobsOnExit() ) return; // guaranteed singleton here if( shutdownHook != null ) return; getHdfsShutdownHook(); shutdownHook = new ShutdownUtil.Hook() { @Override public Priority priority() { return Priority.LAST; // very last thing to happen } @Override public void execute() { callHdfsShutdownHook(); } }; ShutdownUtil.addHook( shutdownHook ); }