private class DetectorConnectionFactory.DetectorConnection extends AbstractConnection implements Connection.UpgradeFrom, Connection.UpgradeTo
Connection.Listener, Connection.UpgradeFrom, Connection.UpgradeTo
Modifier and Type | Field and Description |
---|---|
private java.nio.ByteBuffer |
_buffer |
private Connector |
_connector |
Modifier | Constructor and Description |
---|---|
private |
DetectorConnection(EndPoint endp,
Connector connector) |
Modifier and Type | Method and Description |
---|---|
private boolean |
detectAndUpgrade() |
void |
onFillable()
Callback method invoked when the endpoint is ready to be read.
|
void |
onOpen()
Callback method invoked when this connection is opened.
|
java.nio.ByteBuffer |
onUpgradeFrom()
Takes the input buffer from the connection on upgrade.
|
void |
onUpgradeTo(java.nio.ByteBuffer prefilled)
Callback method invoked when this connection is upgraded.
|
private void |
releaseAndClose() |
addListener, close, failedCallback, fillInterested, getBytesIn, getBytesOut, getCreatedTimeStamp, getEndPoint, getExecutor, getInputBufferSize, getMessagesIn, getMessagesOut, isFillInterested, onClose, onFillInterestedFailed, onIdleExpired, onReadTimeout, removeListener, setInputBufferSize, toConnectionString, toString, tryFillInterested, tryFillInterested
private final Connector _connector
private final java.nio.ByteBuffer _buffer
public void onUpgradeTo(java.nio.ByteBuffer prefilled)
Connection.UpgradeTo
Callback method invoked when this connection is upgraded.
This must be called before Connection.onOpen()
.
onUpgradeTo
in interface Connection.UpgradeTo
prefilled
- An optional buffer that can contain prefilled data. Typically this
results from an upgrade of one protocol to the other where the old connection has buffered
data destined for the new connection. The new connection must take ownership of the buffer
and is responsible for returning it to the buffer poolpublic java.nio.ByteBuffer onUpgradeFrom()
Connection.UpgradeFrom
Takes the input buffer from the connection on upgrade.
This method is used to take any unconsumed input from a connection during an upgrade.
onUpgradeFrom
in interface Connection.UpgradeFrom
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 onFillable()
AbstractConnection
Callback method invoked when the endpoint is ready to be read.
onFillable
in class AbstractConnection
AbstractConnection.fillInterested()
private boolean detectAndUpgrade()
private void releaseAndClose()