public class ConcurrentSubscription extends java.lang.Object implements PublisherSource.Subscription
PublisherSource.Subscription
methods and preserves the
Reactive Streams, 2.7
rule when there is a possibility of concurrency.IGNORE_CANCEL
Modifier | Constructor and Description |
---|---|
protected |
ConcurrentSubscription(PublisherSource.Subscription subscription)
New instance.
|
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Sends a hint to the producer of the associated asynchronous execution that the consumer related to this
Cancellable is not interested in the outcome of the execution. |
void |
request(long n)
Requests
n more items from the associated PublisherSource for the associated
PublisherSource.Subscriber . |
static ConcurrentSubscription |
wrap(PublisherSource.Subscription subscription)
Wrap a
PublisherSource.Subscription to make it thread safe when concurrent access may exists between
PublisherSource.Subscription.request(long) and Cancellable.cancel() . |
protected ConcurrentSubscription(PublisherSource.Subscription subscription)
subscription
- PublisherSource.Subscription
to wrap.public static ConcurrentSubscription wrap(PublisherSource.Subscription subscription)
PublisherSource.Subscription
to make it thread safe when concurrent access may exists between
PublisherSource.Subscription.request(long)
and Cancellable.cancel()
.subscription
- The subscription to wrap.PublisherSource.Subscription
that will enforce the threading constraints in a concurrent environment.public void request(long n)
PublisherSource.Subscription
n
more items from the associated PublisherSource
for the associated
PublisherSource.Subscriber
.
See Reactive Streams specifications for the rules about how and when this method will be invoked.
request
in interface PublisherSource.Subscription
n
- Number of items to request.public void cancel()
Cancellable
Cancellable
is not interested in the outcome of the execution.cancel
in interface Cancellable