Package org.apache.logging.log4j.core
Class AbstractLifeCycle
- java.lang.Object
-
- org.apache.logging.log4j.core.AbstractLifeCycle
-
- All Implemented Interfaces:
LifeCycle,LifeCycle2
- Direct Known Subclasses:
AbstractConnectionSource,AbstractFilter,AbstractFilterable,AbstractTriggeringPolicy,AsyncLoggerConfigDisruptor,AsyncLoggerDisruptor,CompositeFilter,ConfigurationScheduler,IdlePurgePolicy,Log4jWebInitializerImpl,LoggerContext,WatchManager
public class AbstractLifeCycle extends java.lang.Object implements LifeCycle2
A life cycle to be extended.Wraps a
LifeCycle.State.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.apache.logging.log4j.core.LifeCycle
LifeCycle.State
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_STOP_TIMEOUTstatic java.util.concurrent.TimeUnitDEFAULT_STOP_TIMEUNITprotected static LoggerLOGGERAllow subclasses access to the status logger without creating another instance.private LifeCycle.Statestate
-
Constructor Summary
Constructors Constructor Description AbstractLifeCycle()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanequalsImpl(java.lang.Object obj)LifeCycle.StategetState()Gets the life-cycle state.protected static LoggergetStatusLogger()Gets the status logger.protected inthashCodeImpl()voidinitialize()booleanisInitialized()booleanisStarted()booleanisStarting()booleanisStopped()booleanisStopping()protected voidsetStarted()protected voidsetStarting()protected voidsetState(LifeCycle.State newState)protected voidsetStopped()protected voidsetStopping()voidstart()voidstop()booleanstop(long timeout, java.util.concurrent.TimeUnit timeUnit)Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.protected booleanstop(java.util.concurrent.Future<?> future)
-
-
-
Field Detail
-
DEFAULT_STOP_TIMEOUT
public static final int DEFAULT_STOP_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_STOP_TIMEUNIT
public static final java.util.concurrent.TimeUnit DEFAULT_STOP_TIMEUNIT
-
LOGGER
protected static final Logger LOGGER
Allow subclasses access to the status logger without creating another instance.
-
state
private volatile LifeCycle.State state
-
-
Method Detail
-
getStatusLogger
protected static Logger getStatusLogger()
Gets the status logger.- Returns:
- the status logger.
-
equalsImpl
protected boolean equalsImpl(java.lang.Object obj)
-
getState
public LifeCycle.State getState()
Description copied from interface:LifeCycleGets the life-cycle state.
-
hashCodeImpl
protected int hashCodeImpl()
-
isInitialized
public boolean isInitialized()
-
isStarting
public boolean isStarting()
-
isStopping
public boolean isStopping()
-
setStarted
protected void setStarted()
-
setStarting
protected void setStarting()
-
setState
protected void setState(LifeCycle.State newState)
-
setStopped
protected void setStopped()
-
setStopping
protected void setStopping()
-
initialize
public void initialize()
- Specified by:
initializein interfaceLifeCycle
-
stop
protected boolean stop(java.util.concurrent.Future<?> future)
-
stop
public boolean stop(long timeout, java.util.concurrent.TimeUnit timeUnit)Description copied from interface:LifeCycle2Blocks until all tasks have completed execution after a shutdown request, or the timeout occurs, or the current thread is interrupted, whichever happens first.- Specified by:
stopin interfaceLifeCycle2- Parameters:
timeout- the maximum time to waittimeUnit- the time unit of the timeout argument- Returns:
- true if the receiver was stopped cleanly and normally, false otherwise.
-
-