Package org.osgi.util.pushstream
Class PushStreamProvider.PushEventPipe<T>
- java.lang.Object
-
- org.osgi.util.pushstream.PushStreamProvider.PushEventPipe<T>
-
- All Implemented Interfaces:
PushEventConsumer<T>,PushEventSource<T>
- Enclosing class:
- PushStreamProvider
static final class PushStreamProvider.PushEventPipe<T> extends java.lang.Object implements PushEventConsumer<T>, PushEventSource<T>
-
-
Field Summary
Fields Modifier and Type Field Description (package private) PushEventConsumer<? super T>delegate-
Fields inherited from interface org.osgi.util.pushstream.PushEventConsumer
ABORT, CONTINUE
-
-
Constructor Summary
Constructors Constructor Description PushEventPipe()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longaccept(PushEvent<? extends T> event)Accept an event from a source.java.lang.AutoCloseableopen(PushEventConsumer<? super T> pec)Open the asynchronous channel between the source and the consumer.
-
-
-
Field Detail
-
delegate
volatile PushEventConsumer<? super T> delegate
-
-
Method Detail
-
open
public java.lang.AutoCloseable open(PushEventConsumer<? super T> pec) throws java.lang.Exception
Description copied from interface:PushEventSourceOpen the asynchronous channel between the source and the consumer. The call returns anAutoCloseable. This can be closed, and should close the channel, including sending a Close event if the channel was not already closed. The returned object must be able to be closed multiple times without sending more than one Close events.- Specified by:
openin interfacePushEventSource<T>- Parameters:
pec- the consumer (not null)- Returns:
- a
AutoCloseablethat can be used to close the stream - Throws:
java.lang.Exception
-
accept
public long accept(PushEvent<? extends T> event) throws java.lang.Exception
Description copied from interface:PushEventConsumerAccept 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:
acceptin 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
-
-