Package com.lmax.disruptor

Examples of com.lmax.disruptor.BlockingWaitStrategy


      this.conf.getInt("hbase.regionserver.wal.disruptor.event.count", 1024 * 16);
    // Using BlockingWaitStrategy.  Stuff that is going on here takes so long it makes no sense
    // spinning as other strategies do.
    this.disruptor =
      new Disruptor<RingBufferTruck>(RingBufferTruck.EVENT_FACTORY, preallocatedEventCount,
        this.appendExecutor, ProducerType.MULTI, new BlockingWaitStrategy());
    // Advance the ring buffer sequence so that it starts from 1 instead of 0,
    // because SyncFuture.NOT_DONE = 0.
    this.disruptor.getRingBuffer().next();
    this.ringBufferEventHandler =
      new RingBufferEventHandler(conf.getInt("hbase.regionserver.hlog.syncer.count", 5),
View Full Code Here


     * multi-threaded producer type.
     */
    public DisruptorConfiguration() {
        this.bufferSize = DEFAULT_BUFFER_SIZE;
        this.producerType = ProducerType.MULTI;
        this.waitStrategy = new BlockingWaitStrategy();
        coolingDownPeriod = 1000;
        cache = NoCache.INSTANCE;
        rescheduleCommandsOnCorruptState = true;
        rollbackConfiguration = new RollbackOnUncheckedExceptionConfiguration();
        commandTargetResolver = new AnnotationCommandTargetResolver();
View Full Code Here

        } else if ("Yield".equals(strategy)) {
            LOGGER.debug("disruptor event handler uses YieldingWaitStrategy");
            return new YieldingWaitStrategy();
        } else if ("Block".equals(strategy)) {
            LOGGER.debug("disruptor event handler uses BlockingWaitStrategy");
            return new BlockingWaitStrategy();
        }
        LOGGER.debug("disruptor event handler uses SleepingWaitStrategy");
        return new SleepingWaitStrategy();
    }
View Full Code Here

        } else if ("Yield".equals(strategy)) {
            LOGGER.debug("disruptor event handler uses YieldingWaitStrategy");
            return new YieldingWaitStrategy();
        } else if ("Block".equals(strategy)) {
            LOGGER.debug("disruptor event handler uses BlockingWaitStrategy");
            return new BlockingWaitStrategy();
        }
        LOGGER.debug("disruptor event handler uses SleepingWaitStrategy");
        return new SleepingWaitStrategy();
    }
View Full Code Here

    public void start() {
        executorService = Executors.newCachedThreadPool();
        disruptor = new Disruptor<Registration>(Registration.FACTORY,
                executorService,
                new MultiThreadedClaimStrategy(ringSize),
                new BlockingWaitStrategy());
        disruptor.handleEventsWith(new ContainerEventHandler());
        ringBuffer = disruptor.start();
    }
View Full Code Here

            } else if ("yield".equals(strategyName)) {
                waitStrategy = new YieldingWaitStrategy();
            } else if ("sleep".equals(strategyName)) {
                waitStrategy = new SleepingWaitStrategy();
            } else if ("block".equals(strategyName)) {
                waitStrategy = new BlockingWaitStrategy();
            } else {
                throw new IllegalArgumentException("WaitStrategy is not one of the allowed values: "
                                                           + "busy-spin, yield, sleep or block.");
            }
        }
View Full Code Here

    }

    private void run(String[] args) throws InterruptedException {

        // This is to keep my MBA from catching on fire...
        WaitStrategy waitStrategy = new BlockingWaitStrategy();

        RingBuffer<MarketEvent> ringBuffer = new RingBuffer<MarketEvent>(MarketEvent.FACTORY, getClaimStrategy(),
                waitStrategy);

        // Initial barrier
View Full Code Here

     * @param bufferSize number of elements to create within the ring buffer.
     * @throws IllegalArgumentException if <tt>bufferSize</tt> is less than 1 or not a power of 2
     */
    public static <E> RingBuffer<E> createMultiProducer(EventFactory<E> factory, int bufferSize)
    {
        return createMultiProducer(factory, bufferSize, new BlockingWaitStrategy());
    }
View Full Code Here

     * @param bufferSize number of elements to create within the ring buffer.
     * @throws IllegalArgumentException if <tt>bufferSize</tt> is less than 1 or not a power of 2
     */
    public static <E> RingBuffer<E> createSingleProducer(EventFactory<E> factory, int bufferSize)
    {
        return createSingleProducer(factory, bufferSize, new BlockingWaitStrategy());
    }
View Full Code Here

    // }else {
    // claimStrategy = new MultiThreadedClaimStrategy(queueSize);
    // }

    return new DisruptorQueue(name, type, queueSize,
        new BlockingWaitStrategy());
  }
View Full Code Here

TOP

Related Classes of com.lmax.disruptor.BlockingWaitStrategy

Copyright © 2018 www.massapicom. 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.