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.AbstractLifeCycle.AbstractLifeCycleListener
ConnectionFactory.Detecting.Detection
ConnectionFactory.Detecting, ConnectionFactory.Upgrading
Container.InheritedListener, Container.Listener
Dumpable.DumpableContainer
LifeCycle.Listener
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.
|
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, toString
addBean, 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, updateBeans
addLifeCycleListener, getState, getState, getStopTimeout, isFailed, isRunning, isStarted, isStarting, isStopped, isStopping, removeLifeCycleListener, start, stop
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
getProtocol, getProtocols
isDumpable
dumpContainer, dumpIterable, dumpMapEntries, dumpObjects, dumpSelf, named
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.public ConnectionFactory.Detecting.Detection detect(java.nio.ByteBuffer buffer)
ConnectionFactory.Detecting
instances and returns the aggregated outcome.detect
in interface ConnectionFactory.Detecting
buffer
- 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.IllegalStateException
protected 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.IllegalStateException
public Connection newConnection(Connector connector, EndPoint endPoint)
ConnectionFactory
Creates a new Connection
with the given parameters
newConnection
in interface ConnectionFactory
connector
- The Connector
creating this connectionendPoint
- the EndPoint
associated with the connectionConnection
Copyright © 1995–2021 Webtide. All rights reserved.