LOGGER.trace("AsyncLoggerConfigHelper not starting new disruptor, using existing object. Ref count is {}.", count);
return;
}
LOGGER.trace("AsyncLoggerConfigHelper creating new disruptor. Ref count is {}.", count);
final int ringBufferSize = calculateRingBufferSize();
final WaitStrategy waitStrategy = createWaitStrategy();
executor = Executors.newSingleThreadExecutor(threadFactory);
initThreadLocalForExecutorThread();
disruptor = new Disruptor<Log4jEventWrapper>(FACTORY, ringBufferSize,
executor, ProducerType.MULTI, waitStrategy);
final EventHandler<Log4jEventWrapper>[] handlers = new Log4jEventWrapperHandler[] {//
new Log4jEventWrapperHandler() };
final ExceptionHandler errorHandler = getExceptionHandler();
disruptor.handleExceptionsWith(errorHandler);
disruptor.handleEventsWith(handlers);
LOGGER.debug(
"Starting AsyncLoggerConfig disruptor with ringbuffer size={}, waitStrategy={}, exceptionHandler={}...",
disruptor.getRingBuffer().getBufferSize(), waitStrategy.getClass().getSimpleName(), errorHandler);
disruptor.start();
}