|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.logging.log4j.core.util.DefaultShutdownCallbackRegistry
public class DefaultShutdownCallbackRegistry
ShutdownRegistrationStrategy that simply uses Runtime.addShutdownHook(Thread)
. If no strategy is specified,
this one is used for shutdown hook registration.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle |
---|
LifeCycle.State |
Field Summary | |
---|---|
protected static org.apache.logging.log4j.Logger |
LOGGER
|
Fields inherited from interface org.apache.logging.log4j.core.util.ShutdownCallbackRegistry |
---|
SHUTDOWN_CALLBACK_REGISTRY, SHUTDOWN_HOOK_ENABLED, SHUTDOWN_HOOK_MARKER |
Constructor Summary | |
---|---|
|
DefaultShutdownCallbackRegistry()
Constructs a DefaultShutdownRegistrationStrategy. |
protected |
DefaultShutdownCallbackRegistry(ThreadFactory threadFactory)
Constructs a DefaultShutdownRegistrationStrategy using the given ThreadFactory . |
Method Summary | |
---|---|
Cancellable |
addShutdownCallback(Runnable callback)
Adds a Runnable shutdown callback to this class. |
LifeCycle.State |
getState()
Gets the life-cycle state |
boolean |
isStarted()
Indicates if this can accept shutdown hooks. |
boolean |
isStopped()
|
void |
run()
Executes the registered shutdown callbacks. |
void |
start()
Registers the shutdown thread only if this is initialized. |
void |
stop()
Cancels the shutdown thread only if this is started. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected static final org.apache.logging.log4j.Logger LOGGER
Constructor Detail |
---|
public DefaultShutdownCallbackRegistry()
protected DefaultShutdownCallbackRegistry(ThreadFactory threadFactory)
ThreadFactory
.
threadFactory
- the ThreadFactory to use to create a Runtime
shutdown hook threadMethod Detail |
---|
public void run()
run
in interface Runnable
public Cancellable addShutdownCallback(Runnable callback)
ShutdownCallbackRegistry
addShutdownCallback
in interface ShutdownCallbackRegistry
callback
- the shutdown callback to be executed upon shutdown.
null
if the shutdown hook is disabled and
cannot be added.public void start()
start
in interface LifeCycle
public void stop()
stop
in interface LifeCycle
public LifeCycle.State getState()
LifeCycle
getState
in interface LifeCycle
public boolean isStarted()
isStarted
in interface LifeCycle
public boolean isStopped()
isStopped
in interface LifeCycle
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright © 1999-2015 Apache Software Foundation. All Rights Reserved.
Apache Logging, Apache Log4j, Log4j, Apache, the Apache feather logo, the Apache Logging project logo, and the Apache Log4j logo are trademarks of The Apache Software Foundation.