Top Inners Fields Constructors Methods
org.eclipse.jetty.http2

public abstract Class HTTP2StreamEndPoint

extends Object
implements EndPoint
Class Inheritance
All Implemented Interfaces
org.eclipse.jetty.io.EndPoint, java.io.Closeable, java.lang.AutoCloseable
Imports
java.io.IOException, java.net.InetSocketAddress, .SocketAddress, java.nio.BufferOverflowException, .ByteBuffer, java.nio.channels.ReadPendingException, .WritePendingException, java.util.concurrent.atomic.AtomicBoolean, .AtomicReference, org.eclipse.jetty.http2.api.Stream, org.eclipse.jetty.http2.frames.DataFrame, org.eclipse.jetty.io.Connection, .EndPoint, .EofException, org.eclipse.jetty.util.BufferUtil, .Callback, .IO, org.eclipse.jetty.util.thread.Invocable, org.slf4j.Logger, .LoggerFactory

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class

Field Summary

Modifier and TypeField and Description
private final AtomicBoolean
private Connection
private final long
private final AtomicReference<Stream.Data>
private final AtomicBoolean
private final AtomicReference<Throwable>
private static final Logger
private final AtomicReference<Callback>
private final HTTP2Stream
private final AtomicReference<HTTP2StreamEndPoint.WriteState>

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
close(Throwable
the reason for the close or null
cause
)

Implements org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint, passing a cause

private ByteBuffer
coalesce(ByteBuffer[] buffers)

public int
fill(ByteBuffer
The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.
sink
)

Overrides default org.eclipse.jetty.io.EndPoint.fill.

Fill the passed buffer with data from this endpoint.

private int
public void
fillInterested(Callback
the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
)

Implements org.eclipse.jetty.io.EndPoint.fillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

public boolean
flush(ByteBuffer...
the buffers to flush
buffers
)

Overrides default org.eclipse.jetty.io.EndPoint.flush.

Flush data from the passed header/buffer to this endpoint.

public Connection
public long
public long
getIdleTimeout()

Implements org.eclipse.jetty.io.EndPoint.getIdleTimeout.

Get the max idle time in ms.

public InetSocketAddress
public SocketAddress
public InetSocketAddress
public SocketAddress
public Object
public boolean
public boolean
isInputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isInputShutdown.

Test if the input is shutdown.

public boolean
public boolean
isOutputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Test if output is shutdown.

public void
onClose(Throwable
The reason for the close, or null if a normal close.
cause
)

Implements org.eclipse.jetty.io.EndPoint.onClose.

Callback method invoked when this EndPoint is closed.

public void
onOpen()

Implements org.eclipse.jetty.io.EndPoint.onOpen.

Callback method invoked when this EndPoint is opened.

private void
private void
private void
protected void
protected void
private long
remaining(ByteBuffer... buffers)

public void
setConnection(Connection
the Connection associated with this EndPoint
connection
)

Implements org.eclipse.jetty.io.EndPoint.setConnection.

public void
setIdleTimeout(long
the idle timeout in MS. Timeout <= 0 implies an infinite timeout
idleTimeout
)

Implements org.eclipse.jetty.io.EndPoint.setIdleTimeout.

Set the idle timeout.

public void
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

public boolean
tryFillInterested(Callback
the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
)

Implements org.eclipse.jetty.io.EndPoint.tryFillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

public void
upgrade(Connection
the connection to upgrade to
newConnection
)

Implements org.eclipse.jetty.io.EndPoint.upgrade.

Upgrades this EndPoint from the current connection to the given new connection.

public void
write(Callback
the callback to call when an error occurs or the write completed. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.
callback
,
ByteBuffer...
one or more ByteBuffers that will be flushed.
buffers
)

Overrides default org.eclipse.jetty.io.EndPoint.write.

Writes the given buffers via flush(ByteBuffer...) and invokes callback methods when either all the data has been flushed or an error occurs.

private void
writeFailure(Throwable failure, Callback callback)

private void
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

closedback to summary
private final AtomicBoolean closed
connectionback to summary
private Connection connection
createdback to summary
private final long created
databack to summary
private final AtomicReference<Stream.Data> data
eofback to summary
private final AtomicBoolean eof
failureback to summary
private final AtomicReference<Throwable> failure
LOGback to summary
private static final Logger LOG
readCallbackback to summary
private final AtomicReference<Callback> readCallback
streamback to summary
private final HTTP2Stream stream
writeStateback to summary
private final AtomicReference<HTTP2StreamEndPoint.WriteState> writeState

Constructor Detail

HTTP2StreamEndPointback to summary
public HTTP2StreamEndPoint(HTTP2Stream stream)

Method Detail

closeback to summary
public void close(Throwable cause)

Implements org.eclipse.jetty.io.EndPoint.close.

Doc from org.eclipse.jetty.io.EndPoint.close.

Close any backing stream associated with the endpoint, passing a cause

Parameters
cause:Throwable

the reason for the close or null

Annotations
@Override
coalesceback to summary
private ByteBuffer coalesce(ByteBuffer[] buffers)
fillback to summary
public int fill(ByteBuffer sink) throws IOException

Overrides default org.eclipse.jetty.io.EndPoint.fill.

Doc from org.eclipse.jetty.io.EndPoint.fill.

Fill the passed buffer with data from this endpoint. The bytes are appended to any data already in the buffer by writing from the buffers limit up to it's capacity. The limit is updated to include the filled bytes.

Parameters
sink:ByteBuffer

The buffer to fill. The position and limit are modified during the fill. After the operation, the position is unchanged and the limit is increased to reflect the new data filled.

Returns:int

an int value indicating the number of bytes filled or -1 if EOF is read or the input is shutdown.

Annotations
@Override
Exceptions
IOException:
if the endpoint is closed.
fillFromDataback to summary
private int fillFromData(Stream.Data data, ByteBuffer sink)
fillInterestedback to summary
public void fillInterested(Callback callback) throws ReadPendingException

Implements org.eclipse.jetty.io.EndPoint.fillInterested.

Doc from org.eclipse.jetty.io.EndPoint.fillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

Parameters
callback:Callback

the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

Annotations
@Override
Exceptions
ReadPendingException:
if another read operation is concurrent.
flushback to summary
public boolean flush(ByteBuffer... buffers) throws IOException

Overrides default org.eclipse.jetty.io.EndPoint.flush.

Doc from org.eclipse.jetty.io.EndPoint.flush.

Flush data from the passed header/buffer to this endpoint. As many bytes as can be consumed are taken from the header/buffer position up until the buffer limit. The header/buffers position is updated to indicate how many bytes have been consumed.

Parameters
buffers:ByteBuffer[]

the buffers to flush

Returns:boolean

True IFF all the buffers have been consumed and the endpoint has flushed the data to its destination (ie is not buffering any data).

Annotations
@Override
Exceptions
IOException:
If the endpoint is closed or output is shutdown.
getConnectionback to summary
public Connection getConnection()

Implements org.eclipse.jetty.io.EndPoint.getConnection.

Returns:Connection

Doc from org.eclipse.jetty.io.EndPoint.getConnection.

the Connection associated with this EndPoint

Annotations
@Override
getCreatedTimeStampback to summary
public long getCreatedTimeStamp()

Implements org.eclipse.jetty.io.EndPoint.getCreatedTimeStamp.

Returns:long

Doc from org.eclipse.jetty.io.EndPoint.getCreatedTimeStamp.

the epoch time in milliseconds when this EndPoint was created

Annotations
@Override
getIdleTimeoutback to summary
public long getIdleTimeout()

Implements org.eclipse.jetty.io.EndPoint.getIdleTimeout.

Doc from org.eclipse.jetty.io.EndPoint.getIdleTimeout.

Get the max idle time in ms.

The max idle time is the time the endpoint can be idle before extraordinary handling takes place.

Returns:long

the max idle time in ms or if ms <= 0 implies an infinite timeout

Annotations
@Override
getLocalAddressback to summary
public InetSocketAddress getLocalAddress()

Implements org.eclipse.jetty.io.EndPoint.getLocalAddress.

Returns:InetSocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getLocalAddress.

The local InetSocketAddress to which this EndPoint is bound, or null if this EndPoint is not bound to a Socket address.

Annotations
@Override
getLocalSocketAddressback to summary
public SocketAddress getLocalSocketAddress()

Overrides default org.eclipse.jetty.io.EndPoint.getLocalSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getLocalSocketAddress.

the local SocketAddress to which this EndPoint is bound or null if this EndPoint is not bound to a Socket address.

Annotations
@Override
getRemoteAddressback to summary
public InetSocketAddress getRemoteAddress()

Implements org.eclipse.jetty.io.EndPoint.getRemoteAddress.

Returns:InetSocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getRemoteAddress.

The remote InetSocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.

Annotations
@Override
getRemoteSocketAddressback to summary
public SocketAddress getRemoteSocketAddress()

Overrides default org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

Returns:SocketAddress

Doc from org.eclipse.jetty.io.EndPoint.getRemoteSocketAddress.

The remote SocketAddress to which this EndPoint is connected, or null if this EndPoint is not connected to a Socket address.

Annotations
@Override
getTransportback to summary
public Object getTransport()

Implements org.eclipse.jetty.io.EndPoint.getTransport.

Returns:Object

Doc from org.eclipse.jetty.io.EndPoint.getTransport.

The underlying transport object (socket, channel, etc.)

Annotations
@Override
isFillInterestedback to summary
public boolean isFillInterested()

Implements org.eclipse.jetty.io.EndPoint.isFillInterested.

Returns:boolean

Doc from org.eclipse.jetty.io.EndPoint.isFillInterested.

whether fillInterested(Callback) has been called, but fill(ByteBuffer) has not yet been called

Annotations
@Override
isInputShutdownback to summary
public boolean isInputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isInputShutdown.

Doc from org.eclipse.jetty.io.EndPoint.isInputShutdown.

Test if the input is shutdown. The input is shutdown if an EOF has been read while doing a fill(ByteBuffer). Once the input is shutdown, all calls to fill(ByteBuffer) will return -1, until such time as the end point is close, when they will return EofException.

Returns:boolean

True if the input is shutdown or the endpoint is closed.

Annotations
@Override
isOpenback to summary
public boolean isOpen()

Implements org.eclipse.jetty.io.EndPoint.isOpen.

Returns:boolean

Doc from org.eclipse.jetty.io.EndPoint.isOpen.

whether this EndPoint is open

Annotations
@Override
isOutputShutdownback to summary
public boolean isOutputShutdown()

Implements org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Doc from org.eclipse.jetty.io.EndPoint.isOutputShutdown.

Test if output is shutdown. The output is shutdown by a call to shutdownOutput() or close().

Returns:boolean

true if the output is shutdown or the endpoint is closed.

Annotations
@Override
onCloseback to summary
public void onClose(Throwable cause)

Implements org.eclipse.jetty.io.EndPoint.onClose.

Doc from org.eclipse.jetty.io.EndPoint.onClose.

Callback method invoked when this EndPoint is closed.

Parameters
cause:Throwable

The reason for the close, or null if a normal close.

Annotations
@Override
onOpenback to summary
public void onOpen()

Implements org.eclipse.jetty.io.EndPoint.onOpen.

Doc from org.eclipse.jetty.io.EndPoint.onOpen.

Callback method invoked when this EndPoint is opened.

Annotations
@Override
oshutFailureback to summary
private void oshutFailure(Throwable failure)
oshutSuccessback to summary
private void oshutSuccess()
processback to summary
private void process()
processDataAvailableback to summary
protected void processDataAvailable()
processFailureback to summary
protected void processFailure(Throwable failure)
remainingback to summary
private long remaining(ByteBuffer... buffers)
setConnectionback to summary
public void setConnection(Connection connection)

Implements org.eclipse.jetty.io.EndPoint.setConnection.

Parameters
connection:Connection

Doc from org.eclipse.jetty.io.EndPoint.setConnection.

the Connection associated with this EndPoint

Annotations
@Override
setIdleTimeoutback to summary
public void setIdleTimeout(long idleTimeout)

Implements org.eclipse.jetty.io.EndPoint.setIdleTimeout.

Doc from org.eclipse.jetty.io.EndPoint.setIdleTimeout.

Set the idle timeout.

Parameters
idleTimeout:long

the idle timeout in MS. Timeout <= 0 implies an infinite timeout

Annotations
@Override
shutdownOutputback to summary
public void shutdownOutput()

Implements org.eclipse.jetty.io.EndPoint.shutdownOutput.

Doc from org.eclipse.jetty.io.EndPoint.shutdownOutput.

Shutdown the output.

This call indicates that no more data will be sent on this endpoint that that the remote end should read an EOF once all previously sent data has been consumed. Shutdown may be done either at the TCP/IP level, as a protocol exchange (Eg TLS close handshake) or both.

If the endpoint has isInputShutdown() true, then this call has the same effect as close().

Annotations
@Override
toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
tryFillInterestedback to summary
public boolean tryFillInterested(Callback callback)

Implements org.eclipse.jetty.io.EndPoint.tryFillInterested.

Doc from org.eclipse.jetty.io.EndPoint.tryFillInterested.

Requests callback methods to be invoked when a call to fill(ByteBuffer) would return data or EOF.

Parameters
callback:Callback

the callback to call when an error occurs or we are readable. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

Returns:boolean

true if set

Annotations
@Override
upgradeback to summary
public void upgrade(Connection newConnection)

Implements org.eclipse.jetty.io.EndPoint.upgrade.

Doc from org.eclipse.jetty.io.EndPoint.upgrade.

Upgrades this EndPoint from the current connection to the given new connection.

Closes the current connection, links this EndPoint to the new connection and then opens the new connection.

If the current connection is an instance of Connection.UpgradeFrom then a buffer of unconsumed bytes is requested. If the buffer of unconsumed bytes is non-null and non-empty, then the new connection is tested: if it is an instance of Connection.UpgradeTo, then the unconsumed buffer is passed to the new connection; otherwise, an exception is thrown since there are unconsumed bytes that cannot be consumed by the new connection.

Parameters
newConnection:Connection

the connection to upgrade to

Annotations
@Override
writeback to summary
public void write(Callback callback, ByteBuffer... buffers) throws WritePendingException

Overrides default org.eclipse.jetty.io.EndPoint.write.

Doc from org.eclipse.jetty.io.EndPoint.write.

Writes the given buffers via flush(ByteBuffer...) and invokes callback methods when either all the data has been flushed or an error occurs.

Parameters
callback:Callback

the callback to call when an error occurs or the write completed. The callback may implement the Invocable interface to self declare its blocking status. Non-blocking callbacks may be called more efficiently without dispatch delays.

buffers:ByteBuffer[]

one or more ByteBuffers that will be flushed.

Annotations
@Override
Exceptions
WritePendingException:
if another write operation is concurrent.
writeFailureback to summary
private void writeFailure(Throwable failure, Callback callback)
writeSuccessback to summary
private void writeSuccess(Callback callback)
org.eclipse.jetty.http2 back to summary

private Class HTTP2StreamEndPoint.WriteState

extends Object
Class Inheritance

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static enum

Field Summary

Modifier and TypeField and Description
private final Throwable
public static final HTTP2StreamEndPoint.WriteState
public static final HTTP2StreamEndPoint.WriteState
public static final HTTP2StreamEndPoint.WriteState
public static final HTTP2StreamEndPoint.WriteState
private final HTTP2StreamEndPoint.WriteState.State

Constructor Summary

AccessConstructor and Description
private
private

Method Summary

Modifier and TypeMethod and Description
public String
toString()

Overrides java.lang.Object.toString.

Returns a string representation of the object.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAllwaitwaitwait

Field Detail

failureback to summary
private final Throwable failure
IDLEback to summary
public static final HTTP2StreamEndPoint.WriteState IDLE
OSHUTback to summary
public static final HTTP2StreamEndPoint.WriteState OSHUT
OSHUTTINGback to summary
public static final HTTP2StreamEndPoint.WriteState OSHUTTING
PENDINGback to summary
public static final HTTP2StreamEndPoint.WriteState PENDING
stateback to summary
private final HTTP2StreamEndPoint.WriteState.State state

Constructor Detail

WriteStateback to summary
private WriteState(HTTP2StreamEndPoint.WriteState.State state)
WriteStateback to summary
private WriteState(HTTP2StreamEndPoint.WriteState.State state, Throwable failure)

Method Detail

toStringback to summary
public String toString()

Overrides java.lang.Object.toString.

Doc from java.lang.Object.toString.

Returns a string representation of the object. Satisfying this method's contract implies a non-null result must be returned.

Returns:String

a string representation of the object

Annotations
@Override
org.eclipse.jetty.http2 back to summary

private final Enum HTTP2StreamEndPoint.WriteState.State

extends Enum<HTTP2StreamEndPoint.WriteState.State>
Class Inheritance

Field Summary

Modifier and TypeField and Description
public static final HTTP2StreamEndPoint.WriteState.State
public static final HTTP2StreamEndPoint.WriteState.State
public static final HTTP2StreamEndPoint.WriteState.State
public static final HTTP2StreamEndPoint.WriteState.State
public static final HTTP2StreamEndPoint.WriteState.State

Constructor Summary

AccessConstructor and Description
private

Field Detail

FAILEDback to summary
public static final HTTP2StreamEndPoint.WriteState.State FAILED
IDLEback to summary
public static final HTTP2StreamEndPoint.WriteState.State IDLE
OSHUTback to summary
public static final HTTP2StreamEndPoint.WriteState.State OSHUT
OSHUTTINGback to summary
public static final HTTP2StreamEndPoint.WriteState.State OSHUTTING
PENDINGback to summary
public static final HTTP2StreamEndPoint.WriteState.State PENDING

Constructor Detail

Stateback to summary
private State()

Method Detail

valueOfback to summary
public static HTTP2StreamEndPoint.WriteState.State valueOf(String name)
valuesback to summary
public static HTTP2StreamEndPoint.WriteState.State[] values()