4 Ekim 2017 Çarşamba

Java 9 Flow.Publisher Arayüzü

Giriş
Açıklaması şöyle
Produces items for subscribers to consume. The only method is subscribe(Subscriber), whose purpose should be obvious.
Akış şöyle
- Create a Publisher and a Subscriber.
- Subscribe the subscriber with Publisher::subscribe.
- The publisher creates a Subscription and calls Subscriber::onSubscription with it so the subscriber can store the subscription.
- At some point the subscriber calls Subscription::request to request a number of items.
- The publisher starts handing items to the subscriber by calling Subscriber::onNext. It will never publish more than the requested number of items.
- The publisher might at some point be depleted or run into trouble and call Subscriber::onComplete or Subscriber::onError, respectively.
- The subscriber might either continue to request more items every now and then or cut the connection by calling Subscription::cancel.

Hiç yorum yok:

Yorum Gönder