/** * Construct {@link PhasedBackoffWaitStrategy} with fallback to {@link LiteBlockingWaitStrategy} * * @param spinTimeout The maximum time in to busy spin for. * @param yieldTimeout The maximum time in to yield for. * @param units Time units used for the timeout values. * @return The constructed wait strategy. */ public static PhasedBackoffWaitStrategy withLiteLock( long spinTimeout, long yieldTimeout, TimeUnit units) { return new PhasedBackoffWaitStrategy( spinTimeout, yieldTimeout, units, new LiteBlockingWaitStrategy()); }
@Override public long tryWaitFor(long sequence, Sequence cursor, Sequence dependentSequence, SequenceBarrier barrier, long spin) throws AlertException, InterruptedException, TimeoutException { return waitFor(sequence, cursor, dependentSequence, barrier); }
break; case LITE_BLOCKING_WAIT: waitStrategy = new LiteBlockingWaitStrategy(); break; case TIMEOUT_BLOCKING_WAIT:
break; case LITE_BLOCKING_WAIT: waitStrategy = new LiteBlockingWaitStrategy(); break; case TIMEOUT_BLOCKING_WAIT:
/** * Construct {@link PhasedBackoffWaitStrategy} with fallback to {@link LiteBlockingWaitStrategy} * * @param spinTimeout The maximum time in to busy spin for. * @param yieldTimeout The maximum time in to yield for. * @param units Time units used for the timeout values. * @return The constructed wait strategy. */ public static PhasedBackoffWaitStrategy withLiteLock( long spinTimeout, long yieldTimeout, TimeUnit units) { return new PhasedBackoffWaitStrategy( spinTimeout, yieldTimeout, units, new LiteBlockingWaitStrategy()); }
/** * Block with wait/notifyAll semantics */ public static PhasedBackoffWaitStrategy withLiteLock( long spinTimeout, long yieldTimeout, TimeUnit units) { return new PhasedBackoffWaitStrategy( spinTimeout, yieldTimeout, units, new LiteBlockingWaitStrategy()); }
/** * Block with wait/notifyAll semantics */ public static PhasedBackoffWaitStrategy withLiteLock(long spinTimeout, long yieldTimeout, TimeUnit units) { return new PhasedBackoffWaitStrategy(spinTimeout, yieldTimeout, units, new LiteBlockingWaitStrategy()); }
/** * Construct {@link PhasedBackoffWaitStrategy} with fallback to {@link LiteBlockingWaitStrategy} * * @param spinTimeout The maximum time in to busy spin for. * @param yieldTimeout The maximum time in to yield for. * @param units Time units used for the timeout values. * @return The constructed wait strategy. */ public static PhasedBackoffWaitStrategy withLiteLock( long spinTimeout, long yieldTimeout, TimeUnit units) { return new PhasedBackoffWaitStrategy( spinTimeout, yieldTimeout, units, new LiteBlockingWaitStrategy()); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }
/** * 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); }