Top Description Fields Constructors Methods
org.eclipse.jetty.io.content

public Class ContentSinkSubscriber

extends Object
implements Flow.Subscriber<Content.Chunk>
Class Inheritance
All Implemented Interfaces
java.util.concurrent.Flow.Subscriber
Imports
java.nio.ByteBuffer, java.util.concurrent.Flow, java.util.concurrent.atomic.AtomicBoolean, .AtomicInteger, org.eclipse.jetty.io.Content, org.eclipse.jetty.util.Callback, org.eclipse.jetty.util.thread.Invocable

A Flow.Subscriber that wraps a Content.Sink.

Content delivered to the onNext(Content.Chunk) method is written to Content.Sink#write(boolean, ByteBuffer, Callback) and the chunk is released once the write callback is succeeded or failed.

Field Summary

Modifier and TypeField and Description
private final Callback
private final AtomicBoolean
private final AtomicInteger
private final Content.Sink
private Flow.Subscription

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
private void
private void
error(Throwable failure)

public void
onComplete()

Implements java.util.concurrent.Flow.Subscriber.onComplete.

Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription.

public void
onError(Throwable
the exception
failure
)

Implements java.util.concurrent.Flow.Subscriber.onError.

Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription.

public void
onNext(Content.Chunk
the item
chunk
)

Implements java.util.concurrent.Flow.Subscriber.onNext.

Method invoked with a Subscription's next item.

public void
onSubscribe(Flow.Subscription
a new subscription
subscription
)

Implements java.util.concurrent.Flow.Subscriber.onSubscribe.

Method invoked prior to invoking any other Subscriber methods for the given Subscription.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

callbackback to summary
private final Callback callback
callbackCompleteback to summary
private final AtomicBoolean callbackComplete
lastAndCompleteback to summary
private final AtomicInteger lastAndComplete
sinkback to summary
private final Content.Sink sink
subscriptionback to summary
private Flow.Subscription subscription

Constructor Detail

ContentSinkSubscriberback to summary
public ContentSinkSubscriber(Content.Sink sink, Callback callback)

Method Detail

completeback to summary
private void complete()
errorback to summary
private void error(Throwable failure)
onCompleteback to summary
public void onComplete()

Implements java.util.concurrent.Flow.Subscriber.onComplete.

Doc from java.util.concurrent.Flow.Subscriber.onComplete.

Method invoked when it is known that no additional Subscriber method invocations will occur for a Subscription that is not already terminated by error, after which no other Subscriber methods are invoked by the Subscription. If this method throws an exception, resulting behavior is undefined.

Annotations
@Override
onErrorback to summary
public void onError(Throwable failure)

Implements java.util.concurrent.Flow.Subscriber.onError.

Doc from java.util.concurrent.Flow.Subscriber.onError.

Method invoked upon an unrecoverable error encountered by a Publisher or Subscription, after which no other Subscriber methods are invoked by the Subscription. If this method itself throws an exception, resulting behavior is undefined.

Parameters
failure:Throwable

the exception

Annotations
@Override
onNextback to summary
public void onNext(Content.Chunk chunk)

Implements java.util.concurrent.Flow.Subscriber.onNext.

Doc from java.util.concurrent.Flow.Subscriber.onNext.

Method invoked with a Subscription's next item. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription to be cancelled.

Parameters
chunk:Content.Chunk

the item

Annotations
@Override
onSubscribeback to summary
public void onSubscribe(Flow.Subscription subscription)

Implements java.util.concurrent.Flow.Subscriber.onSubscribe.

Doc from java.util.concurrent.Flow.Subscriber.onSubscribe.

Method invoked prior to invoking any other Subscriber methods for the given Subscription. If this method throws an exception, resulting behavior is not guaranteed, but may cause the Subscription not to be established or to be cancelled.

Typically, implementations of this method invoke subscription.request to enable receiving items.

Parameters
subscription:Flow.Subscription

a new subscription

Annotations
@Override