@Override public PushStream<T> buffer() { return psp.createStream(c -> { forEachEvent(c); return this; }); }
@Override public PushStream<T> buffer() { return psp.createStream(c -> { forEachEvent(c); return this; }); }
@Override public PushStream<T> buffer() { return psp.createStream(c -> { forEachEvent(c); return this; }); }
@Override public PushStream<T> build() { Executor workerToUse = worker == null ? previousExecutor : worker; ScheduledExecutorService timerToUse = timer == null ? previousScheduler : timer; if (unbuffered) { return psp.createUnbufferedStream(eventSource, workerToUse, timerToUse); } else { return psp.createStream(eventSource, concurrency, workerToUse, timerToUse, buffer, bufferingPolicy, backPressure); } } }
@Override public PushStream<T> build() { Executor workerToUse = worker == null ? previousExecutor : worker; ScheduledExecutorService timerToUse = timer == null ? previousScheduler : timer; if (unbuffered) { return psp.createUnbufferedStream(eventSource, workerToUse, timerToUse); } else { return psp.createStream(eventSource, concurrency, workerToUse, timerToUse, buffer, bufferingPolicy, backPressure); } } }
@Override public PushStream<T> build() { Executor workerToUse = worker == null ? previousExecutor : worker; ScheduledExecutorService timerToUse = timer == null ? previousScheduler : timer; if (unbuffered) { return psp.createUnbufferedStream(eventSource, workerToUse, timerToUse); } else { return psp.createStream(eventSource, concurrency, workerToUse, timerToUse, buffer, bufferingPolicy, backPressure); } } }
@Override public PushEventConsumer<T> build() { PushEventPipe<T> pipe = new PushEventPipe<>(); createStream(pipe, concurrency, worker, timer, buffer, bufferingPolicy, backPressure) .forEachEvent(delegate); return pipe; } };
@Override public PushEventConsumer<T> build() { PushEventPipe<T> pipe = new PushEventPipe<>(); createStream(pipe, concurrency, worker, timer, buffer, bufferingPolicy, backPressure) .forEachEvent(delegate); return pipe; } };
@Override public PushEventConsumer<T> build() { PushEventPipe<T> pipe = new PushEventPipe<>(); createStream(pipe, concurrency, worker, timer, buffer, bufferingPolicy, backPressure) .forEachEvent(delegate); return pipe; } };
/** * Create a stream with the default configured buffer, executor size, queue, * queue policy and pushback policy. This is equivalent to calling * * <pre> * buildStream(source).create(); * </pre> * <p> * This stream will be buffered from the event producer, and will honor back * pressure even if the source does not. * <p> * Buffered streams are useful for "bursty" event sources which produce a * number of events close together, then none for some time. These bursts * can sometimes overwhelm downstream processors. Buffering will not, * however, protect downstream components from a source which produces * events faster (on average) than they can be consumed. * <p> * Event delivery will not begin until a terminal operation is reached on * the chain of PushStreams. Once a terminal operation is reached the stream * will be connected to the event source. * * @param eventSource * @return A {@link PushStream} with a default initial buffer */ public <T> PushStream<T> createStream(PushEventSource<T> eventSource) { return createStream(eventSource, 1, null, null, new ArrayBlockingQueue<>(32), FAIL.getPolicy(), LINEAR.getPolicy(1000)); }
/** * Create a stream with the default configured buffer, executor size, queue, * queue policy and pushback policy. This is equivalent to calling * * <pre> * buildStream(source).create(); * </pre> * <p> * This stream will be buffered from the event producer, and will honor back * pressure even if the source does not. * <p> * Buffered streams are useful for "bursty" event sources which produce a * number of events close together, then none for some time. These bursts * can sometimes overwhelm downstream processors. Buffering will not, * however, protect downstream components from a source which produces * events faster (on average) than they can be consumed. * <p> * Event delivery will not begin until a terminal operation is reached on * the chain of PushStreams. Once a terminal operation is reached the stream * will be connected to the event source. * * @param eventSource * @return A {@link PushStream} with a default initial buffer */ public <T> PushStream<T> createStream(PushEventSource<T> eventSource) { return createStream(eventSource, 1, null, null, new ArrayBlockingQueue<>(32), FAIL.getPolicy(), LINEAR.getPolicy(1000)); }
/** * Create a stream with the default configured buffer, executor size, queue, * queue policy and pushback policy. This is equivalent to calling * * <pre> * buildStream(source).create(); * </pre> * <p> * This stream will be buffered from the event producer, and will honor back * pressure even if the source does not. * <p> * Buffered streams are useful for "bursty" event sources which produce a * number of events close together, then none for some time. These bursts * can sometimes overwhelm downstream processors. Buffering will not, * however, protect downstream components from a source which produces * events faster (on average) than they can be consumed. * <p> * Event delivery will not begin until a terminal operation is reached on * the chain of PushStreams. Once a terminal operation is reached the stream * will be connected to the event source. * * @param eventSource * @return A {@link PushStream} with a default initial buffer */ public <T> PushStream<T> createStream(PushEventSource<T> eventSource) { return createStream(eventSource, 1, null, null, new ArrayBlockingQueue<>(32), FAIL.getPolicy(), LINEAR.getPolicy(1000)); }