APIdia Launch Partner
Top Description Fields Constructors Methods
jdk.internal.net.http.common

public Class SubscriptionBase

extends Object
implements Subscription
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Flow.Subscription
Imports
java.util.concurrent.Flow, java.util.concurrent.atomic.AtomicBoolean, java.util.function.Consumer

Maintains subscription counter and provides primitives for: - accessing window - reducing window when delivering items externally - resume delivery when window was zero previously

Field Summary

Modifier and TypeField and Description
pack-priv final Runnable
pack-priv final AtomicBoolean
pack-priv final Demand
pack-priv final Consumer<Throwable>
pack-priv final SequentialScheduler

Constructor Summary

AccessConstructor and Description
public
public
SubscriptionBase(SequentialScheduler scheduler, Runnable cancelAction, Consumer<Throwable> onError)

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Implements java.util.concurrent.Flow.Subscription.cancel.

Causes the Subscriber to (eventually) stop receiving messages.

public void
request(long n)

Implements java.util.concurrent.Flow.Subscription.request.

Adds the given number n of items to the current unfulfilled demand for this subscription.

public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
tryDecrement()

Returns true if the window was reduced by 1.

public long
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

cancelActionback to summary
pack-priv final Runnable cancelAction
cancelledback to summary
pack-priv final AtomicBoolean cancelled
demandback to summary
pack-priv final Demand demand
onErrorback to summary
pack-priv final Consumer<Throwable> onError
schedulerback to summary
pack-priv final SequentialScheduler scheduler

Constructor Detail

SubscriptionBaseback to summary
public SubscriptionBase(SequentialScheduler scheduler, Runnable cancelAction)
SubscriptionBaseback to summary
public SubscriptionBase(SequentialScheduler scheduler, Runnable cancelAction, Consumer<Throwable> onError)

Method Detail

cancelback to summary
public void cancel()

Implements java.util.concurrent.Flow.Subscription.cancel.

Doc from java.util.concurrent.Flow.Subscription.cancel.

Causes the Subscriber to (eventually) stop receiving messages. Implementation is best-effort -- additional messages may be received after invoking this method. A cancelled subscription need not ever receive an onComplete or onError signal.

Annotations
@Override
requestback to summary
public void request(long n)

Implements java.util.concurrent.Flow.Subscription.request.

Doc from java.util.concurrent.Flow.Subscription.request.

Adds the given number n of items to the current unfulfilled demand for this subscription. If n is less than or equal to zero, the Subscriber will receive an onError signal with an IllegalArgumentException argument. Otherwise, the Subscriber will receive up to n additional onNext invocations (or fewer if terminated).

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Annotations
@Override
tryDecrementback to summary
public boolean tryDecrement()

Returns true if the window was reduced by 1. In that case items must be supplied to subscribers and the scheduler run externally. If the window could not be reduced by 1, then false is returned and the scheduler will run later when the window is updated.

windowback to summary
public long window()