A Connection is associated to an EndPoint so that I/O events
happening on the EndPoint can be processed by the Connection.
A typical implementation of Connection overrides onOpen() to
set read interest on the EndPoint,
and when the EndPoint signals read readyness, this Connection can
read bytes from the network and interpret them.
| Modifier and Type | Class and Description |
|---|---|
| public static interface | Connection.Listener
A Listener for connection events. |
| public static interface | Connection.UpgradeFrom
|
| public static interface | Connection.UpgradeTo
|
| Modifier and Type | Method and Description |
|---|---|
| public void | |
| public void | |
| public long | |
| public long | |
| public long | |
| public EndPoint | |
| public long | |
| public long | |
| public void | |
| public boolean | Returns: true to let the EndPoint handle the idle timeout, false to tell the EndPoint to halt the handling of the idle timeout.Callback method invoked upon an idle timeout event. |
| public void | |
| public void | removeEventListener(EventListener
the listener to remove listener)Removes a listener of connection events. |
| addEventListener | back to summary |
|---|---|
| public void addEventListener(EventListener listener) Adds a listener of connection events.
| |
| close | back to summary |
|---|---|
| public void close() Redeclares java. Performs a logical close of this connection. For simple connections, this may just mean to delegate the close to the associated
| |
| getBytesIn | back to summary |
|---|---|
| public long getBytesIn() | |
| getBytesOut | back to summary |
|---|---|
| public long getBytesOut() | |
| getCreatedTimeStamp | back to summary |
|---|---|
| public long getCreatedTimeStamp() | |
| getEndPoint | back to summary |
|---|---|
| public EndPoint getEndPoint() | |
| getMessagesIn | back to summary |
|---|---|
| public long getMessagesIn() | |
| getMessagesOut | back to summary |
|---|---|
| public long getMessagesOut() | |
| onClose | back to summary |
|---|---|
| public void onClose(Throwable cause) Callback method invoked when this connection is closed. Creators of the connection implementation are responsible for calling this method.
| |
| onIdleExpired | back to summary |
|---|---|
| public boolean onIdleExpired(TimeoutException timeoutException) 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.
| |
| onOpen | back to summary |
|---|---|
| public void onOpen() Callback method invoked when this connection is opened. Creators of the connection implementation are responsible for calling this method. | |
| removeEventListener | back to summary |
|---|---|
| public void removeEventListener(EventListener listener) Removes a listener of connection events.
| |
A Listener for connection events.
Listeners can be added to a Connection to get open and close events.
The AbstractConnectionFactory implements a pattern where objects implement
this interface that have been added via Container#addBean(Object) to
the Connector or ConnectionFactory are added as listeners to all new connections
| Modifier and Type | Method and Description |
|---|---|
| public default void | |
| public default void |
| onClosed | back to summary |
|---|---|
| public default void onClosed(Connection connection) | |
| onOpened | back to summary |
|---|---|
| public default void onOpened(Connection connection) | |
Connection implementations implement this interface when they
can upgrade from the protocol they speak (for example HTTP/1.1)
to a different protocol (e.g. HTTP/2).
EndPoint#upgrade(Connection), UpgradeTo
| Modifier and Type | Method and Description |
|---|---|
| public ByteBuffer | Returns: a buffer of unconsumed bytes to pass to the upgrade-to connection. The buffer does not belong to any pool and should be discarded after having consumed its bytes. The returned buffer may be null if there are no unconsumed bytes.Invoked during an |
| onUpgradeFrom | back to summary |
|---|---|
| public ByteBuffer onUpgradeFrom() Invoked during an
| |
Connection implementations implement this interface when they
can be upgraded to the protocol they speak (e.g. HTTP/2)
from a different protocol (e.g. HTTP/1.1).
| Modifier and Type | Method and Description |
|---|---|
| public void | onUpgradeTo(ByteBuffer
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. buffer)Invoked during an |
| onUpgradeTo | back to summary |
|---|---|
| public void onUpgradeTo(ByteBuffer buffer) Invoked during an
| |