Class HTTP2Connection
- All Implemented Interfaces:
Closeable,AutoCloseable,Parser.Listener,Connection,Connection.UpgradeTo,WriteFlusher.Listener
- Direct Known Subclasses:
HTTP2ServerConnection
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeToNested classes/interfaces inherited from interface org.eclipse.jetty.http2.parser.Parser.Listener
Parser.Listener.Adapter, Parser.Listener.Wrapper -
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedHTTP2Connection(RetainableByteBufferPool retainableByteBufferPool, Executor executor, EndPoint endPoint, HTTP2Session session, int bufferSize) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Performs a logical close of this connection.protected voiddispatch()longlonglonglongbooleanbooleanprotected voidvoidCallback method invoked when this connection is closed.voidonConnectionFailure(int error, String reason) voidvoidCallback method invoked when the endpoint is ready to be read.voidonFlushed(long bytes) Invoked when aWriteFlusherflushed bytes in a non-blocking way, as part of a - possibly larger - write.voidonGoAway(GoAwayFrame frame) voidonHeaders(HeadersFrame frame) booleanCallback method invoked upon an idle timeout event.voidonOpen()Callback method invoked when this connection is opened.voidvoidonPriority(PriorityFrame frame) voidonPushPromise(PushPromiseFrame frame) voidonReset(ResetFrame frame) voidonSettings(SettingsFrame frame) voidonStreamFailure(int streamId, int error, String reason) voidonUpgradeTo(ByteBuffer buffer) Invoked during anupgradeto receive a buffer containing bytes that have not been consumed by the upgrade-from connection, and that must be consumed by this connection.voidonWindowUpdate(WindowUpdateFrame frame) protected voidproduce()voidsetUseInputDirectByteBuffers(boolean useInputDirectByteBuffers) voidsetUseOutputDirectByteBuffers(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:
getMessagesInin interfaceConnection- Overrides:
getMessagesInin classAbstractConnection
-
getMessagesOut
public long getMessagesOut()- Specified by:
getMessagesOutin interfaceConnection- Overrides:
getMessagesOutin classAbstractConnection
-
getBytesIn
public long getBytesIn()- Specified by:
getBytesInin interfaceConnection- Overrides:
getBytesInin classAbstractConnection
-
getBytesOut
public long getBytesOut()- Specified by:
getBytesOutin interfaceConnection- Overrides:
getBytesOutin classAbstractConnection
-
getSession
-
onUpgradeTo
Description copied from interface:Connection.UpgradeToInvoked during an
upgradeto 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:
onUpgradeToin 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:ConnectionCallback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onOpenin interfaceConnection- Overrides:
onOpenin classAbstractConnection
-
onClose
Description copied from interface:ConnectionCallback method invoked when this connection is closed.
Creators of the connection implementation are responsible for calling this method.
- Specified by:
onClosein interfaceConnection- Overrides:
onClosein classAbstractConnection- Parameters:
cause- The cause of the close or null for a normal close
-
onFillable
public void onFillable()Description copied from class:AbstractConnectionCallback method invoked when the endpoint is ready to be read.
- Specified by:
onFillablein classAbstractConnection- See Also:
-
onIdleExpired
public boolean onIdleExpired()Description copied from interface:ConnectionCallback 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:
onIdleExpiredin interfaceConnection- Overrides:
onIdleExpiredin 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:ConnectionPerforms a logical close of this connection.
For simple connections, this may just mean to delegate the close to the associated
EndPointbut, for example, SSL connections should write the SSL close message before closing the associatedEndPoint.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceConnection- Overrides:
closein classAbstractConnection
-
onHeaders
- Specified by:
onHeadersin interfaceParser.Listener
-
onData
- Specified by:
onDatain interfaceParser.Listener
-
onPriority
- Specified by:
onPriorityin interfaceParser.Listener
-
onReset
- Specified by:
onResetin interfaceParser.Listener
-
onSettings
- Specified by:
onSettingsin interfaceParser.Listener
-
onPushPromise
- Specified by:
onPushPromisein interfaceParser.Listener
-
onPing
- Specified by:
onPingin interfaceParser.Listener
-
onGoAway
- Specified by:
onGoAwayin interfaceParser.Listener
-
onWindowUpdate
- Specified by:
onWindowUpdatein interfaceParser.Listener
-
onStreamFailure
- Specified by:
onStreamFailurein interfaceParser.Listener
-
onConnectionFailure
- Specified by:
onConnectionFailurein interfaceParser.Listener
-
onFlushed
Description copied from interface:WriteFlusher.ListenerInvoked when a
WriteFlusherflushed 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
IOExceptionto signal that the write should fail, for example if the implementation enforces a minimum data rate.- Specified by:
onFlushedin interfaceWriteFlusher.Listener- Parameters:
bytes- the number of bytes flushed- Throws:
IOException- if the write should fail
-