@Override public final Cancellable addShutdownCallback(final Runnable callback) { return new Cancellable() { @Override public final void cancel() { } @Override public final void run() { if(callback != null) { System.out.println("Shutdown callback + \"" + callback + "\" run..."); callback.run(); } } }; }
public Cancellable addShutdownCallback(final Runnable callback) { HOOKS.add(callback); return new Cancellable() { @Override public void cancel() { HOOKS.remove(callback); } @Override public void run() { cancel(); callback.run(); } }; }
@Override public Cancellable addShutdownCallback(final Runnable callback) { return isShutdownHookEnabled() ? shutdownCallbackRegistry.addShutdownCallback(callback) : null; }