Java 类org.apache.logging.log4j.core.util.Cancellable 实例源码

项目:mongoose-base    文件:LogUtil.java   
@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();
            }
        }
    };
}
项目:tomee    文件:CaptureLog4j2ShutdownHooks.java   
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();
        }
    };
}
项目:logging-log4j2    文件:Log4jContextFactory.java   
@Override
public Cancellable addShutdownCallback(final Runnable callback) {
    return isShutdownHookEnabled() ? shutdownCallbackRegistry.addShutdownCallback(callback) : null;
}