@Plugin(name="IdlePurgePolicy", category="Core", printObject=true) @Scheduled public class IdlePurgePolicy extends AbstractLifeCycle implements PurgePolicy, Runnable
LifeCycle.State
DEFAULT_STOP_TIMEOUT, DEFAULT_STOP_TIMEUNIT, LOGGER
Constructor and Description |
---|
IdlePurgePolicy(long timeToLive,
long checkInterval,
ConfigurationScheduler scheduler) |
Modifier and Type | Method and Description |
---|---|
static PurgePolicy |
createPurgePolicy(String timeToLive,
String checkInterval,
String timeUnit,
Configuration configuration)
Create the PurgePolicy
|
void |
initialize(RoutingAppender routingAppender)
Initializes with routing appender
|
void |
purge()
Purging appenders that were not in use specified time
|
void |
run() |
boolean |
stop(long timeout,
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.
|
String |
toString() |
void |
update(String key,
LogEvent event) |
equalsImpl, getState, getStatusLogger, hashCodeImpl, initialize, isInitialized, isStarted, isStarting, isStopped, isStopping, setStarted, setStarting, setState, setStopped, setStopping, start, stop, stop
public IdlePurgePolicy(long timeToLive, long checkInterval, ConfigurationScheduler scheduler)
public void initialize(RoutingAppender routingAppender)
PurgePolicy
initialize
in interface PurgePolicy
public boolean stop(long timeout, TimeUnit timeUnit)
LifeCycle2
stop
in interface LifeCycle2
stop
in class AbstractLifeCycle
timeout
- the maximum time to waittimeUnit
- the time unit of the timeout argumentpublic void purge()
purge
in interface PurgePolicy
public void update(String key, LogEvent event)
update
in interface PurgePolicy
key
- routed appender key@PluginFactory public static PurgePolicy createPurgePolicy(@PluginAttribute(value="timeToLive") String timeToLive, @PluginAttribute(value="checkInterval") String checkInterval, @PluginAttribute(value="timeUnit") String timeUnit, @PluginConfiguration Configuration configuration)
timeToLive
- the number of increments of timeUnit before the Appender should be purged.checkInterval
- when all appenders purged, the number of increments of timeUnit to check if any appenders appearedtimeUnit
- the unit of time the timeToLive and the checkInterval is expressed in.Copyright © 1999-2021 The 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.