Class ClusterController
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.cluster.ClusterController
-
- All Implemented Interfaces:
ActiveMQComponent
public class ClusterController extends Object implements ActiveMQComponent
used for creating and managing cluster control connections for each cluster connection and the replication connection
-
-
Constructor Summary
Constructors Constructor Description ClusterController(ActiveMQServer server, ScheduledExecutorService scheduledExecutor)ClusterController(ActiveMQServer server, ScheduledExecutorService scheduledExecutor, boolean useQuorumManager)
-
Method Summary
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
-
-
-
Constructor Detail
-
ClusterController
public ClusterController(ActiveMQServer server, ScheduledExecutorService scheduledExecutor, boolean useQuorumManager)
-
ClusterController
public ClusterController(ActiveMQServer server, ScheduledExecutorService scheduledExecutor)
-
-
Method Detail
-
getDefaultLocator
public ServerLocator getDefaultLocator()
For tests only
-
start
public void start() throws Exception- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
addClusterTopologyListener
public void addClusterTopologyListener(ClusterTopologyListener clusterTopologyListener)
It addsclusterTopologyListenertodefaultLocator.
-
removeClusterTopologyListener
public void removeClusterTopologyListener(ClusterTopologyListener clusterTopologyListener)
It removeclusterTopologyListenerfromdefaultLocator.
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceActiveMQComponent
-
getQuorumManager
public QuorumManager getQuorumManager()
-
setDefaultClusterConnectionName
public void setDefaultClusterConnectionName(SimpleString defaultClusterConnection)
-
addClusterConnection
public void addClusterConnection(SimpleString name, DiscoveryGroupConfiguration dg, ClusterConnectionConfiguration config, TransportConfiguration connector)
add a locator for a cluster connection.- Parameters:
name- the cluster connection namedg- the discovery group to useconfig- the cluster connection configconnector- the cluster connector configuration
-
addClusterConnection
public void addClusterConnection(SimpleString name, TransportConfiguration[] tcConfigs, ClusterConnectionConfiguration config, TransportConfiguration connector)
add a locator for a cluster connection.- Parameters:
name- the cluster connection nametcConfigs- the transport configurations to use
-
addClusterTopologyListenerForReplication
public void addClusterTopologyListenerForReplication(ClusterTopologyListener listener)
add a cluster listener- Parameters:
listener-
-
removeClusterTopologyListenerForReplication
public void removeClusterTopologyListenerForReplication(ClusterTopologyListener listener)
add a cluster listener- Parameters:
listener-
-
addIncomingInterceptorForReplication
public void addIncomingInterceptorForReplication(Interceptor interceptor)
add an interceptor- Parameters:
interceptor-
-
removeIncomingInterceptorForReplication
public void removeIncomingInterceptorForReplication(Interceptor interceptor)
remove an interceptor- Parameters:
interceptor-
-
connectToNode
public ClusterControl connectToNode(TransportConfiguration transportConfiguration) throws Exception
connect to a specific node in the cluster used for replication- Parameters:
transportConfiguration- the configuration of the node to connect to.- Returns:
- the Cluster Control
- Throws:
Exception
-
connectToNodeInReplicatedCluster
public ClusterControl connectToNodeInReplicatedCluster(TransportConfiguration transportConfiguration) throws Exception
connect to a specific node in the cluster used for replication- Parameters:
transportConfiguration- the configuration of the node to connect to.- Returns:
- the Cluster Control
- Throws:
Exception
-
connectToNodeInCluster
public ClusterControl connectToNodeInCluster(ClientSessionFactoryInternal sf)
connect to an already defined node in the cluster- Parameters:
sf- the session factory- Returns:
- the Cluster Control
-
getRetryIntervalForReplicatedCluster
public long getRetryIntervalForReplicatedCluster()
retry interval for connecting to the cluster- Returns:
- the retry interval
-
awaitConnectionToReplicationCluster
public void awaitConnectionToReplicationCluster() throws InterruptedExceptionwait until we have connected to the cluster.- Throws:
InterruptedException
-
addClusterChannelHandler
public void addClusterChannelHandler(Channel channel, Acceptor acceptorUsed, CoreRemotingConnection remotingConnection, Activation activation)
used to set a channel handler on the connection that can be used by the cluster control- Parameters:
channel- the channel to set the handleracceptorUsed- the acceptor used for connectionremotingConnection- the connection itselfactivation-
-
getDefaultClusterSize
public int getDefaultClusterSize()
-
getDefaultClusterTopology
public Topology getDefaultClusterTopology()
-
getNodeID
public SimpleString getNodeID()
-
getIdentity
public String getIdentity()
-
setReplicatedClusterName
public void setReplicatedClusterName(String replicatedClusterName)
-
getLocators
public Map<SimpleString,ServerLocatorInternal> getLocators()
-
getReplicationLocator
public ServerLocator getReplicationLocator()
-
getServerLocator
public ServerLocator getServerLocator(SimpleString name)
-
-