Package org.osgi.util.pushstream
Class PushStreamProvider.MultiplexingConsumer<T>
- java.lang.Object
-
- org.osgi.util.pushstream.PushStreamProvider.MultiplexingConsumer<T>
-
- All Implemented Interfaces:
PushEventConsumer<T>
- Enclosing class:
- PushStreamProvider
private static class PushStreamProvider.MultiplexingConsumer<T> extends java.lang.Object implements PushEventConsumer<T>
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.concurrent.CopyOnWriteArrayList<PushEventConsumer<? super T>>
consumers
private java.util.concurrent.atomic.AtomicReference<PushEvent<T>>
terminalEventStore
-
Fields inherited from interface org.osgi.util.pushstream.PushEventConsumer
ABORT, CONTINUE
-
-
Constructor Summary
Constructors Constructor Description MultiplexingConsumer(java.util.concurrent.atomic.AtomicReference<PushEvent<T>> terminalEventStore, java.util.concurrent.CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
accept(PushEvent<? extends T> event)
Accept an event from a source.
-
-
-
Field Detail
-
terminalEventStore
private final java.util.concurrent.atomic.AtomicReference<PushEvent<T>> terminalEventStore
-
consumers
private final java.util.concurrent.CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers
-
-
Constructor Detail
-
MultiplexingConsumer
public MultiplexingConsumer(java.util.concurrent.atomic.AtomicReference<PushEvent<T>> terminalEventStore, java.util.concurrent.CopyOnWriteArrayList<PushEventConsumer<? super T>> consumers)
-
-
Method Detail
-
accept
public long accept(PushEvent<? extends T> event) throws java.lang.Exception
Description copied from interface:PushEventConsumer
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.- Specified by:
accept
in interfacePushEventConsumer<T>
- Parameters:
event
- The event- Returns:
- less than 0 means abort, 0 means continue, more than 0 means delay ms
- Throws:
java.lang.Exception
- to indicate that an error has occurred and that no further events should be delivered to thisPushEventConsumer
-
-