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 class
HTTP2Connection.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 void
close()
Performs a logical close of this connection.protected void
dispatch()
long
getBytesIn()
long
getBytesOut()
long
getMessagesIn()
long
getMessagesOut()
protected Parser
getParser()
ISession
getSession()
protected void
offerTask(java.lang.Runnable task, boolean dispatch)
void
onClose()
Callback method invoked when this connection is closed.void
onFillable()
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.boolean
onIdleExpired()
Callback method invoked upon an idle timeout event.void
onOpen()
Callback method invoked when this connection is opened.protected void
produce()
protected void
setInputBuffer(java.nio.ByteBuffer buffer)
Parser.Listener
wrapParserListener(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:
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
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: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
public void 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
-
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:
AbstractConnection.fillInterested()
-
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
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: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 interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Specified by:
close
in interfaceConnection
- Overrides:
close
in classAbstractConnection
-
onFlushed
public void onFlushed(long bytes) throws java.io.IOException
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:
java.io.IOException
- if the write should fail
-
-