public class DetectorConnectionFactory extends AbstractConnectionFactory implements ConnectionFactory.Detecting
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 |
DetectorConnectionFactory.DetectionFailureException |
private class |
DetectorConnectionFactory.DetectorConnection |
AbstractLifeCycle.AbstractLifeCycleListenerConnectionFactory.Detecting.DetectionConnectionFactory.Detecting, ConnectionFactory.UpgradingContainer.InheritedListener, Container.ListenerLifeCycle.Listener| Modifier and Type | Field and Description |
|---|---|
private java.util.List<ConnectionFactory.Detecting> |
_detectingConnectionFactories |
private static Logger |
LOG |
| Constructor and Description |
|---|
DetectorConnectionFactory(ConnectionFactory.Detecting... detectingConnectionFactories)
When the first bytes are not recognized by the
detectingConnectionFactories, the default behavior is to
upgrade to the protocol returned by AbstractConnectionFactory.findNextProtocol(Connector). |
| Modifier and Type | Method and Description |
|---|---|
ConnectionFactory.Detecting.Detection |
detect(java.nio.ByteBuffer buffer)
Performs a detection using multiple
ConnectionFactory.Detecting instances and returns the aggregated outcome. |
Connection |
newConnection(Connector connector,
EndPoint endPoint)
Creates a new
Connection with the given parameters |
protected void |
nextProtocol(Connector connector,
EndPoint endPoint,
java.nio.ByteBuffer buffer)
Callback method called when detection was unsuccessful.
|
private static java.lang.String |
toProtocolString(ConnectionFactory.Detecting... detectingConnectionFactories) |
protected static void |
upgradeToConnectionFactory(ConnectionFactory connectionFactory,
Connector connector,
EndPoint endPoint)
Utility method that performs an upgrade to the specified connection factory, disposing of the given resources when needed.
|
configure, findNextProtocol, findNextProtocol, getFactories, getInputBufferSize, getProtocol, getProtocols, setInputBufferSize, toStringaddBean, addBean, addEventListener, addManaged, contains, destroy, doStart, doStop, dump, dump, dump, dump, dump, dumpBeans, dumpObject, dumpObjects, dumpStdErr, dumpThis, getBean, getBeans, getBeans, getContainedBeans, getContainedBeans, isAuto, isManaged, isUnmanaged, manage, removeBean, removeBeans, removeEventListener, setBeans, setStopTimeout, start, stop, unmanage, updateBean, updateBean, updateBeansaddLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stopclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitgetProtocol, getProtocolsdumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, namedprivate static final Logger LOG
private final java.util.List<ConnectionFactory.Detecting> _detectingConnectionFactories
public DetectorConnectionFactory(ConnectionFactory.Detecting... detectingConnectionFactories)
When the first bytes are not recognized by the detectingConnectionFactories, the default behavior is to
upgrade to the protocol returned by AbstractConnectionFactory.findNextProtocol(Connector).
detectingConnectionFactories - the Detecting instances.private static java.lang.String toProtocolString(ConnectionFactory.Detecting... detectingConnectionFactories)
public ConnectionFactory.Detecting.Detection detect(java.nio.ByteBuffer buffer)
ConnectionFactory.Detecting instances and returns the aggregated outcome.detect in interface ConnectionFactory.Detectingbuffer - the buffer to perform a detection against.Detecting.Detection value with the detection outcome of the detectingConnectionFactories.protected static void upgradeToConnectionFactory(ConnectionFactory connectionFactory, Connector connector, EndPoint endPoint) throws java.lang.IllegalStateException
connectionFactory - the connection factory to upgrade to.connector - the connector.endPoint - the endpoint.java.lang.IllegalStateExceptionprotected void nextProtocol(Connector connector, EndPoint endPoint, java.nio.ByteBuffer buffer) throws java.lang.IllegalStateException
Callback method called when detection was unsuccessful.
This implementation upgrades to the protocol returned by AbstractConnectionFactory.findNextProtocol(Connector).
connector - the connector.endPoint - the endpoint.buffer - the buffer.java.lang.IllegalStateExceptionpublic Connection newConnection(Connector connector, EndPoint endPoint)
ConnectionFactoryCreates a new Connection with the given parameters
newConnection in interface ConnectionFactoryconnector - The Connector creating this connectionendPoint - the EndPoint associated with the connectionConnection