public class AwaitCompletionReliabilityStrategy extends java.lang.Object implements ReliabilityStrategy, LocationAwareReliabilityStrategy
Modifier and Type | Field and Description |
---|---|
private java.util.concurrent.atomic.AtomicInteger |
counter |
private LoggerConfig |
loggerConfig |
private static int |
MAX_RETRIES |
private java.util.concurrent.locks.Condition |
noLogEvents |
private java.util.concurrent.atomic.AtomicBoolean |
shutdown |
private java.util.concurrent.locks.Lock |
shutdownLock |
Constructor and Description |
---|
AwaitCompletionReliabilityStrategy(LoggerConfig loggerConfig) |
Modifier and Type | Method and Description |
---|---|
void |
afterLogEvent()
Called after a log event was logged.
|
private boolean |
beforeLogEvent() |
void |
beforeStopAppenders()
Called before all appenders are stopped.
|
void |
beforeStopConfiguration(Configuration configuration)
Called before the configuration is stopped.
|
LoggerConfig |
getActiveLoggerConfig(Supplier<LoggerConfig> next)
For internal use by the ReliabilityStrategy; returns the LoggerConfig to use.
|
void |
log(Supplier<LoggerConfig> reconfigured,
LogEvent event)
Logs an event.
|
void |
log(Supplier<LoggerConfig> reconfigured,
java.lang.String loggerName,
java.lang.String fqcn,
Marker marker,
Level level,
Message data,
java.lang.Throwable t)
Logs an event.
|
void |
log(Supplier<LoggerConfig> reconfigured,
java.lang.String loggerName,
java.lang.String fqcn,
java.lang.StackTraceElement location,
Marker marker,
Level level,
Message data,
java.lang.Throwable t)
Logs an event.
|
private void |
signalCompletionIfShutdown() |
private void |
waitForCompletion()
Waits for all log events to complete before returning.
|
private static final int MAX_RETRIES
private final java.util.concurrent.atomic.AtomicInteger counter
private final java.util.concurrent.atomic.AtomicBoolean shutdown
private final java.util.concurrent.locks.Lock shutdownLock
private final java.util.concurrent.locks.Condition noLogEvents
private final LoggerConfig loggerConfig
public AwaitCompletionReliabilityStrategy(LoggerConfig loggerConfig)
public void log(Supplier<LoggerConfig> reconfigured, java.lang.String loggerName, java.lang.String fqcn, Marker marker, Level level, Message data, java.lang.Throwable t)
ReliabilityStrategy
log
in interface ReliabilityStrategy
reconfigured
- supplies the next LoggerConfig if the strategy's LoggerConfig is no longer activeloggerName
- The name of the Logger.fqcn
- The fully qualified class name of the caller.marker
- A Marker or null if none is present.level
- The event Level.data
- The Message.t
- A Throwable or null.public void log(Supplier<LoggerConfig> reconfigured, java.lang.String loggerName, java.lang.String fqcn, java.lang.StackTraceElement location, Marker marker, Level level, Message data, java.lang.Throwable t)
LocationAwareReliabilityStrategy
log
in interface LocationAwareReliabilityStrategy
reconfigured
- supplies the next LoggerConfig if the strategy's LoggerConfig is no longer activeloggerName
- The name of the Logger.fqcn
- The fully qualified class name of the caller.location
- The location of the caller or null.marker
- A Marker or null if none is present.level
- The event Level.data
- The Message.t
- A Throwable or null.public void log(Supplier<LoggerConfig> reconfigured, LogEvent event)
ReliabilityStrategy
log
in interface ReliabilityStrategy
reconfigured
- supplies the next LoggerConfig if the strategy's LoggerConfig is no longer activeevent
- The log event.public LoggerConfig getActiveLoggerConfig(Supplier<LoggerConfig> next)
ReliabilityStrategy
getActiveLoggerConfig
in interface ReliabilityStrategy
next
- supplies the next LoggerConfig if the strategy's LoggerConfig is no longer activeprivate boolean beforeLogEvent()
public void afterLogEvent()
ReliabilityStrategy
afterLogEvent
in interface ReliabilityStrategy
private void signalCompletionIfShutdown()
public void beforeStopAppenders()
ReliabilityStrategy
beforeStopAppenders
in interface ReliabilityStrategy
private void waitForCompletion()
public void beforeStopConfiguration(Configuration configuration)
ReliabilityStrategy
beforeStopConfiguration
in interface ReliabilityStrategy
configuration
- the configuration that will be stopped