ConnectionFactory combining multiple Detecting instances that will upgrade to
the first one recognizing the bytes in the buffer.
| Modifier and Type | Class and Description |
|---|---|
| private static class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private final List | |
| private static final Logger |
| Access | Constructor and Description |
|---|---|
| public | DetectorConnectionFactory(ConnectionFactory.
the detectingConnectionFactoriesDetecting instances.When the first bytes are not recognized by the |
| Modifier and Type | Method and Description |
|---|---|
| public ConnectionFactory. | detect(ByteBuffer
the buffer to perform a detection against. buffer)Implements org. Detecting instances and returns the aggregated outcome.
|
| public Connection | newConnection(Connector
The connector, EndPoint Connector creating this connectionthe endPoint)EndPoint associated with the connectionImplements org. Creates a new |
| protected void | nextProtocol(Connector
the connector. connector, EndPoint the endpoint. endPoint, ByteBuffer the buffer. buffer)Callback method called when detection was unsuccessful. |
| private static String | |
| protected static void | upgradeToConnectionFactory(ConnectionFactory
the connection factory to upgrade to. connectionFactory, Connector the connector. connector, EndPoint the endpoint. endPoint)Utility method that performs an upgrade to the specified connection factory, disposing of the given resources when needed. |
| _detectingConnectionFactories | back to summary |
|---|---|
| private final List<ConnectionFactory. | |
| LOG | back to summary |
|---|---|
| private static final Logger LOG Hides org. | |
| DetectorConnectionFactory | back to summary |
|---|---|
| public DetectorConnectionFactory(ConnectionFactory. When the first bytes are not recognized by the
| |
| detect | back to summary |
|---|---|
| public ConnectionFactory. Implements org. Performs a detection using multiple
| |
| newConnection | back to summary |
|---|---|
| public Connection newConnection(Connector connector, EndPoint endPoint) Implements org. Doc from org. Creates a new
| |
| nextProtocol | back to summary |
|---|---|
| protected void nextProtocol(Connector connector, EndPoint endPoint, ByteBuffer buffer) throws IllegalStateException Callback method called when detection was unsuccessful.
This implementation upgrades to the protocol returned by
| |
| toProtocolString | back to summary |
|---|---|
| private static String toProtocolString(ConnectionFactory. | |
| upgradeToConnectionFactory | back to summary |
|---|---|
| protected static void upgradeToConnectionFactory(ConnectionFactory connectionFactory, Connector connector, EndPoint endPoint) throws IllegalStateException Utility method that performs an upgrade to the specified connection factory, disposing of the given resources when needed.
| |
| Access | Constructor and Description |
|---|---|
| public |
| DetectionFailureException | back to summary |
|---|---|
| public DetectionFailureException(Throwable cause) | |
| Modifier and Type | Field and Description |
|---|---|
| private final RetainableByteBuffer | |
| private final Connector |
| Access | Constructor and Description |
|---|---|
| private |
| Modifier and Type | Method and Description |
|---|---|
| private boolean | |
| public void | onFillable()
Implements abstract org. Callback method invoked when the endpoint is ready to be read. |
| public void | onOpen()
Overrides org. Implements org. Callback method invoked when this connection is opened. |
| public ByteBuffer | onUpgradeFrom()
Implements org. Invoked during an |
| 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. byteBuffer)Implements org. Invoked during an |
| private void |
| _buffer | back to summary |
|---|---|
| private final RetainableByteBuffer _buffer | |
| _connector | back to summary |
|---|---|
| private final Connector _connector | |
| DetectorConnection | back to summary |
|---|---|
| private DetectorConnection(EndPoint endp, Connector connector) | |
| detectAndUpgrade | back to summary |
|---|---|
private boolean detectAndUpgrade()
| |
| onFillable | back to summary |
|---|---|
| public void onFillable() Implements abstract org. Doc from org. Callback method invoked when the endpoint is ready to be read.
| |
| onOpen | back to summary |
|---|---|
| public void onOpen() Overrides org. Implements org. Doc from org. Callback method invoked when this connection is opened. Creators of the connection implementation are responsible for calling this method.
| |
| onUpgradeFrom | back to summary |
|---|---|
| public ByteBuffer onUpgradeFrom() Implements org. Doc from org. Invoked during an
| |
| onUpgradeTo | back to summary |
|---|---|
| public void onUpgradeTo(ByteBuffer byteBuffer) Implements org. Doc from org. Invoked during an
| |
| releaseAndClose | back to summary |
|---|---|
| private void releaseAndClose(Throwable failure) | |