org.apache.logging.log4j.core
Interface LifeCycle

All Known Subinterfaces:
Appender, Configuration, Filter, Filterable
All Known Implementing Classes:
AbstractAppender, AbstractConfiguration, AbstractDatabaseAppender, AbstractFilter, AbstractFilterable, AbstractLifeCycle, AbstractOutputStreamAppender, AppenderControl, AsyncAppender, AsyncLoggerConfig, AsyncLoggerConfig.RootLogger, AsyncLoggerContext, BurstFilter, CompositeFilter, ConsoleAppender, DefaultConfiguration, DefaultShutdownCallbackRegistry, DynamicThresholdFilter, FailoverAppender, FileAppender, JdbcAppender, JmsAppender, JmsServer, JpaAppender, JsonConfiguration, LoggerConfig, LoggerConfig.RootLogger, LoggerContext, MapFilter, MarkerFilter, MemoryMappedFileAppender, NullConfiguration, RandomAccessFileAppender, RegexFilter, RewriteAppender, RollingFileAppender, RollingRandomAccessFileAppender, RoutingAppender, SmtpAppender, SocketAppender, StructuredDataFilter, SyslogAppender, ThreadContextMapFilter, ThresholdFilter, TimeFilter, XmlConfiguration, YamlConfiguration

public interface LifeCycle

All proper Java frameworks implement some sort of object life cycle. In Log4j, the main interface for handling the life cycle context of an object is this one. An object first starts in the LifeCycle.State.INITIALIZED state by default to indicate the class has been loaded. From here, calling the start() method will change this state to LifeCycle.State.STARTING. After successfully being started, this state is changed to LifeCycle.State.STARTED. When the stop() is called, this goes into the LifeCycle.State.STOPPING state. After successfully being stopped, this goes into the LifeCycle.State.STOPPED state. In most circumstances, implementation classes should store their LifeCycle.State in a volatile field or inside an AtomicReference dependent on synchronization and concurrency requirements.


Nested Class Summary
static class LifeCycle.State
          Status of a life cycle like a LoggerContext.
 
Method Summary
 LifeCycle.State getState()
          Gets the life-cycle state
 boolean isStarted()
           
 boolean isStopped()
           
 void start()
           
 void stop()
           
 

Method Detail

getState

LifeCycle.State getState()
Gets the life-cycle state

Returns:
the life-cycle state

start

void start()

stop

void stop()

isStarted

boolean isStarted()

isStopped

boolean isStopped()


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.