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

项目:logging-log4j2    文件:Log4jContextFactory.java   
/**
 * Constructs a Log4jContextFactory using the provided ContextSelector and ShutdownRegistrationStrategy.
 *
 * @param selector                     the selector to use
 * @param shutdownCallbackRegistry the ShutdownRegistrationStrategy to use
 * @since 2.1
 */
public Log4jContextFactory(final ContextSelector selector,
                           final ShutdownCallbackRegistry shutdownCallbackRegistry) {
    this.selector = Objects.requireNonNull(selector, "No ContextSelector provided");
    this.shutdownCallbackRegistry = Objects.requireNonNull(shutdownCallbackRegistry, "No ShutdownCallbackRegistry provided");
    LOGGER.debug("Using ShutdownCallbackRegistry {}", shutdownCallbackRegistry.getClass());
    initializeShutdownCallbackRegistry();
}
项目:logging-log4j2    文件:Log4jContextFactory.java   
private static ShutdownCallbackRegistry createShutdownCallbackRegistry() {
    try {
        final ShutdownCallbackRegistry registry = LoaderUtil.newCheckedInstanceOfProperty(
            ShutdownCallbackRegistry.SHUTDOWN_CALLBACK_REGISTRY, ShutdownCallbackRegistry.class
        );
        if (registry != null) {
            return registry;
        }
    } catch (final Exception e) {
        LOGGER.error("Unable to create custom ShutdownCallbackRegistry. Falling back to default.", e);
    }
    return new DefaultShutdownCallbackRegistry();
}
项目:logging-log4j2    文件:Log4jContextFactory.java   
/**
 * Constructs a Log4jContextFactory using the ContextSelector from {@link Constants#LOG4J_CONTEXT_SELECTOR}
 * and the provided ShutdownRegistrationStrategy.
 *
 * @param shutdownCallbackRegistry the ShutdownRegistrationStrategy to use
 * @since 2.1
 */
public Log4jContextFactory(final ShutdownCallbackRegistry shutdownCallbackRegistry) {
    this(createContextSelector(), shutdownCallbackRegistry);
}
项目:logging-log4j2    文件:Log4jContextFactory.java   
/**
 * Returns the ShutdownCallbackRegistry
 *
 * @return the ShutdownCallbackRegistry
 * @since 2.4
 */
public ShutdownCallbackRegistry getShutdownCallbackRegistry() {
    return shutdownCallbackRegistry;
}