Class TcpTransportFactory
java.lang.Object
org.apache.activemq.transport.TransportFactory
org.apache.activemq.transport.tcp.TcpTransportFactory
- Direct Known Subclasses:
NIOTransportFactory, SslTransportFactory
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptioncompositeConfigure(Transport transport, WireFormat format, Map options) Similar to configure(...) but this avoid adding in the MutexTransport and ResponseCorrelator transport layers so that the resulting transport can more efficiently be used as part of a composite transport.protected TransportcreateInactivityMonitor(Transport transport, WireFormat format) protected ServerSocketFactoryprotected ServerSocketFactorycreateServerSocketFactory(SslContext sslContext) Allows SSL capable subclasses to derive the ServerSocketFactory from the given SslContext.protected SocketFactoryprotected SocketFactorycreateSocketFactory(SslContext sslContext) Allows SSL capable subclasses to derive the SocketFactory from the given SslContext.protected TcpTransportcreateTcpTransport(WireFormat wf, SocketFactory socketFactory, URI location, URI localLocation) Allows subclasses of TcpTransportFactory to provide a create custom TcpTransport instances.protected TcpTransportServercreateTcpTransportServer(URI location, ServerSocketFactory serverSocketFactory) Allows subclasses of TcpTransportFactory to create custom instances of TcpTransportServer.protected TcpTransportServercreateTcpTransportServer(URI location, ServerSocketFactory serverSocketFactory, SslContext sslContext) Allows SSL capable subclasses to create a TcpTransportServer that uses the given SslContext for accepted connections.protected TransportcreateTransport(URI location, WireFormat wf) Factory method to create a new transportprotected TransportcreateTransport(URI location, WireFormat wf, SslContext sslContext) Creates the client side transport for the given location, deriving the socket factory from the given SslContext viacreateSocketFactory(SslContext).createTransport(WireFormat wireFormat, Socket socket, SSLEngine engine, TcpTransport.InitBuffer initBuffer, ByteBuffer inputBuffer) createTransport(WireFormat wireFormat, Socket socket, TcpTransport.InitBuffer initBuffer) doBind(URI location, SslContext sslContext) Binds a TCP based transport server.doCompositeConnect(URI location, SslContext sslContext) Default implementation delegates to the single-arg method, ignoring the SslContext.doConnect(URI location, SslContext sslContext) Connects a TCP based transport.protected booleanisUseInactivityMonitor(Transport transport) protected static SSLContexttoSSLContext(SslContext sslContext) Resolves the SSLContext held by the given SslContext.Methods inherited from class TransportFactory
bind, compositeConnect, compositeConnect, compositeConnect, configure, connect, connect, connect, createWireFormat, createWireFormatFactory, doCompositeConnect, doCompositeConnect, doConnect, doConnect, doConnectInternal, findTransportFactory, getDefaultWireFormatType, getOption, registerTransportFactory, serverConfigure
-
Constructor Details
-
TcpTransportFactory
public TcpTransportFactory()
-
-
Method Details
-
doBind
- Specified by:
doBindin classTransportFactory- Throws:
IOException
-
doBind
Binds a TCP based transport server. The givenSslContextis handed tocreateServerSocketFactory(SslContext)andcreateTcpTransportServer(URI, ServerSocketFactory, SslContext)so SSL capable subclasses can derive their socket factory and server from it; plain TCP ignores it. The broker always binds through this method, so subclasses customizing the bind must override it rather thandoBind(URI).- Overrides:
doBindin classTransportFactory- Throws:
IOException
-
createTcpTransportServer
protected TcpTransportServer createTcpTransportServer(URI location, ServerSocketFactory serverSocketFactory) throws IOException, URISyntaxException Allows subclasses of TcpTransportFactory to create custom instances of TcpTransportServer.- Parameters:
location-serverSocketFactory-- Returns:
- a new TcpTransportServer instance.
- Throws:
IOExceptionURISyntaxException
-
createTcpTransportServer
protected TcpTransportServer createTcpTransportServer(URI location, ServerSocketFactory serverSocketFactory, SslContext sslContext) throws IOException, URISyntaxException Allows SSL capable subclasses to create a TcpTransportServer that uses the given SslContext for accepted connections. The default ignores the context and delegates tocreateTcpTransportServer(URI, ServerSocketFactory).- Parameters:
sslContext- the SslContext to use, or null for the JVM default.- Throws:
IOExceptionURISyntaxException
-
compositeConfigure
Description copied from class:TransportFactorySimilar to configure(...) but this avoid adding in the MutexTransport and ResponseCorrelator transport layers so that the resulting transport can more efficiently be used as part of a composite transport.- Overrides:
compositeConfigurein classTransportFactory- Parameters:
transport-format-options-- Returns:
-
isUseInactivityMonitor
- Returns:
- true if the inactivity monitor should be used on the transport
-
doConnect
Connects a TCP based transport. The givenSslContextis threaded throughTransportFactory.doConnectInternal(URI, SslContext, boolean)tocreateTransport(URI, WireFormat, SslContext)(and thencecreateSocketFactory(SslContext)) so SSL capable subclasses can derive their socket factory from it; plain TCP ignores it. The plaindoConnect(URI)/doCompositeConnect(URI)are inherited fromTransportFactory, which routes through the same createTransport(URI, WireFormat, SslContext) override with a null context.- Overrides:
doConnectin classTransportFactory- Throws:
IOException
-
doCompositeConnect
Description copied from class:TransportFactoryDefault implementation delegates to the single-arg method, ignoring the SslContext. Subclasses (e.g. SslTransportFactory) override to use the context for SSL socket creation.- Overrides:
doCompositeConnectin classTransportFactory- Throws:
IOException
-
createTransport
Description copied from class:TransportFactoryFactory method to create a new transport- Overrides:
createTransportin classTransportFactory- Throws:
IOException
-
createTransport
protected Transport createTransport(URI location, WireFormat wf, SslContext sslContext) throws IOException Creates the client side transport for the given location, deriving the socket factory from the given SslContext viacreateSocketFactory(SslContext).- Overrides:
createTransportin classTransportFactory- Parameters:
sslContext- the SslContext to use, or null for the JVM default.- Throws:
IOException
-
createTransport
public TcpTransport createTransport(WireFormat wireFormat, Socket socket, TcpTransport.InitBuffer initBuffer) throws IOException - Throws:
IOException
-
createTransport
public TcpTransport createTransport(WireFormat wireFormat, Socket socket, SSLEngine engine, TcpTransport.InitBuffer initBuffer, ByteBuffer inputBuffer) throws IOException - Throws:
IOException
-
createTcpTransport
protected TcpTransport createTcpTransport(WireFormat wf, SocketFactory socketFactory, URI location, URI localLocation) throws IOException Allows subclasses of TcpTransportFactory to provide a create custom TcpTransport instances.- Parameters:
wf-socketFactory-location-localLocation-- Returns:
- a new TcpTransport instance connected to the given location.
- Throws:
IOException
-
createServerSocketFactory
- Throws:
IOException
-
createServerSocketFactory
Allows SSL capable subclasses to derive the ServerSocketFactory from the given SslContext. The default ignores the context and delegates tocreateServerSocketFactory().- Parameters:
sslContext- the SslContext to use, or null for the JVM default.- Throws:
IOException
-
toSSLContext
Resolves the SSLContext held by the given SslContext.- Returns:
- the SSLContext, or null when no SslContext was supplied.
- Throws:
IOException- if the SslContext cannot produce an SSLContext.
-
createSocketFactory
- Throws:
IOException
-
createSocketFactory
Allows SSL capable subclasses to derive the SocketFactory from the given SslContext. The default ignores the context and delegates tocreateSocketFactory().- Parameters:
sslContext- the SslContext to use, or null for the JVM default.- Throws:
IOException
-
createInactivityMonitor
-