Top Description Fields Constructors Methods
org.eclipse.jetty.reactive.client.internal

public abstract Class AbstractSinglePublisher<T>

extends Object
implements Publisher<T>, Subscription
Class Inheritance
All Implemented Interfaces
org.reactivestreams.Subscription, org.reactivestreams.Publisher
Known Direct Subclasses
org.eclipse.jetty.reactive.client.internal.QueuedSinglePublisher, org.eclipse.jetty.reactive.client.internal.StringContent, org.eclipse.jetty.reactive.client.internal.AbstractEventPublisher, org.eclipse.jetty.reactive.client.internal.AbstractSingleProcessor
Type Parameters
<T>
the type of items emitted by this Publisher
Imports
java.util.Objects, org.eclipse.jetty.util.thread.AutoLock, org.reactivestreams.Publisher, .Subscriber, .Subscription, org.slf4j.Logger, .LoggerFactory

A Publisher that supports a single Subscriber at a time.

Field Summary

Modifier and TypeField and Description
private final AutoLock
private static final Logger
private Subscriber<? super T>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Implements org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.
protected void
emitOnComplete(Subscriber<? super T> subscriber)

protected void
emitOnError(Subscriber<? super T> subscriber, Throwable failure)

protected void
emitOnNext(Subscriber<? super T> subscriber, T item)

protected AutoLock
lock()

protected void
onFailure(Subscriber<? super T> subscriber, Throwable failure)

protected abstract void
onRequest(Subscriber<? super T> subscriber, long n)

public void
request(long
the strictly positive number of elements to requests to the upstream Publisher
n
)

Implements org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.
private void
public void
subscribe(Subscriber<? super T>
the Subscriber that will consume signals from this Publisher
subscriber
)

Implements org.reactivestreams.Publisher.subscribe.

Request Publisher to start streaming data.
protected Subscriber<? super T>
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

lockback to summary
private final AutoLock lock
loggerback to summary
private static final Logger logger
subscriberback to summary
private Subscriber<? super T> subscriber

Constructor Detail

AbstractSinglePublisherback to summary
public AbstractSinglePublisher()

Method Detail

cancelback to summary
public void cancel()

Implements org.reactivestreams.Subscription.cancel.

Doc from org.reactivestreams.Subscription.cancel.

Request the Publisher to stop sending data and clean up resources.

Data may still be sent to meet previously signalled demand after calling cancel.

Annotations
@Override
emitOnCompleteback to summary
protected void emitOnComplete(Subscriber<? super T> subscriber)
emitOnErrorback to summary
protected void emitOnError(Subscriber<? super T> subscriber, Throwable failure)
emitOnNextback to summary
protected void emitOnNext(Subscriber<? super T> subscriber, T item)
lockback to summary
protected AutoLock lock()
onFailureback to summary
protected void onFailure(Subscriber<? super T> subscriber, Throwable failure)
onRequestback to summary
protected abstract void onRequest(Subscriber<? super T> subscriber, long n)
requestback to summary
public void request(long n)

Implements org.reactivestreams.Subscription.request.

Doc from org.reactivestreams.Subscription.request.

No events will be sent by a Publisher until demand is signaled via this method.

It can be called however often and whenever needed—but if the outstanding cumulative demand ever becomes Long.MAX_VALUE or more, it may be treated by the Publisher as "effectively unbounded".

Whatever has been requested can be sent by the Publisher so only signal demand for what can be safely handled.

A Publisher can send less than is requested if the stream ends but then must emit either Subscriber#onError(Throwable) or Subscriber#onComplete().

Parameters
n:long

the strictly positive number of elements to requests to the upstream Publisher

Annotations
@Override
resetback to summary
private void reset()
subscribeback to summary
public void subscribe(Subscriber<? super T> subscriber)

Implements org.reactivestreams.Publisher.subscribe.

Doc from org.reactivestreams.Publisher.subscribe.

Request Publisher to start streaming data.

This is a "factory method" and can be called multiple times, each time starting a new Subscription.

Each Subscription will work for only a single Subscriber.

A Subscriber should only subscribe once to a single Publisher.

If the Publisher rejects the subscription attempt or otherwise fails it will signal the error via Subscriber#onError(Throwable).

Parameters
subscriber:Subscriber<? super T>

the Subscriber that will consume signals from this Publisher

Annotations
@Override
subscriberback to summary
protected Subscriber<? super T> subscriber()
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object.

Returns:String

a string representation of the object.

Annotations
@Override