Class RemotingServiceImpl
java.lang.Object
org.apache.activemq.artemis.core.remoting.server.impl.RemotingServiceImpl
- All Implemented Interfaces:
RemotingService,BaseConnectionLifeCycleListener<ProtocolManager>,ServerConnectionLifeCycleListener
public class RemotingServiceImpl
extends Object
implements RemotingService, ServerConnectionLifeCycleListener
-
Constructor Summary
ConstructorsConstructorDescriptionRemotingServiceImpl(ClusterManager clusterManager, Configuration config, ActiveMQServer server, ManagementService managementService, ScheduledExecutorService scheduledThreadPool, List<ProtocolManagerFactory> protocolManagerFactories, Executor flushExecutor, ServiceRegistry serviceRegistry) -
Method Summary
Modifier and TypeMethodDescriptionvoidaddConnectionEntry(Connection connection, ConnectionEntry entry) voidaddIncomingInterceptor(BaseInterceptor interceptor) voidaddOutgoingInterceptor(BaseInterceptor interceptor) voidallowInvmSecurityOverride(ActiveMQPrincipal principal) Allow acceptors to use this as their default security Principal if applicable.voidconnectionCreated(ActiveMQComponent component, Connection connection, ProtocolManager protocol) This method is used both by client connector creation and server connection creation through acceptors.voidconnectionDestroyed(Object connectionID, boolean failed) Called when a connection is destroyed.voidconnectionException(Object connectionID, ActiveMQException me) Called when an error occurs on the connection.voidconnectionReadyForWrites(Object connectionID, boolean ready) createAcceptor(String name, String uri) voiddestroyAcceptor(String name) voidfreeze(String scaleDownNodeID, CoreRemotingConnection connectionToKeepOpen) Freezes and then disconnects all connections except the given one and tells the client where else it might connect (only applicable if server is in a cluster and uses scaleDown-on-failover=true).getAcceptor(String name) Returns the acceptor identified by itsnameornullif it does not exists.getConnection(Object remotingConnectionID) intReturns the number of clients connected to this server.getConnectionEntry(Object remotingConnectionID) longReturns the number of clients which have connected to this server since it was started.booleanisPaused()Pauses the acceptors so that no more connections can be made to the serverbooleanvoidloadProtocolServices(List<ActiveMQComponent> protocolServices) voidvoidPauses the acceptors so that no more connections can be made to the servervoidprepareStop(boolean criticalError, Set<RemotingConnection> ignoreList) The Prepare stop will close all the connections however it will use the one used by storage managerremoveConnection(Object remotingConnectionID) Remove a connection from the connections held by the remoting service.booleanremoveIncomingInterceptor(BaseInterceptor interceptor) booleanremoveOutgoingInterceptor(BaseInterceptor interceptor) voidstart()voidvoidstop(boolean criticalError) protected voidvoidupdateProtocolServices(List<ActiveMQComponent> protocolServices) Provides an entry point for protocol services offered by this service instance to react to configuration updates.
-
Constructor Details
-
RemotingServiceImpl
public RemotingServiceImpl(ClusterManager clusterManager, Configuration config, ActiveMQServer server, ManagementService managementService, ScheduledExecutorService scheduledThreadPool, List<ProtocolManagerFactory> protocolManagerFactories, Executor flushExecutor, ServiceRegistry serviceRegistry)
-
-
Method Details
-
getProtocolFactoryMap
- Specified by:
getProtocolFactoryMapin interfaceRemotingService
-
start
- Specified by:
startin interfaceRemotingService- Throws:
Exception
-
createAcceptor
- Specified by:
createAcceptorin interfaceRemotingService- Throws:
Exception
-
createAcceptor
- Specified by:
createAcceptorin interfaceRemotingService
-
getAcceptors
- Specified by:
getAcceptorsin interfaceRemotingService
-
destroyAcceptor
- Specified by:
destroyAcceptorin interfaceRemotingService- Throws:
Exception
-
startAcceptors
- Specified by:
startAcceptorsin interfaceRemotingService- Throws:
Exception
-
allowInvmSecurityOverride
Description copied from interface:RemotingServiceAllow acceptors to use this as their default security Principal if applicable.Used by AS7 integration code.
- Specified by:
allowInvmSecurityOverridein interfaceRemotingService
-
pauseAcceptors
public void pauseAcceptors()Description copied from interface:RemotingServicePauses the acceptors so that no more connections can be made to the server- Specified by:
pauseAcceptorsin interfaceRemotingService
-
isPaused
public boolean isPaused()Description copied from interface:RemotingServicePauses the acceptors so that no more connections can be made to the server- Specified by:
isPausedin interfaceRemotingService
-
freeze
Description copied from interface:RemotingServiceFreezes and then disconnects all connections except the given one and tells the client where else it might connect (only applicable if server is in a cluster and uses scaleDown-on-failover=true).- Specified by:
freezein interfaceRemotingService
-
notifyStop
public void notifyStop()- Specified by:
notifyStopin interfaceRemotingService
-
prepareStop
Description copied from interface:RemotingServiceThe Prepare stop will close all the connections however it will use the one used by storage manager- Specified by:
prepareStopin interfaceRemotingService- Throws:
Exception
-
stop
- Specified by:
stopin interfaceRemotingService- Throws:
Exception
-
getAcceptor
Description copied from interface:RemotingServiceReturns the acceptor identified by itsnameornullif it does not exists.- Specified by:
getAcceptorin interfaceRemotingService- Parameters:
name- the name of the acceptor- Returns:
- the acceptor identified by its
nameornullif it does not exists
-
isStarted
public boolean isStarted()- Specified by:
isStartedin interfaceRemotingService
-
getConnection
- Specified by:
getConnectionin interfaceRemotingService
-
getConnectionEntry
-
removeConnection
Description copied from interface:RemotingServiceRemove a connection from the connections held by the remoting service. This method must be used only from the management API. RemotingConnections are removed from the remoting service when their connectionTTL is hit.- Specified by:
removeConnectionin interfaceRemotingService- Parameters:
remotingConnectionID- the ID of the RemotingConnection to removed- Returns:
- the removed RemotingConnection
-
getConnections
- Specified by:
getConnectionsin interfaceRemotingService
-
getConnectionEntries
-
getConnectionCount
public int getConnectionCount()Description copied from interface:RemotingServiceReturns the number of clients connected to this server.- Specified by:
getConnectionCountin interfaceRemotingService- Returns:
- the number of clients connected to this server
-
getTotalConnectionCount
public long getTotalConnectionCount()Description copied from interface:RemotingServiceReturns the number of clients which have connected to this server since it was started.- Specified by:
getTotalConnectionCountin interfaceRemotingService- Returns:
- the number of clients which have connected to this server since it was started
-
getConnectionCountLatch
- Specified by:
getConnectionCountLatchin interfaceRemotingService
-
loadProtocolServices
- Specified by:
loadProtocolServicesin interfaceRemotingService
-
updateProtocolServices
Description copied from interface:RemotingServiceProvides an entry point for protocol services offered by this service instance to react to configuration updates. If the service implementation does not have any managed services or its services do not respond to updates it can ignore this call. services added should be added to the provided protocolServices list, and any removed should be found and removed from the list.- Specified by:
updateProtocolServicesin interfaceRemotingService- Parameters:
protocolServices- The list of protocol services known to the broker.- Throws:
Exception- if an error is thrown during the services updates.
-
connectionCreated
public void connectionCreated(ActiveMQComponent component, Connection connection, ProtocolManager protocol) Description copied from interface:BaseConnectionLifeCycleListenerThis method is used both by client connector creation and server connection creation through acceptors. On the client side thecomponentparameter is normally passed asnull.Leaving this method here and adding a different one at
ServerConnectionLifeCycleListeneris a compromise for a reasonable split between the activemq-server and activemq-client packages while avoiding to pull too much into activemq-core. The pivotal point keeping us from removing the method isConnectorFactoryand the usage of it.- Specified by:
connectionCreatedin interfaceBaseConnectionLifeCycleListener<ProtocolManager>- Parameters:
component- This will probably be anAcceptorand only used on the server side.connection- the connection that has been createdprotocol- the messaging protocol type this connection uses
-
addConnectionEntry
- Specified by:
addConnectionEntryin interfaceRemotingService
-
connectionDestroyed
Description copied from interface:BaseConnectionLifeCycleListenerCalled when a connection is destroyed.- Specified by:
connectionDestroyedin interfaceBaseConnectionLifeCycleListener<ProtocolManager>- Parameters:
connectionID- the connection being destroyed.
-
connectionException
Description copied from interface:BaseConnectionLifeCycleListenerCalled when an error occurs on the connection.- Specified by:
connectionExceptionin interfaceBaseConnectionLifeCycleListener<ProtocolManager>- Parameters:
connectionID- the id of the connection.me- the exception.
-
connectionReadyForWrites
- Specified by:
connectionReadyForWritesin interfaceBaseConnectionLifeCycleListener<ProtocolManager>
-
addIncomingInterceptor
- Specified by:
addIncomingInterceptorin interfaceRemotingService
-
getIncomingInterceptors
- Specified by:
getIncomingInterceptorsin interfaceRemotingService
-
removeIncomingInterceptor
- Specified by:
removeIncomingInterceptorin interfaceRemotingService
-
addOutgoingInterceptor
- Specified by:
addOutgoingInterceptorin interfaceRemotingService
-
getOutgoinInterceptors
- Specified by:
getOutgoinInterceptorsin interfaceRemotingService
-
removeOutgoingInterceptor
- Specified by:
removeOutgoingInterceptorin interfaceRemotingService
-
updateProtocols
protected void updateProtocols()
-