Class HTTP2Connection
- java.lang.Object
-
- org.eclipse.jetty.io.AbstractConnection
-
- org.eclipse.jetty.http2.HTTP2Connection
-
- All Implemented Interfaces:
java.io.Closeable,java.lang.AutoCloseable,Connection,WriteFlusher.Listener
- Direct Known Subclasses:
HTTP2ServerConnection
public class HTTP2Connection extends AbstractConnection implements WriteFlusher.Listener
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected classHTTP2Connection.HTTP2Producer-
Nested classes/interfaces inherited from interface org.eclipse.jetty.io.Connection
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
-
-
Constructor Summary
Constructors Constructor Description HTTP2Connection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, ISession session, int bufferSize)HTTP2Connection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)Deprecated.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()Performs a logical close of this connection.protected voiddispatch()longgetBytesIn()longgetBytesOut()longgetMessagesIn()longgetMessagesOut()protected ParsergetParser()ISessiongetSession()protected voidofferTask(java.lang.Runnable task, boolean dispatch)voidonClose()Callback method invoked when this connection is closed.voidonFillable()Callback 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.booleanonIdleExpired()Callback method invoked upon an idle timeout event.voidonOpen()Callback method invoked when this connection is opened.protected voidproduce()protected voidsetInputBuffer(java.nio.ByteBuffer buffer)Parser.ListenerwrapParserListener(Parser.Listener listener)-
Methods inherited from class org.eclipse.jetty.io.AbstractConnection
addListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, isFillInterested, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
-
-
-
-
Field Detail
-
LOG
protected static final Logger LOG
-
-
Constructor Detail
-
HTTP2Connection
@Deprecated public HTTP2Connection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
Deprecated.
-
HTTP2Connection
public HTTP2Connection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, ISession session, int bufferSize)
-
-
Method Detail
-
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
public ISession getSession()
-
getParser
protected Parser getParser()
-
setInputBuffer
protected void setInputBuffer(java.nio.ByteBuffer buffer)
-
wrapParserListener
public Parser.Listener wrapParserListener(Parser.Listener listener)
-
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
public void 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
-
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:
AbstractConnection.fillInterested()
-
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
protected void offerTask(java.lang.Runnable task, boolean dispatch)
-
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 interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Specified by:
closein interfaceConnection- Overrides:
closein classAbstractConnection
-
onFlushed
public void onFlushed(long bytes) throws java.io.IOExceptionDescription 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:
java.io.IOException- if the write should fail
-
-