Top Description Fields Methods
org.osgi.util.pushstream

public Interface PushEventConsumer<T>

Known Direct Implementers
org.osgi.util.pushstream.PushStreamProvider.MultiplexingConsumer, org.osgi.util.pushstream.PushStreamProvider.PushEventPipe
Annotations
@ConsumerType
@FunctionalInterface
Type Parameters
<T>
The type for the event payload
Imports
org.osgi.annotation.versioning.ConsumerType

An Async Event Consumer asynchronously receives Data events until it receives either a Close or Error event.

Field Summary

Modifier and TypeField and Description
public static final long
ABORT

If ABORT is used as return value, the sender should close the channel all the way to the upstream source.

public static final long
CONTINUE

A 0 indicates that the consumer is willing to receive subsequent events at full speeds.

Method Summary

Modifier and TypeMethod and Description
public long

Returns:

less than 0 means abort, 0 means continue, more than 0 means delay ms
accept
(PushEvent<? extends T>
The event
event
)

Accept an event from a source.

Field Detail

ABORTback to summary
public static final long ABORT

If ABORT is used as return value, the sender should close the channel all the way to the upstream source. The ABORT will not guarantee that no more events are delivered since this is impossible in a concurrent environment. The consumer should accept subsequent events and close/clean up when the Close or Error event is received. Though ABORT has the value -1, any value less than 0 will act as an abort.

CONTINUEback to summary
public static final long CONTINUE

A 0 indicates that the consumer is willing to receive subsequent events at full speeds. Any value more than 0 will indicate that the consumer is becoming overloaded and wants a delay of the given milliseconds before the next event is sent. This allows the consumer to pushback the event delivery speed.

Method Detail

acceptback to summary
public long accept(PushEvent<? extends T> event) throws Exception

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.

Parameters
event:PushEvent<? extends T>

The event

Returns:long

less than 0 means abort, 0 means continue, more than 0 means delay ms

Exceptions
Exception:
to indicate that an error has occurred and that no further events should be delivered to this PushEventConsumer