T - the produced value typepublic abstract class Producer<T> extends java.lang.Object implements Observable<T>
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Producer.State<U>
The internal state of the observer registrations.
|
| Constructor and Description |
|---|
Producer() |
| Modifier and Type | Method and Description |
|---|---|
java.io.Closeable |
register(Observer<? super T> observer)
Registers an observer for the notification of Ts.
|
protected java.io.Closeable |
registerRaw(Observer<? super T> observer,
boolean safeguard)
Performs the registration and wiring up cancellation handlers for
the given observer.
|
protected abstract java.io.Closeable |
run(Observer<? super T> observer,
java.io.Closeable cancel,
Action1<java.io.Closeable> setSink)
The core implementation of the operator, called upon
registration to the producer.
|
@Nonnull
public java.io.Closeable register(@Nonnull
Observer<? super T> observer)
Observableregister in interface Observable<T>observer - the observer of Ts or any supertype of itprotected java.io.Closeable registerRaw(@Nonnull
Observer<? super T> observer,
boolean safeguard)
observer - the observer that wants to registersafeguard - apply safeguards around the observer?protected abstract java.io.Closeable run(Observer<? super T> observer, java.io.Closeable cancel, Action1<java.io.Closeable> setSink)
Note that the observer is not automatically detached in case of error or finish cases. Implementations should ensure proper termination.
observer - the observer to send notifications oncancel - the cancellation handler from the run() call, allows self cancellationssetSink - communicates the sink to the registering party which allows consumers
to tunnel close calls into the sink, which can stop processing