Class NettyConnector
- java.lang.Object
-
- org.apache.activemq.artemis.spi.core.remoting.AbstractConnector
-
- org.apache.activemq.artemis.core.remoting.impl.netty.NettyConnector
-
- All Implemented Interfaces:
Connector
public class NettyConnector extends AbstractConnector
-
-
Field Summary
-
Fields inherited from class org.apache.activemq.artemis.spi.core.remoting.AbstractConnector
configuration
-
-
Constructor Summary
Constructors Constructor Description NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool)NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool, ClientProtocolManager protocolManager)NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool, ClientProtocolManager protocolManager, boolean serverConnection)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description static voidclearThreadPools()voidclose()closes the connectorConnectioncreateConnection()Create and return a connection from this connector.ConnectioncreateConnection(Consumer<io.netty.channel.ChannelFuture> onConnect)Create and return a connection from this connector.NettyConnectioncreateConnection(Consumer<io.netty.channel.ChannelFuture> onConnect, String host, int port)static StringcreateExpectedResponse(String magicNumber, String secretKey)io.netty.bootstrap.BootstrapgetBootStrap()io.netty.channel.group.ChannelGroupgetChannelGroup()intgetConnectTimeoutMillis()booleanisEquivalent(Map<String,Object> configuration)If the configuration is equivalent to this connector, which means if the parameter configuration is used to create a connection to a target node, it will be the same node as of the connections made with this connector.booleanisServerConnection()booleanisStarted()returns true if the connector is started, oterwise false.voidsetConnectTimeoutMillis(int connectTimeoutMillis)voidstart()starts the connectorStringtoString()
-
-
-
Field Detail
-
NIO_CONNECTOR_TYPE
public static String NIO_CONNECTOR_TYPE
-
EPOLL_CONNECTOR_TYPE
public static String EPOLL_CONNECTOR_TYPE
-
KQUEUE_CONNECTOR_TYPE
public static String KQUEUE_CONNECTOR_TYPE
-
JAVAX_KEYSTORE_PATH_PROP_NAME
public static final String JAVAX_KEYSTORE_PATH_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_KEYSTORE_PASSWORD_PROP_NAME
public static final String JAVAX_KEYSTORE_PASSWORD_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_KEYSTORE_TYPE_PROP_NAME
public static final String JAVAX_KEYSTORE_TYPE_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_KEYSTORE_PROVIDER_PROP_NAME
public static final String JAVAX_KEYSTORE_PROVIDER_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_TRUSTSTORE_PATH_PROP_NAME
public static final String JAVAX_TRUSTSTORE_PATH_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_TRUSTSTORE_PASSWORD_PROP_NAME
public static final String JAVAX_TRUSTSTORE_PASSWORD_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_TRUSTSTORE_TYPE_PROP_NAME
public static final String JAVAX_TRUSTSTORE_TYPE_PROP_NAME
- See Also:
- Constant Field Values
-
JAVAX_TRUSTSTORE_PROVIDER_PROP_NAME
public static final String JAVAX_TRUSTSTORE_PROVIDER_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_KEYSTORE_PROVIDER_PROP_NAME
public static final String ACTIVEMQ_KEYSTORE_PROVIDER_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_KEYSTORE_TYPE_PROP_NAME
public static final String ACTIVEMQ_KEYSTORE_TYPE_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_KEYSTORE_PATH_PROP_NAME
public static final String ACTIVEMQ_KEYSTORE_PATH_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_KEYSTORE_PASSWORD_PROP_NAME
public static final String ACTIVEMQ_KEYSTORE_PASSWORD_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_TRUSTSTORE_PROVIDER_PROP_NAME
public static final String ACTIVEMQ_TRUSTSTORE_PROVIDER_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_TRUSTSTORE_TYPE_PROP_NAME
public static final String ACTIVEMQ_TRUSTSTORE_TYPE_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_TRUSTSTORE_PATH_PROP_NAME
public static final String ACTIVEMQ_TRUSTSTORE_PATH_PROP_NAME
- See Also:
- Constant Field Values
-
ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME
public static final String ACTIVEMQ_TRUSTSTORE_PASSWORD_PROP_NAME
- See Also:
- Constant Field Values
-
MAGIC_NUMBER
public static final String MAGIC_NUMBER
- See Also:
- Constant Field Values
-
SEC_ACTIVEMQ_REMOTING_KEY
public static final String SEC_ACTIVEMQ_REMOTING_KEY
- See Also:
- Constant Field Values
-
SEC_ACTIVEMQ_REMOTING_ACCEPT
public static final String SEC_ACTIVEMQ_REMOTING_ACCEPT
- See Also:
- Constant Field Values
-
ACTIVEMQ_REMOTING
public static final String ACTIVEMQ_REMOTING
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NettyConnector
public NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool)
-
NettyConnector
public NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool, ClientProtocolManager protocolManager)
-
NettyConnector
public NettyConnector(Map<String,Object> configuration, BufferHandler handler, BaseConnectionLifeCycleListener<?> listener, Executor closeExecutor, Executor threadPool, ScheduledExecutorService scheduledThreadPool, ClientProtocolManager protocolManager, boolean serverConnection)
-
-
Method Detail
-
getChannelGroup
public io.netty.channel.group.ChannelGroup getChannelGroup()
-
isServerConnection
public boolean isServerConnection()
-
start
public void start()
Description copied from interface:Connectorstarts the connector
-
close
public void close()
Description copied from interface:Connectorcloses the connector
-
isStarted
public boolean isStarted()
Description copied from interface:Connectorreturns true if the connector is started, oterwise false.- Returns:
- true if the connector is started
-
createConnection
public Connection createConnection()
Description copied from interface:ConnectorCreate and return a connection from this connector.This method must NOT throw an exception if it fails to create the connection (e.g. network is not available), in this case it MUST return null
- Returns:
- The connection, or null if unable to create a connection (e.g. network is unavailable)
-
createConnection
public final Connection createConnection(Consumer<io.netty.channel.ChannelFuture> onConnect)
Create and return a connection from this connector.This method must NOT throw an exception if it fails to create the connection (e.g. network is not available), in this case it MUST return null.
This version can be used for testing purposes.- Parameters:
onConnect- a callback that would be called right afterBootstrap.connect()- Returns:
- The connection, or
nullif unable to create a connection (e.g. network is unavailable)
-
createConnection
public NettyConnection createConnection(Consumer<io.netty.channel.ChannelFuture> onConnect, String host, int port)
-
getConnectTimeoutMillis
public int getConnectTimeoutMillis()
-
setConnectTimeoutMillis
public void setConnectTimeoutMillis(int connectTimeoutMillis)
-
isEquivalent
public boolean isEquivalent(Map<String,Object> configuration)
Description copied from interface:ConnectorIf the configuration is equivalent to this connector, which means if the parameter configuration is used to create a connection to a target node, it will be the same node as of the connections made with this connector.- Returns:
- true means the configuration is equivalent to the connector. false otherwise.
-
getBootStrap
public io.netty.bootstrap.Bootstrap getBootStrap()
-
clearThreadPools
public static void clearThreadPools()
-
createExpectedResponse
public static String createExpectedResponse(String magicNumber, String secretKey) throws IOException
- Throws:
IOException
-
-