T
- the upstream value typeR
- the downstream value typepublic abstract class BasicFuseableConditionalSubscriber<T,R> extends Object implements ConditionalSubscriber<T>, QueueSubscription<R>
Modifier and Type | Field and Description |
---|---|
protected ConditionalSubscriber<? super R> |
actual
The downstream subscriber.
|
protected boolean |
done
Flag indicating no further onXXX event should be accepted.
|
protected QueueSubscription<T> |
qs
The upstream's QueueSubscription if not null.
|
protected org.reactivestreams.Subscription |
s
The upstream subscription.
|
protected int |
sourceMode
Holds the established fusion mode of the upstream.
|
Constructor and Description |
---|
BasicFuseableConditionalSubscriber(ConditionalSubscriber<? super R> actual)
Construct a BasicFuseableSubscriber by wrapping the given subscriber.
|
Modifier and Type | Method and Description |
---|---|
protected void |
afterDownstream()
Override this to perform actions after the call to
actual.onSubscribe(this) happened. |
protected boolean |
beforeDownstream()
Override this to perform actions before the call
actual.onSubscribe(this) happens. |
void |
cancel() |
void |
clear()
Removes all enqueued items from this queue.
|
protected void |
fail(Throwable t)
Rethrows the throwable if it is a fatal exception or calls
onError(Throwable) . |
boolean |
isEmpty()
Returns true if the queue is empty.
|
boolean |
offer(R e)
Atomically enqueue a single.
|
boolean |
offer(R v1,
R v2)
Atomically enqueue two values.
|
void |
onComplete() |
void |
onError(Throwable t) |
void |
onSubscribe(org.reactivestreams.Subscription s)
Implementors of this method should make sure everything that needs
to be visible in
Subscriber.onNext(Object) is established before
calling Subscription.request(long) . |
void |
request(long n) |
protected int |
transitiveBoundaryFusion(int mode)
Calls the upstream's QueueSubscription.requestFusion with the mode and
saves the established mode in
sourceMode if that mode doesn't
have the QueueFuseable.BOUNDARY flag set. |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
tryOnNext
requestFusion
poll
protected final ConditionalSubscriber<? super R> actual
protected org.reactivestreams.Subscription s
protected QueueSubscription<T> qs
protected boolean done
protected int sourceMode
public BasicFuseableConditionalSubscriber(ConditionalSubscriber<? super R> actual)
actual
- the subscriber, not null (not verified)public final void onSubscribe(org.reactivestreams.Subscription s)
FlowableSubscriber
Subscriber.onNext(Object)
is established before
calling Subscription.request(long)
. In practice this means
no initialization should happen after the request()
call and
additional behavior is thread safe in respect to onNext
.
onSubscribe
in interface FlowableSubscriber<T>
onSubscribe
in interface org.reactivestreams.Subscriber<T>
protected boolean beforeDownstream()
actual.onSubscribe(this)
happens.protected void afterDownstream()
actual.onSubscribe(this)
happened.public void onError(Throwable t)
onError
in interface org.reactivestreams.Subscriber<T>
protected final void fail(Throwable t)
onError(Throwable)
.t
- the throwable to rethrow or signal to the actual subscriberpublic void onComplete()
onComplete
in interface org.reactivestreams.Subscriber<T>
protected final int transitiveBoundaryFusion(int mode)
sourceMode
if that mode doesn't
have the QueueFuseable.BOUNDARY
flag set.
If the upstream doesn't support fusion (qs
is null), the method
returns QueueFuseable.NONE
.
mode
- the fusion mode requestedpublic void request(long n)
request
in interface org.reactivestreams.Subscription
public void cancel()
cancel
in interface org.reactivestreams.Subscription
public boolean isEmpty()
SimpleQueue
Note however that due to potential fused functions in SimpleQueue.poll()
it is possible this method returns false but then poll() returns null
because the fused function swallowed the available item(s).
isEmpty
in interface SimpleQueue<R>
public void clear()
SimpleQueue
clear
in interface SimpleQueue<R>
public final boolean offer(R e)
SimpleQueue
offer
in interface SimpleQueue<R>
e
- the value to enqueue, not nullpublic final boolean offer(R v1, R v2)
SimpleQueue
offer
in interface SimpleQueue<R>
v1
- the first value to enqueue, not nullv2
- the second value to enqueue, not nullCopyright © 2018 JBoss by Red Hat. All rights reserved.