Exemplo n.º 1
0
  static {
    initInfoForExecutorThread();
    LOGGER.debug("AsyncLogger.ThreadNameStrategy={}", THREAD_NAME_STRATEGY);
    final int ringBufferSize = calculateRingBufferSize();

    final WaitStrategy waitStrategy = createWaitStrategy();
    disruptor =
        new Disruptor<>(
            RingBufferLogEvent.FACTORY, ringBufferSize, EXECUTOR, ProducerType.MULTI, waitStrategy);
    disruptor.handleExceptionsWith(getExceptionHandler());
    disruptor.handleEventsWith(new RingBufferLogEventHandler());

    LOGGER.debug(
        "Starting AsyncLogger disruptor with ringbuffer size {}...",
        disruptor.getRingBuffer().getBufferSize());
    disruptor.start();
  }