PushStream instances, and utility methods for handling
PushEventSources and PushEventConsumers
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| pack-priv static class |
| Modifier and Type | Field and Description |
|---|---|
| private final Lock | |
| private int | |
| private ScheduledExecutorService |
| Access | Constructor and Description |
|---|---|
| public |
| Modifier and Type | Method and Description |
|---|---|
| private ScheduledExecutorService | |
| public <T, U extends BlockingQueue | Returns: aPushEventConsumer with a buffer directly before itBuild a buffered |
| public <T, U extends BlockingQueue | |
| public <T, U extends BlockingQueue | Returns: aSimplePushEventSourceBuild a |
| public <T, U extends BlockingQueue | Returns: APushStreamBuilder for the streamThe source of the events eventSource)Builds a push stream with custom configuration. |
| private <T> PushStream | cleanupThreads(boolean closeExecutorOnClose, Executor workerToUse, boolean releaseSchedulerOnClose, PushStream<T> stream)
|
| public <T> PushEventConsumer | Returns: aPushEventConsumer with a buffer directly before itCreate a buffered |
| public <T> PushEventSource | |
| public <T> SimplePushEventSource | Returns: aSimplePushEventSourceCreate a |
| pack-priv <T, U extends BlockingQueue | createSimplePushEventSource(int parallelism, Executor executor, U queue, QueuePolicy<T, U> queuePolicy, Runnable onClose)
|
| public <T> PushStream | Returns: APushStream with a default initial bufferCreate a stream with the default configured buffer, executor size, queue, queue policy and pushback policy. |
| pack-priv <T, U extends BlockingQueue | createStream(PushEventSource<T> eventSource, int parallelism, Executor executor, ScheduledExecutorService scheduler, U queue, QueuePolicy<T, U> queuePolicy, PushbackPolicy<T, U> pushbackPolicy)
|
| pack-priv <T> PushStream | createUnbufferedStream(PushEventSource<T> eventSource, Executor executor, ScheduledExecutorService scheduler)
|
| private void | |
| public <T> PushStream | Returns: A PushStream containing the items from the Java StreamThe items to push into the PushStream items)Create an Unbuffered |
| public <T> PushStream | Returns: A PushStream containing the items from the Java StreamThe worker to use to push items from the Stream into the
PushStream executor, ScheduledExecutorService The scheduler to use to trigger timed events in the
PushStream scheduler, Stream<T> The items to push into the PushStream items)Create an Unbuffered |
| lock | back to summary |
|---|---|
| private final Lock lock | |
| schedulerReferences | back to summary |
|---|---|
| private int schedulerReferences | |
| sharedScheduler | back to summary |
|---|---|
| private ScheduledExecutorService sharedScheduler | |
| PushStreamProvider | back to summary |
|---|---|
| public PushStreamProvider() | |
| acquireScheduler | back to summary |
|---|---|
| private ScheduledExecutorService acquireScheduler() | |
| buildBufferedConsumer | back to summary |
|---|---|
| public <T, U extends BlockingQueue Build a buffered The returned consumer will be buffered from the event source, and will honor back pressure requests from its delegate even if the event source does not. Buffered consumers are useful for "bursty" event sources which produce a number of events close together, then none for some time. These bursts can sometimes overwhelm the consumer. Buffering will not, however, protect downstream components from a source which produces events faster than they can be consumed.
Buffers are also useful as "circuit breakers". If a
Note that this buffered consumer will close when it receives a terminal event, or if the delegate returns negative backpressure. No further events will be propagated after this time.
| |
| buildEventSourceFromStream | back to summary |
|---|---|
| public <T, U extends BlockingQueue Convert an
The Late joining consumers will not receive historical events, but will immediately receive the terminal event which closed the stream if the stream is already closed.
| |
| buildSimpleEventSource | back to summary |
|---|---|
| public <T, U extends BlockingQueue Build a
| |
| buildStream | back to summary |
|---|---|
| public <T, U extends BlockingQueue Builds a push stream with custom configuration.
The resulting
| |
| cleanupThreads | back to summary |
|---|---|
| private <T> PushStream | |
| createBufferedConsumer | back to summary |
|---|---|
| public <T> PushEventConsumer Create a buffered buildBufferedConsumer(delegate).create(); The returned consumer will be buffered from the event source, and will honor back pressure requests from its delegate even if the event source does not. Buffered consumers are useful for "bursty" event sources which produce a number of events close together, then none for some time. These bursts can sometimes overwhelm the consumer. Buffering will not, however, protect downstream components from a source which produces events faster than they can be consumed.
| |
| createEventSourceFromStream | back to summary |
|---|---|
| public <T> PushEventSource Convert an buildEventSourceFromStream(stream).create();
| |
| createSimpleEventSource | back to summary |
|---|---|
| public <T> SimplePushEventSource Create a buildSimpleEventSource(type).create();
| |
| createSimplePushEventSource | back to summary |
|---|---|
pack-priv <T, U extends BlockingQueue
| |
| createStream | back to summary |
|---|---|
| public <T> PushStream Create a stream with the default configured buffer, executor size, queue, queue policy and pushback policy. This is equivalent to calling buildStream(source).create(); This stream will be buffered from the event producer, and will honor back pressure even if the source does not. 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. 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.
| |
| createStream | back to summary |
|---|---|
pack-priv <T, U extends BlockingQueue
| |
| createUnbufferedStream | back to summary |
|---|---|
| pack-priv <T> PushStream | |
| releaseScheduler | back to summary |
|---|---|
| private void releaseScheduler() | |
| streamOf | back to summary |
|---|---|
| public <T> PushStream Create an Unbuffered
| |
| streamOf | back to summary |
|---|---|
| public <T> PushStream Create an Unbuffered
| |
| Modifier and Type | Field and Description |
|---|---|
| private final CopyOnWriteArrayList | |
| private final AtomicReference |
| Access | Constructor and Description |
|---|---|
| public | MultiplexingConsumer(AtomicReference<PushEvent<T>> terminalEventStore, CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers)
|
| Modifier and Type | Method and Description |
|---|---|
| public long | accept(PushEvent<? extends T>
The event event)Implements org. Accept an event from a source. |
| consumers | back to summary |
|---|---|
| private final CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers | |
| terminalEventStore | back to summary |
|---|---|
| private final AtomicReference<PushEvent<T>> terminalEventStore | |
| MultiplexingConsumer | back to summary |
|---|---|
| public MultiplexingConsumer(AtomicReference<PushEvent<T>> terminalEventStore, CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers) | |
| accept | back to summary |
|---|---|
| public long accept(PushEvent<? extends T> event) throws Exception Implements org. Doc from org. Accept an event from a source. Events can be delivered on multiple threads simultaneously. However, Close and Error events are the last events received, no more events must be sent after them.
| |
| Modifier and Type | Field and Description |
|---|---|
| pack-priv volatile PushEventConsumer |
| Access | Constructor and Description |
|---|---|
| pack-priv |
| Modifier and Type | Method and Description |
|---|---|
| public long | accept(PushEvent<? extends T>
The event event)Implements org. Accept an event from a source. |
| public AutoCloseable | open(PushEventConsumer<? super T>
the consumer (not null) pec)Implements org. Open the asynchronous channel between the source and the consumer. |
| delegate | back to summary |
|---|---|
| pack-priv volatile PushEventConsumer<? super T> delegate | |
| PushEventPipe | back to summary |
|---|---|
| pack-priv PushEventPipe() | |
| accept | back to summary |
|---|---|
| public long accept(PushEvent<? extends T> event) throws Exception Implements org. Doc from org. Accept an event from a source. Events can be delivered on multiple threads simultaneously. However, Close and Error events are the last events received, no more events must be sent after them.
| |
| open | back to summary |
|---|---|
| public AutoCloseable open(PushEventConsumer<? super T> pec) throws Exception Implements org. Doc from org. Open the asynchronous channel between the source and the consumer. The
call returns an
| |