Top Description Fields Constructors Methods
org.eclipse.jetty.ee10.servlet

pack-priv Class BlockingContentProducer

extends Object
implements ContentProducer
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.ee10.servlet.ContentProducer
Imports
org.eclipse.jetty.io.Content, org.slf4j.Logger, .LoggerFactory

Blocking implementation of ContentProducer. Calling ContentProducer#nextChunk() will block when there is no available content but will never return null.

Field Summary

Modifier and TypeField and Description
private final AsyncContentProducer
private final AsyncContentProducer.LockedSemaphore
private static final Logger

Constructor Summary

AccessConstructor and Description
pack-priv
BlockingContentProducer(AsyncContentProducer
The AsyncContentProducer to block against.
asyncContentProducer
)

Method Summary

Modifier and TypeMethod and Description
public int
available()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.available.

Get the byte count that can immediately be read from this ContentProducer instance or the underlying Content.Source.

public void
checkMinDataRate()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.checkMinDataRate.

Check if the current data rate consumption is above the minimal rate.

public boolean
consumeAvailable()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.consumeAvailable.

Fail all content currently available in this ContentProducer instance as well as in the underlying Content.Source.

public long
getBytesArrived()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.getBytesArrived.

Get the byte count produced by the underlying Content.Source.

public boolean
hasChunk()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.hasChunk.

Check if this ContentProducer instance contains some content chunk without querying the underlying Content.Source.

public boolean
isError()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.isError.

Check if the underlying Content.Source reached an error content.

public boolean
isReady()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.isReady.

Check if this ContentProducer instance has some content that can be read without blocking.

public Content.Chunk
nextChunk()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.nextChunk.

Get the next content chunk that can be read from or that describes the terminal condition that was reached (error, eof).

public boolean
onContentProducible()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.onContentProducible.

Wake up the thread that is waiting for the next content.

public void
reclaim(Content.Chunk chunk)

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.reclaim.

Free up the content by calling Content.Chunk#release() on it and updating this instance's internal state.

public void
recycle()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.recycle.

A recycled ContentProducer will only produce special content with a non-null error until reopen() is called.

public void
reopen()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.reopen.

Reset all internal state, making this is instance logically equivalent to a freshly allocated one.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

_asyncContentProducerback to summary
private final AsyncContentProducer _asyncContentProducer
_semaphoreback to summary
private final AsyncContentProducer.LockedSemaphore _semaphore
LOGback to summary
private static final Logger LOG

Constructor Detail

BlockingContentProducerback to summary
pack-priv BlockingContentProducer(AsyncContentProducer asyncContentProducer)
Parameters
asyncContentProducer:AsyncContentProducer

The AsyncContentProducer to block against.

Method Detail

availableback to summary
public int available()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.available.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.available.

Get the byte count that can immediately be read from this ContentProducer instance or the underlying Content.Source. This call is always non-blocking. Doesn't change state.

Returns:int

the available byte count.

Annotations
@Override
checkMinDataRateback to summary
public void checkMinDataRate()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.checkMinDataRate.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.checkMinDataRate.

Check if the current data rate consumption is above the minimal rate. Abort the channel, fail the content currently available and throw a BadMessageException(REQUEST_TIMEOUT_408) if the check fails.

Annotations
@Override
consumeAvailableback to summary
public boolean consumeAvailable()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.consumeAvailable.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.consumeAvailable.

Fail all content currently available in this ContentProducer instance as well as in the underlying Content.Source. This call is always non-blocking. Doesn't change state.

Returns:boolean

true if EOF was reached.

Annotations
@Override
getBytesArrivedback to summary
public long getBytesArrived()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.getBytesArrived.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.getBytesArrived.

Get the byte count produced by the underlying Content.Source. This call is always non-blocking. Doesn't change state.

Returns:long

the byte count produced by the underlying Content.Source.

Annotations
@Override
hasChunkback to summary
public boolean hasChunk()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.hasChunk.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.hasChunk.

Check if this ContentProducer instance contains some content chunk without querying the underlying Content.Source. This call is always non-blocking. Doesn't change state. Doesn't query the HttpChannel.

Returns:boolean

true if this ContentProducer instance contains content, false otherwise.

Annotations
@Override
isErrorback to summary
public boolean isError()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.isError.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.isError.

Check if the underlying Content.Source reached an error content. This call is always non-blocking. Doesn't change state. Doesn't query the HttpChannel.

Returns:boolean

true if the underlying Content.Source reached an error content, false otherwise.

Annotations
@Override
isReadyback to summary
public boolean isReady()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.isReady.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.isReady.

Check if this ContentProducer instance has some content that can be read without blocking. If there is some, the next call to nextChunk() will not block. If there isn't any and the implementation does not block, this method will trigger a jakarta.servlet.ReadListener callback once some content is available. This call is always non-blocking.

Returns:boolean

true if some content is immediately available, false otherwise.

Annotations
@Override
nextChunkback to summary
public Content.Chunk nextChunk()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.nextChunk.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.nextChunk.

Get the next content chunk that can be read from or that describes the terminal condition that was reached (error, eof). This call may or may not block until some content is available, depending on the implementation. After this call, state can be either of UNREADY or IDLE.

Returns:Content.Chunk

the next content chunk that can be read from or null if the implementation does not block and has no available content.

Annotations
@Override
onContentProducibleback to summary
public boolean onContentProducible()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.onContentProducible.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.onContentProducible.

Wake up the thread that is waiting for the next content. After this call, state can be READY.

Returns:boolean

true if the thread has to be rescheduled, false otherwise.

Annotations
@Override
reclaimback to summary
public void reclaim(Content.Chunk chunk)

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.reclaim.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.reclaim.

Free up the content by calling Content.Chunk#release() on it and updating this instance's internal state.

Annotations
@Override
recycleback to summary
public void recycle()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.recycle.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.recycle.

A recycled ContentProducer will only produce special content with a non-null error until reopen() is called.

Annotations
@Override
reopenback to summary
public void reopen()

Implements org.eclipse.jetty.ee10.servlet.ContentProducer.reopen.

Doc from org.eclipse.jetty.ee10.servlet.ContentProducer.reopen.

Reset all internal state, making this is instance logically equivalent to a freshly allocated one.

Annotations
@Override