public final class AsyncSubscription extends 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 |
isDisposed()
Returns true if this resource has been disposed.
|
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.
|
void |
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, weakCompareAndSet
byteValue, shortValue
public AsyncSubscription()
public AsyncSubscription(Disposable resource)
public void request(long n)
request
in interface org.reactivestreams.Subscription
public void cancel()
cancel
in interface org.reactivestreams.Subscription
public void dispose()
Disposable
dispose
in interface Disposable
public boolean isDisposed()
Disposable
isDisposed
in interface Disposable
public boolean setResource(Disposable r)
r
- the new resource to setreplaceResource(Disposable)
public boolean replaceResource(Disposable r)
r
- the new resource to setpublic void setSubscription(org.reactivestreams.Subscription s)
s
- the first and only subscription to setCopyright © 2019. All rights reserved.