Examples of WaitStrategy


Examples of com.lmax.disruptor.WaitStrategy

            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();
    }
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

    private static synchronized void initDisruptor() {
        if (disruptor != null) {
            return;
        }
        int ringBufferSize = calculateRingBufferSize();
        WaitStrategy waitStrategy = createWaitStrategy();
        disruptor = new Disruptor<RingBufferLog4jEvent>(FACTORY,
                ringBufferSize, executor, ProducerType.MULTI, waitStrategy);
        EventHandler<RingBufferLog4jEvent>[] handlers = new RingBufferLog4jEventHandler[] {//
                new RingBufferLog4jEventHandler() };
        disruptor.handleExceptionsWith(getExceptionHandler());
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

            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();
    }
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

            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);
        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();
    }
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

        ++count;
        if (disruptor != null) {
            return;
        }
        int ringBufferSize = calculateRingBufferSize();
        WaitStrategy waitStrategy = createWaitStrategy();
        disruptor = new Disruptor<Log4jEventWrapper>(FACTORY,
                ringBufferSize, executor, ProducerType.MULTI, waitStrategy);
        EventHandler<Log4jEventWrapper>[] handlers = new Log4jEventWrapperHandler[] {//
                new Log4jEventWrapperHandler() };
        disruptor.handleExceptionsWith(getExceptionHandler());
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

*/
public class DisruptorWaitStrategyCreationTest {
    @Test
    public void testCreateWaitStrategyInstance() throws Exception {
        for (final DisruptorWaitStrategy strategy : DisruptorWaitStrategy.values()) {
            final WaitStrategy waitStrategyInstance = strategy.createWaitStrategyInstance();

            assertNotNull(waitStrategyInstance);
            assertTrue(waitStrategyInstance instanceof WaitStrategy);
        }
    }
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

            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();
    }
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

        ++count;
        if (disruptor != null) {
            return;
        }
        final int ringBufferSize = calculateRingBufferSize();
        final WaitStrategy waitStrategy = createWaitStrategy();
        disruptor = new Disruptor<Log4jEventWrapper>(FACTORY, ringBufferSize,
                executor, ProducerType.MULTI, waitStrategy);
        final EventHandler<Log4jEventWrapper>[] handlers = new Log4jEventWrapperHandler[] {//
        new Log4jEventWrapperHandler() };
        disruptor.handleExceptionsWith(getExceptionHandler());
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

    private volatile boolean closed;

    public DisruptorReceiveChannel(RingBuffer<Message> buffer, Sequence... dependentSequences) {
        this.buffer = buffer;
        final Sequencer sequencer = getSequencer(buffer);
        final WaitStrategy waitStrategy = getWaitStrategy(sequencer);
        final Sequence cursor = getCursor(sequencer);

        if (!(waitStrategy instanceof StrandBlockingWaitStrategy))
            throw new IllegalArgumentException("Channel can only be created from RingBuffer with StrandBlockingWaitStrategy");
        this.barrier = new ProcessingSequenceBarrier(sequencer, waitStrategy, cursor, dependentSequences);
View Full Code Here

Examples of com.lmax.disruptor.WaitStrategy

    private volatile boolean closed;

    public DisruptorReceiveChannel(RingBuffer<Message> buffer, Sequence... dependentSequences) {
        this.buffer = buffer;
        final Sequencer sequencer = getSequencer(buffer);
        final WaitStrategy waitStrategy = getWaitStrategy(sequencer);
        final Sequence cursor = getCursor(sequencer);

        if (!(waitStrategy instanceof StrandBlockingWaitStrategy))
            throw new IllegalArgumentException("Channel can only be created from RingBuffer with StrandBlockingWaitStrategy");
        this.barrier = new ProcessingSequenceBarrier(sequencer, waitStrategy, cursor, dependentSequences);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.