Java Code Examples for com.lmax.disruptor.LiteBlockingWaitStrategy

The following are top voted examples for showing how to use com.lmax.disruptor.LiteBlockingWaitStrategy. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: DisruptorBootstrap   File: App.java   View source code 6 votes vote down vote up
@SuppressWarnings("unchecked")
public static void main(String[] args) throws InterruptedException {
	//Executor that will be used to construct new threads for consumers
	Executor executor = Executors.newCachedThreadPool();
	//Specify the size of the ring buffer, must be power of 2.
	int bufferSize = 1024;
	//Disruptor<ObjectEvent> disruptor = new Disruptor<>(ObjectEvent::new, bufferSize, executor);
	Disruptor<ObjectEvent> disruptor = new Disruptor<>(ObjectEvent::new, bufferSize, executor, 
			ProducerType.SINGLE, new LiteBlockingWaitStrategy());

	disruptor.handleEventsWith(App::handleEvent1);
	disruptor.handleEventsWith(App::handleEvent2);
	
	//disruptor.handleEventsWith((event, sequence, endOfBatch) -> System.out.println("Event: " + event.getObject()));
	disruptor.start();

	produceEvents(disruptor);
}
 
Example 2
Project: HeliosStreams   File: MetricsMetaAPIImpl.java   View source code 5 votes vote down vote up
/**
 * Creates a new MetricsMetaAPIImpl
 * @param properties The configuration properties
 */
public MetricsMetaAPIImpl(final Properties properties) {
	dataSource = SQLCompilerDataSource.getInstance(properties);
	sqlWorker = dataSource.getSQLWorker();
	tagPredicateCache = new TagPredicateCache(sqlWorker);
	fjPool = new ManagedForkJoinPool(getClass().getSimpleName(), Runtime.getRuntime().availableProcessors(), true, JMXHelper.objectName(getClass()));
	metaReader = new DefaultMetaReader(sqlWorker);
	dispatcher = new WorkQueueDispatcher("MetricsMetaDispatcher", Runtime.getRuntime().availableProcessors(), 1024, this, ProducerType.MULTI, new LiteBlockingWaitStrategy());
	log.info("Dispatcher Alive: {}", dispatcher.alive());
}
 
Example 3
Project: Electrons   File: Dispatcher.java   View source code 5 votes vote down vote up
/**
 * 根据config初始化特殊通道
 *
 * @param symbol    事件
 * @param listeners 对应的监听器集合
 */
private void initSpecDisruptor(String symbol, List<ElectronsListener> listeners) {
    ExecutorService specPool = Executors.newFixedThreadPool(conf.getSpecCircuitNum(), new ThreadFactory() {

        final AtomicInteger cursor = new AtomicInteger(0);

        @Override
        public Thread newThread(Runnable r) {
            return new Thread(r, "Electrons Thread (from spec channel) : thread" + cursor.incrementAndGet());
        }
    });
    pools.add(specPool);

    Disruptor<ElectronsHolder> disruptor = new Disruptor<>(ElectronsHolder::new, conf.getSpecCircuitLen(), specPool, ProducerType.MULTI, new LiteBlockingWaitStrategy());
    disruptor.handleExceptionsWith(new ElecExceptionHandler("Spec Disruptor {" + symbol + "}"));

    //初始化管道并放入集合中
    SpecChannel specChannel = new SpecChannel(disruptor);
    if (conf.isBreaker()) {
        EventCountCircuitBreaker breaker = new EventCountCircuitBreaker(conf.getErrorNum(), conf.getPerUnit(), conf.getUnit(), conf.getCloseThreshold(), conf.getRest(), conf.getRestUnit());
        specChannel.setBreaker(breaker);
    }

    //构建listener顺序
    ListenerChainBuilderNew.buildChain(specChannel, listeners);

    channelMap.put(SPEC_CHANNEL_PREFIX + symbol, specChannel);
}
 
Example 4
Project: Electrons   File: Dispatcher.java   View source code 5 votes vote down vote up
/**
 * 初始化正常管道,任何情况下都会有
 *
 * @param pool 线程池
 */
private void initNormalChannel(ExecutorService pool) {
    Disruptor<ElectronsHolder> normalDis = new Disruptor<>(ElectronsHolder::new, conf.getCircuitLen(), pool, ProducerType.MULTI, new LiteBlockingWaitStrategy());
    WorkHandler[] workHandlers = new WorkHandler[conf.getCircuitNum()];
    Arrays.fill(workHandlers, (WorkHandler<ElectronsHolder>) electronsHolder -> electronsHolder.handle());
    normalDis.handleEventsWithWorkerPool(workHandlers);
    normalDis.handleExceptionsWith(new ElecExceptionHandler("Normal Disruptor"));

    //初始化channel
    Channel normalChannel = new NormalChannel(normalDis);
    //配置限流相关
    normalChannel.confLimitRate(conf.isLimitRate(), conf.getPermitsPerSecond(), conf.isWarmup(), conf.getWarmupPeriod(), conf.getWarmPeriodUnit());
    channelMap.put(NORMAL_CHANNEL_KEY, normalChannel);
}
 
Example 5
Project: disruptor-spring-manager   File: WaitStrategyTypeTest.java   View source code 5 votes vote down vote up
@Test
public void test_All_WaitStrategies() {
	assertTrue(WaitStrategyType.BLOCKING.instance() instanceof BlockingWaitStrategy);
	assertTrue(WaitStrategyType.BUSY_SPIN.instance() instanceof BusySpinWaitStrategy);
	assertTrue(WaitStrategyType.LITE_BLOCKING.instance() instanceof LiteBlockingWaitStrategy);
	assertTrue(WaitStrategyType.SLEEPING_WAIT.instance() instanceof SleepingWaitStrategy);
	assertTrue(WaitStrategyType.YIELDING.instance() instanceof YieldingWaitStrategy);
}
 
Example 6
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param <E> Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create() {
  return create(RingBufferProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 7
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(boolean autoCancel) {
  return create(RingBufferProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(),
    autoCancel);
}
 
Example 8
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service A provided ExecutorService to manage threading infrastructure
 * @param <E>     Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(ExecutorService service) {
  return create(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 9
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(ExecutorService service, boolean autoCancel) {
  return create(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 10
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return
 */
public static <E> RingBufferProcessor<E> create(String name, int bufferSize) {
  return create(name, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 11
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the blockingWait Strategy, passed backlog size,
 * and auto-cancel settings.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(String name, int bufferSize, boolean autoCancel) {
  return create(name, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 12
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using passed backlog size, blockingWait Strategy
 * and will auto-cancel.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(ExecutorService service, int bufferSize) {
  return create(service, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 13
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using passed backlog size, blockingWait Strategy
 * and the auto-cancel argument.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> create(ExecutorService service, int bufferSize, boolean autoCancel) {
  return create(service, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 14
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param <E> Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share() {
  return share(RingBufferProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 15
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(boolean autoCancel) {
  return share(RingBufferProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(),
    autoCancel);
}
 
Example 16
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service A provided ExecutorService to manage threading infrastructure
 * @param <E>     Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(ExecutorService service) {
  return share(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 17
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(ExecutorService service, boolean autoCancel) {
  return share(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 18
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(String name, int bufferSize) {
  return share(name, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 19
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the blockingWait Strategy, passed backlog size,
 * and auto-cancel settings.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(String name, int bufferSize, boolean autoCancel) {
  return share(name, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 20
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using passed backlog size, blockingWait Strategy
 * and will auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(ExecutorService service, int bufferSize) {
  return share(service, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 21
Project: camunda-bpm-reactor   File: RingBufferProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using passed backlog size, blockingWait Strategy
 * and the auto-cancel argument.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferProcessor<E> share(ExecutorService service, int bufferSize, boolean autoCancel) {
  return share(service, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 22
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param <E> Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create() {
  return create(RingBufferWorkProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new
    LiteBlockingWaitStrategy(), true);
}
 
Example 23
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(boolean autoCancel) {
  return create(RingBufferWorkProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new
    LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 24
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service A provided ExecutorService to manage threading infrastructure
 * @param <E>     Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(ExecutorService service) {
  return create(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 25
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(ExecutorService service, boolean autoCancel) {
  return create(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 26
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(String name, int bufferSize) {
  return create(name, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 27
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(String name, int bufferSize, boolean autoCancel) {
  return create(name, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 28
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(ExecutorService service, int bufferSize) {
  return create(service, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 29
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> create(ExecutorService service, int bufferSize, boolean autoCancel) {
  return create(service, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 30
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param <E> Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share() {
  return share(RingBufferWorkProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new
    LiteBlockingWaitStrategy(), true);
}
 
Example 31
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created.
 *
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(boolean autoCancel) {
  return share(RingBufferWorkProcessor.class.getSimpleName(), SMALL_BUFFER_SIZE, new
    LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 32
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and auto-cancel.
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service A provided ExecutorService to manage threading infrastructure
 * @param <E>     Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(ExecutorService service) {
  return share(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), true);
}
 
Example 33
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using {@link #SMALL_BUFFER_SIZE} backlog size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(ExecutorService service, boolean autoCancel) {
  return share(service, SMALL_BUFFER_SIZE, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 34
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(String name, int bufferSize) {
  return share(name, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 35
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and the passed auto-cancel setting.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * A new Cached ThreadExecutorPool will be implicitely created and will use the passed name to qualify
 * the created threads.
 *
 * @param name       Use a new Cached ExecutorService and assign this name to the created threads
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(String name, int bufferSize, boolean autoCancel) {
  return share(name, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}
 
Example 36
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(ExecutorService service, int bufferSize) {
  return share(service, bufferSize, new LiteBlockingWaitStrategy(), true);
}
 
Example 37
Project: camunda-bpm-reactor   File: RingBufferWorkProcessor.java   View source code 2 votes vote down vote up
/**
 * Create a new RingBufferWorkProcessor using the passed buffer size, blockingWait Strategy
 * and auto-cancel.
 * <p>
 * A Shared Processor authorizes concurrent onNext calls and is suited for multi-threaded publisher that
 * will fan-in data.
 * <p>
 * The passed {@link java.util.concurrent.ExecutorService} will execute as many event-loop
 * consuming the ringbuffer as subscribers.
 *
 * @param service    A provided ExecutorService to manage threading infrastructure
 * @param bufferSize A Backlog Size to mitigate slow subscribers
 * @param autoCancel Should this propagate cancellation when unregistered by all subscribers ?
 * @param <E>        Type of processed signals
 * @return a fresh processor
 */
public static <E> RingBufferWorkProcessor<E> share(ExecutorService service, int bufferSize, boolean autoCancel) {
  return share(service, bufferSize, new LiteBlockingWaitStrategy(), autoCancel);
}