- Enclosing class:
public static interface Flow.Subscription
Message control linking a
Flow.Subscriber. Subscribers receive items only when requested, and may cancel at any time. The methods in this interface are intended to be invoked only by their Subscribers; usages in other contexts have undefined effects.
requestvoid request(long n)Adds the given number
nof items to the current unfulfilled demand for this subscription. If
nis less than or equal to zero, the Subscriber will receive an
onErrorsignal with an
IllegalArgumentExceptionargument. Otherwise, the Subscriber will receive up to
onNextinvocations (or fewer if terminated).
n- the increment of demand; a value of
Long.MAX_VALUEmay be considered as effectively unbounded
cancelvoid 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