public class HTTP2Connection extends AbstractConnection implements WriteFlusher.Listener
Modifier and Type | Class and Description |
---|---|
protected class |
HTTP2Connection.HTTP2Producer |
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Constructor and Description |
---|
HTTP2Connection(ByteBufferPool byteBufferPool,
java.util.concurrent.Executor executor,
EndPoint endPoint,
Parser parser,
ISession session,
int bufferSize) |
Modifier and Type | Method and Description |
---|---|
void |
close()
Performs a logical close of this connection.
|
protected void |
dispatch() |
long |
getBytesIn() |
long |
getBytesOut() |
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 a
WriteFlusher 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) |
addListener, failedCallback, fillInterested, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onFillInterestedFailed, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
protected static final Logger LOG
public HTTP2Connection(ByteBufferPool byteBufferPool, java.util.concurrent.Executor executor, EndPoint endPoint, Parser parser, ISession session, int bufferSize)
public long getBytesIn()
getBytesIn
in interface Connection
getBytesIn
in class AbstractConnection
public long getBytesOut()
getBytesOut
in interface Connection
getBytesOut
in class AbstractConnection
public ISession getSession()
protected Parser getParser()
protected void setInputBuffer(java.nio.ByteBuffer buffer)
public void onOpen()
Connection
Callback method invoked when this connection is opened.
Creators of the connection implementation are responsible for calling this method.
onOpen
in interface Connection
onOpen
in class AbstractConnection
public void onClose()
Connection
Callback method invoked when this connection is closed.
Creators of the connection implementation are responsible for calling this method.
onClose
in interface Connection
onClose
in class AbstractConnection
public void onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
public boolean onIdleExpired()
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.
onIdleExpired
in interface Connection
onIdleExpired
in class AbstractConnection
protected void offerTask(java.lang.Runnable task, boolean dispatch)
protected void produce()
protected void dispatch()
public void close()
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 associated EndPoint
.
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface Connection
close
in class AbstractConnection
public void onFlushed(long bytes) throws java.io.IOException
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.
onFlushed
in interface WriteFlusher.Listener
bytes
- the number of bytes flushedjava.io.IOException
- if the write should failCopyright © 1995–2023 Webtide. All rights reserved.