T- the published item type
@FunctionalInterface public static interface Flow.Publisher<T>
Flow.Subscriberreceives the same items (via method
onNext) in the same order, unless drops or errors are encountered. If a Publisher encounters an error that does not allow items to be issued to a Subscriber, that Subscriber receives
onError, and then receives no further messages. Otherwise, when it is known that no further messages will be issued to it, a subscriber receives
onComplete. Publishers ensure that Subscriber method invocations for each subscription are strictly ordered in happens-before order.
Publishers may vary in policy about whether drops (failures to issue an item because of resource limitations) are treated as unrecoverable errors. Publishers may also vary about whether Subscribers receive items that were produced or available before they subscribed.
void subscribe(Flow.Subscriber<? super T> subscriber)
onErrormethod is invoked with an
IllegalStateException. Otherwise, the Subscriber's
onSubscribemethod is invoked with a new
Flow.Subscription. Subscribers may enable receiving items by invoking the
requestmethod of this Subscription, and may unsubscribe by invoking its
subscriber- the subscriber
NullPointerException- if subscriber is null
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2017, Oracle and/or its affiliates. 500 Oracle Parkway
Redwood Shores, CA 94065 USA. All rights reserved.