Class HTTP2Connection
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Parser.Listener
,Connection
,Connection.UpgradeTo
,WriteFlusher.Listener
- Direct Known Subclasses:
HTTP2ServerConnection
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Nested classes/interfaces inherited from interface org.eclipse.jetty.http2.parser.Parser.Listener
Parser.Listener.Adapter, Parser.Listener.Wrapper
-
Field Summary
-
Constructor Summary
ModifierConstructorDescriptionprotected
HTTP2Connection
(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, HTTP2Session session, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Performs a logical close of this connection.protected void
dispatch()
long
long
long
long
boolean
boolean
protected void
void
Callback method invoked when this connection is closed.void
onConnectionFailure
(int error, String reason) void
void
Callback method invoked when the endpoint is ready to be read.void
onFlushed
(long bytes) Invoked when aWriteFlusher
flushed bytes in a non-blocking way, as part of a - possibly larger - write.void
onGoAway
(GoAwayFrame frame) void
onHeaders
(HeadersFrame frame) boolean
Callback method invoked upon an idle timeout event.void
onOpen()
Callback method invoked when this connection is opened.void
void
onPriority
(PriorityFrame frame) void
onPushPromise
(PushPromiseFrame frame) void
onReset
(ResetFrame frame) void
onSettings
(SettingsFrame frame) void
onStreamFailure
(int streamId, int error, String reason) void
onUpgradeTo
(ByteBuffer buffer) Invoked during anupgrade
to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.void
onWindowUpdate
(WindowUpdateFrame frame) protected void
produce()
void
setUseInputDirectByteBuffers
(boolean useInputDirectByteBuffers) void
setUseOutputDirectByteBuffers
(boolean useOutputDirectByteBuffers) Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addEventListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onFillInterestedFailed, onReadTimeout, removeEventListener, setInputBufferSize, toConnectionString, toString, tryFillInterested
-
Field Details
-
LOG
protected static final org.slf4j.Logger LOG
-
-
Constructor Details
-
HTTP2Connection
protected HTTP2Connection(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, HTTP2Session session, int bufferSize)
-
-
Method Details
-
getMessagesIn
public long getMessagesIn()- Specified by:
getMessagesIn
in interfaceConnection
- Overrides:
getMessagesIn
in classAbstractConnection
-
getMessagesOut
public long getMessagesOut()- Specified by:
getMessagesOut
in interfaceConnection
- Overrides:
getMessagesOut
in classAbstractConnection
-
getBytesIn
public long getBytesIn()- Specified by:
getBytesIn
in interfaceConnection
- Overrides:
getBytesIn
in classAbstractConnection
-
getBytesOut
public long getBytesOut()- Specified by:
getBytesOut
in interfaceConnection
- Overrides:
getBytesOut
in classAbstractConnection
-
getSession
-
onUpgradeTo
Description copied from interface:Connection.UpgradeTo
Invoked during an
upgrade
to receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.- Specified by:
onUpgradeTo
in interfaceConnection.UpgradeTo
- Parameters:
buffer
- a non-null buffer of unconsumed bytes received from the upgrade-from connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes.
-
isUseInputDirectByteBuffers
public boolean isUseInputDirectByteBuffers() -
setUseInputDirectByteBuffers
public void setUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) -
isUseOutputDirectByteBuffers
public boolean isUseOutputDirectByteBuffers() -
setUseOutputDirectByteBuffers
public void setUseOutputDirectByteBuffers(boolean useOutputDirectByteBuffers) -
onOpen
public void onOpen()Description copied from interface:Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpen
in interfaceConnection
- Overrides:
onOpen
in classAbstractConnection
-
onClose
Description copied from interface:Connection
Callback method invoked when this connection is closed.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onClose
in interfaceConnection
- Overrides:
onClose
in classAbstractConnection
- Parameters:
cause
- The cause of the close or null for a normal close
-
onFillable
public void onFillable()Description copied from class:AbstractConnection
Callback method invoked when the endpoint is ready to be read.
- Specified by:
onFillable
in classAbstractConnection
- See Also:
-
onIdleExpired
public boolean onIdleExpired()Description copied from interface:Connection
Callback method invoked upon an idle timeout event.
Implementations of this method may return true to indicate that the idle timeout handling should proceed normally, typically failing the EndPoint and causing it to be closed.
When false is returned, the handling of the idle timeout event is halted immediately and the EndPoint left in the state it was before the idle timeout event.
- Specified by:
onIdleExpired
in interfaceConnection
- Overrides:
onIdleExpired
in classAbstractConnection
- Returns:
- true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.
-
offerTask
-
produce
protected void produce() -
dispatch
protected void dispatch() -
close
public void close()Description copied from interface:Connection
Performs a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPoint
but, for example, SSL connections should write the SSL close message before closing the associatedEndPoint
.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classAbstractConnection
-
onHeaders
- Specified by:
onHeaders
in interfaceParser.Listener
-
onData
- Specified by:
onData
in interfaceParser.Listener
-
onPriority
- Specified by:
onPriority
in interfaceParser.Listener
-
onReset
- Specified by:
onReset
in interfaceParser.Listener
-
onSettings
- Specified by:
onSettings
in interfaceParser.Listener
-
onPushPromise
- Specified by:
onPushPromise
in interfaceParser.Listener
-
onPing
- Specified by:
onPing
in interfaceParser.Listener
-
onGoAway
- Specified by:
onGoAway
in interfaceParser.Listener
-
onWindowUpdate
- Specified by:
onWindowUpdate
in interfaceParser.Listener
-
onStreamFailure
- Specified by:
onStreamFailure
in interfaceParser.Listener
-
onConnectionFailure
- Specified by:
onConnectionFailure
in interfaceParser.Listener
-
onFlushed
Description copied from interface:WriteFlusher.Listener
Invoked when a
WriteFlusher
flushed bytes in a non-blocking way, as part of a - possibly larger - write.This method may be invoked multiple times, for example when writing a large buffer: a first flush of bytes, then the connection became TCP congested, and a subsequent flush of bytes when the connection became writable again.
This method is never invoked concurrently, but may be invoked by different threads, so implementations may not rely on thread-local variables.
Implementations may throw an
IOException
to signal that the write should fail, for example if the implementation enforces a minimum data rate.- Specified by:
onFlushed
in interfaceWriteFlusher.Listener
- Parameters:
bytes
- the number of bytes flushed- Throws:
IOException
- if the write should fail
-