Class NettyAcceptor
- java.lang.Object
-
- org.apache.activemq.artemis.core.remoting.impl.AbstractAcceptor
-
- org.apache.activemq.artemis.core.remoting.impl.netty.NettyAcceptor
-
- All Implemented Interfaces:
ActiveMQComponent,Acceptor
public class NettyAcceptor extends AbstractAcceptor
A Netty TCP Acceptor that is embedding Netty.
-
-
Field Summary
Fields Modifier and Type Field Description static StringEPOLL_ACCEPTOR_TYPEstatic StringINVM_ACCEPTOR_TYPEstatic StringKQUEUE_ACCEPTOR_TYPEstatic StringNIO_ACCEPTOR_TYPE-
Fields inherited from class org.apache.activemq.artemis.core.remoting.impl.AbstractAcceptor
protocolMap
-
-
Constructor Summary
Constructors Constructor Description NettyAcceptor(String name, ClusterConnection clusterConnection, Map<String,Object> configuration, BufferHandler handler, ServerConnectionLifeCycleListener listener, ScheduledExecutorService scheduledThreadPool, Executor failureExecutor, Map<String,ProtocolManager> protocolMap)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidasyncStop(Runnable callback)ConnectionCreatorcreateConnectionCreator()intgetActualPort()This is a utility method for Socket-based acceptor implementations to get the actual port used.ClusterConnectiongetClusterConnection()Map<String,Object>getConfiguration()Map<Object,NettyServerConnection>getConnections()StringgetName()The name of the acceptor used on the configuration.ProtocolHandlergetProtocolHandler()intgetQuietPeriod()intgetShutdownTimeout()io.netty.handler.ssl.SslHandlergetSslHandler(io.netty.buffer.ByteBufAllocator alloc, String peerHost, int peerPort)intgetTcpReceiveBufferSize()booleanisAutoStart()booleanisStarted()booleanisUnsecurable()only InVM acceptors should allow thisvoidpause()Pause the acceptor and stop it from receiving client requests.voidreload()Re-create the acceptor with the existing configuration values.voidsetDefaultActiveMQPrincipal(ActiveMQPrincipal defaultActiveMQPrincipal)not allowedvoidsetKeyStoreParameters(String keyStorePath, String keyStoreAlias)voidsetNotificationService(NotificationService notificationService)Set the notification service for this acceptor to use.NettyAcceptorsetQuietPeriod(int quietPeriod)NettyAcceptorsetShutdownTimeout(int shutdownTimeout)voidstart()voidstop()voidtransfer(io.netty.channel.Channel channel)Transfers the Netty channel that has been created outside of this NettyAcceptor to control it and configure it according to this NettyAcceptor setting.-
Methods inherited from class org.apache.activemq.artemis.core.remoting.impl.AbstractAcceptor
getProtocolMap, updateInterceptors
-
-
-
-
Field Detail
-
INVM_ACCEPTOR_TYPE
public static final String INVM_ACCEPTOR_TYPE
- See Also:
- Constant Field Values
-
NIO_ACCEPTOR_TYPE
public static final String NIO_ACCEPTOR_TYPE
- See Also:
- Constant Field Values
-
EPOLL_ACCEPTOR_TYPE
public static final String EPOLL_ACCEPTOR_TYPE
- See Also:
- Constant Field Values
-
KQUEUE_ACCEPTOR_TYPE
public static final String KQUEUE_ACCEPTOR_TYPE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
NettyAcceptor
public NettyAcceptor(String name, ClusterConnection clusterConnection, Map<String,Object> configuration, BufferHandler handler, ServerConnectionLifeCycleListener listener, ScheduledExecutorService scheduledThreadPool, Executor failureExecutor, Map<String,ProtocolManager> protocolMap)
-
-
Method Detail
-
getTcpReceiveBufferSize
public int getTcpReceiveBufferSize()
-
getName
public String getName()
Description copied from interface:AcceptorThe name of the acceptor used on the configuration. for logging and debug purposes.
-
getConnections
public Map<Object,NettyServerConnection> getConnections()
-
getProtocolHandler
public ProtocolHandler getProtocolHandler()
-
transfer
public void transfer(io.netty.channel.Channel channel)
Transfers the Netty channel that has been created outside of this NettyAcceptor to control it and configure it according to this NettyAcceptor setting.- Parameters:
channel- A Netty channel created outside this NettyAcceptor.
-
reload
public void reload()
Description copied from interface:AcceptorRe-create the acceptor with the existing configuration values. Useful, for example, for reloading key/trust stores on acceptors which support SSL.
-
getSslHandler
public io.netty.handler.ssl.SslHandler getSslHandler(io.netty.buffer.ByteBufAllocator alloc, String peerHost, int peerPort) throws Exception- Throws:
Exception
-
asyncStop
public void asyncStop(Runnable callback)
-
isStarted
public boolean isStarted()
-
pause
public void pause()
Description copied from interface:AcceptorPause the acceptor and stop it from receiving client requests.
-
setNotificationService
public void setNotificationService(NotificationService notificationService)
Description copied from interface:AcceptorSet the notification service for this acceptor to use.- Parameters:
notificationService- the notification service
-
setDefaultActiveMQPrincipal
public void setDefaultActiveMQPrincipal(ActiveMQPrincipal defaultActiveMQPrincipal)
not allowed- Parameters:
defaultActiveMQPrincipal-
-
isUnsecurable
public boolean isUnsecurable()
only InVM acceptors should allow this- Returns:
-
getClusterConnection
public ClusterConnection getClusterConnection()
- Returns:
- the cluster connection associated with this Acceptor
-
createConnectionCreator
public ConnectionCreator createConnectionCreator()
-
getQuietPeriod
public int getQuietPeriod()
-
setQuietPeriod
public NettyAcceptor setQuietPeriod(int quietPeriod)
-
getShutdownTimeout
public int getShutdownTimeout()
-
setShutdownTimeout
public NettyAcceptor setShutdownTimeout(int shutdownTimeout)
-
isAutoStart
public boolean isAutoStart()
-
getActualPort
public int getActualPort()
Description copied from interface:AcceptorThis is a utility method for Socket-based acceptor implementations to get the actual port used. This is useful for configurations which specify a port number of 0 which allows the JVM to select an ephemeral port.- Returns:
- the actual port used if using a Socket-based acceptor implementation; -1 otherwise
-
-