Class SyncSubscriber<T>
- java.lang.Object
-
- org.reactivestreams.example.unicast.SyncSubscriber<T>
-
- All Implemented Interfaces:
org.reactivestreams.Subscriber<T>
public abstract class SyncSubscriber<T> extends java.lang.Object implements org.reactivestreams.Subscriber<T>
SyncSubscriber is an implementation of Reactive Streams `Subscriber`, it runs synchronously (on the Publisher's thread) and requests one element at a time and invokes a user-defined method to process each element. NOTE: The code below uses a lot of try-catches to show the reader where exceptions can be expected, and where they are forbidden.
-
-
Constructor Summary
Constructors Constructor Description SyncSubscriber()
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description void
onComplete()
void
onError(java.lang.Throwable t)
void
onNext(T element)
void
onSubscribe(org.reactivestreams.Subscription s)
protected abstract boolean
whenNext(T element)
-
-
-
Constructor Detail
-
SyncSubscriber
public SyncSubscriber()
-
-
Method Detail
-
onSubscribe
public void onSubscribe(org.reactivestreams.Subscription s)
- Specified by:
onSubscribe
in interfaceorg.reactivestreams.Subscriber<T>
-
onNext
public void onNext(T element)
- Specified by:
onNext
in interfaceorg.reactivestreams.Subscriber<T>
-
onError
public void onError(java.lang.Throwable t)
- Specified by:
onError
in interfaceorg.reactivestreams.Subscriber<T>
-
onComplete
public void onComplete()
- Specified by:
onComplete
in interfaceorg.reactivestreams.Subscriber<T>
-
-