public class PushSubscription<O> extends Object implements org.reactivestreams.Subscription, Consumer<Long>
In Reactor, a subscriber can be an Action which is both a Stream (Publisher) and a Subscriber.
Modifier and Type | Field and Description |
---|---|
protected static AtomicLongFieldUpdater<PushSubscription> |
PENDING_UPDATER |
protected long |
pendingRequestSignals |
protected Stream<O> |
publisher |
protected org.reactivestreams.Subscriber<? super O> |
subscriber |
protected static AtomicIntegerFieldUpdater<PushSubscription> |
TERMINAL_UPDATER |
protected int |
terminated |
Constructor and Description |
---|
PushSubscription(Stream<O> publisher,
org.reactivestreams.Subscriber<? super O> subscriber) |
Modifier and Type | Method and Description |
---|---|
void |
accept(Long n)
Execute the logic of the action, accepting the given parameter.
|
void |
cancel() |
boolean |
equals(Object o) |
Stream<O> |
getPublisher() |
org.reactivestreams.Subscriber<? super O> |
getSubscriber() |
int |
hashCode() |
boolean |
hasPublisher() |
boolean |
isComplete() |
boolean |
markAsDeferredStart() |
boolean |
markAsStarted() |
void |
maxCapacity(long n) |
void |
onComplete() |
void |
onError(Throwable throwable) |
void |
onNext(O ev) |
protected void |
onRequest(long n) |
long |
pendingRequestSignals() |
void |
request(long n) |
boolean |
shouldRequestPendingSignals() |
void |
start() |
boolean |
terminate() |
String |
toString() |
void |
updatePendingRequests(long n) |
static <O> PushSubscription<O> |
wrap(org.reactivestreams.Subscription subscription,
org.reactivestreams.Subscriber<? super O> errorSubscriber)
Wrap the subscription behind a push subscription to start tracking its requests
|
protected final org.reactivestreams.Subscriber<? super O> subscriber
protected volatile int terminated
protected static final AtomicIntegerFieldUpdater<PushSubscription> TERMINAL_UPDATER
protected volatile long pendingRequestSignals
protected static final AtomicLongFieldUpdater<PushSubscription> PENDING_UPDATER
public static <O> PushSubscription<O> wrap(org.reactivestreams.Subscription subscription, org.reactivestreams.Subscriber<? super O> errorSubscriber)
subscription
- the subscription to wrappublic final void accept(Long n)
Consumer
public void request(long n)
request
in interface org.reactivestreams.Subscription
public void cancel()
cancel
in interface org.reactivestreams.Subscription
public boolean terminate()
public void onComplete()
public void onNext(O ev)
public void onError(Throwable throwable)
public boolean hasPublisher()
public void updatePendingRequests(long n)
public void start()
public final boolean markAsStarted()
public final boolean markAsDeferredStart()
protected void onRequest(long n)
public final org.reactivestreams.Subscriber<? super O> getSubscriber()
public boolean isComplete()
public final long pendingRequestSignals()
public void maxCapacity(long n)
public boolean shouldRequestPendingSignals()
Copyright © 2017. All rights reserved.