public final class AsyncSubscription extends java.util.concurrent.atomic.AtomicLong implements org.reactivestreams.Subscription, Disposable
All methods are thread-safe.
| Constructor and Description |
|---|
AsyncSubscription() |
AsyncSubscription(Disposable resource) |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel() |
void |
dispose()
Dispose the resource, the operation should be idempotent.
|
boolean |
replaceResource(Disposable r)
Replaces the currently held resource with the given new one without disposing the old.
|
void |
request(long n) |
boolean |
setResource(Disposable r)
Sets a new resource and disposes the currently held resource.
|
boolean |
setSubscription(org.reactivestreams.Subscription s)
Sets the given subscription if there isn't any subscription held.
|
accumulateAndGet, addAndGet, compareAndSet, decrementAndGet, doubleValue, floatValue, get, getAndAccumulate, getAndAdd, getAndDecrement, getAndIncrement, getAndSet, getAndUpdate, incrementAndGet, intValue, lazySet, longValue, set, toString, updateAndGet, weakCompareAndSetpublic AsyncSubscription()
public AsyncSubscription(Disposable resource)
public void request(long n)
request in interface org.reactivestreams.Subscriptionpublic void cancel()
cancel in interface org.reactivestreams.Subscriptionpublic void dispose()
Disposabledispose in interface Disposablepublic boolean setResource(Disposable r)
r - the new resource to setreplaceResource(Disposable)public boolean replaceResource(Disposable r)
r - the new resource to setpublic boolean setSubscription(org.reactivestreams.Subscription s)
s - the first and only subscription to set