Class DisruptorUtil
java.lang.Object
org.apache.logging.log4j.core.async.DisruptorUtil
Utility methods for getting Disruptor related configuration.
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final boolean(package private) static final booleanLOG4J2-2606: Users encountered excessive CPU utilization with Disruptor v3.4.2 when the application was logging more than the underlying appender could keep up with and the ringbuffer became full, especially when the number of application threads vastly outnumbered the number of cores.private static final Loggerprivate static final intprivate static final intprivate static final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static intcalculateRingBufferSize(String propertyName) (package private) static com.lmax.disruptor.WaitStrategycreateWaitStrategy(String propertyName) (package private) static com.lmax.disruptor.ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper> (package private) static com.lmax.disruptor.ExceptionHandler<RingBufferLogEvent> static longgetExecutorThreadId(ExecutorService executor) Returns the thread ID of the background appender thread.private static StringgetFullPropertyKey(String strategyKey, String additionalKey) private static longparseAdditionalLongProperty(String propertyName, String additionalKey, long defaultValue)
-
Field Details
-
LOGGER
-
RINGBUFFER_MIN_SIZE
private static final int RINGBUFFER_MIN_SIZE- See Also:
-
RINGBUFFER_DEFAULT_SIZE
private static final int RINGBUFFER_DEFAULT_SIZE- See Also:
-
RINGBUFFER_NO_GC_DEFAULT_SIZE
private static final int RINGBUFFER_NO_GC_DEFAULT_SIZE- See Also:
-
ASYNC_LOGGER_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULL
static final boolean ASYNC_LOGGER_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULLLOG4J2-2606: Users encountered excessive CPU utilization with Disruptor v3.4.2 when the application was logging more than the underlying appender could keep up with and the ringbuffer became full, especially when the number of application threads vastly outnumbered the number of cores. CPU utilization is significantly reduced by restricting access to the enqueue operation. -
ASYNC_CONFIG_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULL
static final boolean ASYNC_CONFIG_SYNCHRONIZE_ENQUEUE_WHEN_QUEUE_FULL
-
-
Constructor Details
-
DisruptorUtil
private DisruptorUtil()
-
-
Method Details
-
createWaitStrategy
-
getFullPropertyKey
-
parseAdditionalLongProperty
-
calculateRingBufferSize
-
getAsyncLoggerExceptionHandler
-
getAsyncLoggerConfigExceptionHandler
static com.lmax.disruptor.ExceptionHandler<AsyncLoggerConfigDisruptor.Log4jEventWrapper> getAsyncLoggerConfigExceptionHandler() -
getExecutorThreadId
Returns the thread ID of the background appender thread. This allows us to detect Logger.log() calls initiated from the appender thread, which may cause deadlock when the RingBuffer is full. (LOG4J2-471)- Parameters:
executor- runs the appender thread- Returns:
- the thread ID of the background appender thread
-