Class ClusterConnectionImpl
- java.lang.Object
-
- org.apache.activemq.artemis.core.server.cluster.impl.ClusterConnectionImpl
-
- All Implemented Interfaces:
ClusterTopologyListener,AfterConnectInternalListener,TopologyManager,ActiveMQComponent,ClusterConnection
public final class ClusterConnectionImpl extends Object implements ClusterConnection, AfterConnectInternalListener, TopologyManager
-
-
Constructor Summary
Constructors Constructor Description ClusterConnectionImpl(ClusterManager manager, DiscoveryGroupConfiguration dg, TransportConfiguration connector, SimpleString name, SimpleString address, int minLargeMessageSize, long clientFailureCheckPeriod, long connectionTTL, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int initialConnectAttempts, int reconnectAttempts, long callTimeout, long callFailoverTimeout, boolean useDuplicateDetection, MessageLoadBalancingType messageLoadBalancingType, int confirmationWindowSize, int producerWindowSize, ExecutorFactory executorFactory, ActiveMQServer server, PostOffice postOffice, ManagementService managementService, ScheduledExecutorService scheduledExecutor, int maxHops, NodeManager nodeManager, String clusterUser, String clusterPassword, boolean allowDirectConnectionsOnly, long clusterNotificationInterval, int clusterNotificationAttempts)ClusterConnectionImpl(ClusterManager manager, TransportConfiguration[] staticTranspConfigs, TransportConfiguration connector, SimpleString name, SimpleString address, int minLargeMessageSize, long clientFailureCheckPeriod, long connectionTTL, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int initialConnectAttempts, int reconnectAttempts, long callTimeout, long callFailoverTimeout, boolean useDuplicateDetection, MessageLoadBalancingType messageLoadBalancingType, int confirmationWindowSize, int producerWindowSize, ExecutorFactory executorFactory, ActiveMQServer server, PostOffice postOffice, ManagementService managementService, ScheduledExecutorService scheduledExecutor, int maxHops, NodeManager nodeManager, String clusterUser, String clusterPassword, boolean allowDirectConnectionsOnly, long clusterNotificationInterval, int clusterNotificationAttempts)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddClusterTopologyListener(ClusterTopologyListener listener)Stringdescribe()voiddisconnectRecord(String targetNodeID)voidflushExecutor()BridgeMetricsgetBridgeMetrics(String nodeId)Returns the BridgeMetrics for the bridge to the given node if existslonggetCallTimeout()TransportConfigurationgetConnector()ClusterConnectionMetricsgetMetrics()The metric for this cluster connectionSimpleStringgetName()StringgetNodeID()Map<String,String>getNodes()Only used for tests?Map<String,MessageFlowRecord>getRecords()ActiveMQServergetServer()ServerLocatorInternalgetServerLocator()For tests onlySimpleStringgetSfQueueName(String nodeID)TopologygetTopology()voidinformClusterOfBackup()booleanisNodeActive(String nodeId)booleanisSplitBrainDetection()booleanisStarted()voidnodeAnnounced(long uniqueEventID, String nodeID, String backupGroupName, String scaleDownGroupName, Pair<TransportConfiguration,TransportConfiguration> connectorPair, boolean backup)voidnodeDown(long eventUID, String nodeID)Triggered when a node leaves the cluster.voidnodeUP(TopologyMember topologyMember, boolean last)Triggered when a node joins the cluster.voidonConnection(ClientSessionFactoryInternal sf)voidremoveClusterTopologyListener(ClusterTopologyListener listener)booleanremoveMember(long uniqueEventID, String nodeId)From topologyManagervoidremoveRecord(String targetNodeID)voidsetSplitBrainDetection(boolean splitBrainDetection)This is needed on replication, however we don't need it on shared storage.voidstart()voidstop()StringtoString()booleanupdateMember(long uniqueEventID, String nodeId, TopologyMemberImpl memberInput)This is the implementation of TopologyManager.booleanverify(String clusterUser0, String clusterPassword0)Verifies whether user and password match the ones configured for this ClusterConnection.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.activemq.artemis.core.server.ActiveMQComponent
asyncStop
-
-
-
-
Constructor Detail
-
ClusterConnectionImpl
public ClusterConnectionImpl(ClusterManager manager, TransportConfiguration[] staticTranspConfigs, TransportConfiguration connector, SimpleString name, SimpleString address, int minLargeMessageSize, long clientFailureCheckPeriod, long connectionTTL, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int initialConnectAttempts, int reconnectAttempts, long callTimeout, long callFailoverTimeout, boolean useDuplicateDetection, MessageLoadBalancingType messageLoadBalancingType, int confirmationWindowSize, int producerWindowSize, ExecutorFactory executorFactory, ActiveMQServer server, PostOffice postOffice, ManagementService managementService, ScheduledExecutorService scheduledExecutor, int maxHops, NodeManager nodeManager, String clusterUser, String clusterPassword, boolean allowDirectConnectionsOnly, long clusterNotificationInterval, int clusterNotificationAttempts) throws Exception
- Throws:
Exception
-
ClusterConnectionImpl
public ClusterConnectionImpl(ClusterManager manager, DiscoveryGroupConfiguration dg, TransportConfiguration connector, SimpleString name, SimpleString address, int minLargeMessageSize, long clientFailureCheckPeriod, long connectionTTL, long retryInterval, double retryIntervalMultiplier, long maxRetryInterval, int initialConnectAttempts, int reconnectAttempts, long callTimeout, long callFailoverTimeout, boolean useDuplicateDetection, MessageLoadBalancingType messageLoadBalancingType, int confirmationWindowSize, int producerWindowSize, ExecutorFactory executorFactory, ActiveMQServer server, PostOffice postOffice, ManagementService managementService, ScheduledExecutorService scheduledExecutor, int maxHops, NodeManager nodeManager, String clusterUser, String clusterPassword, boolean allowDirectConnectionsOnly, long clusterNotificationInterval, int clusterNotificationAttempts) throws Exception
- Throws:
Exception
-
-
Method Detail
-
getServerLocator
public ServerLocatorInternal getServerLocator()
For tests only
-
start
public void start() throws Exception- Specified by:
startin interfaceActiveMQComponent- Throws:
Exception
-
flushExecutor
public void flushExecutor()
- Specified by:
flushExecutorin interfaceClusterConnection
-
stop
public void stop() throws Exception- Specified by:
stopin interfaceActiveMQComponent- Throws:
Exception
-
addClusterTopologyListener
public void addClusterTopologyListener(ClusterTopologyListener listener)
- Specified by:
addClusterTopologyListenerin interfaceClusterConnection
-
removeClusterTopologyListener
public void removeClusterTopologyListener(ClusterTopologyListener listener)
- Specified by:
removeClusterTopologyListenerin interfaceClusterConnection
-
getTopology
public Topology getTopology()
- Specified by:
getTopologyin interfaceClusterConnection
-
nodeAnnounced
public void nodeAnnounced(long uniqueEventID, String nodeID, String backupGroupName, String scaleDownGroupName, Pair<TransportConfiguration,TransportConfiguration> connectorPair, boolean backup)- Specified by:
nodeAnnouncedin interfaceClusterConnection
-
updateMember
public boolean updateMember(long uniqueEventID, String nodeId, TopologyMemberImpl memberInput)This is the implementation of TopologyManager. It is used to reject eventual updates from a split brain server.- Specified by:
updateMemberin interfaceTopologyManager- Parameters:
uniqueEventID-nodeId-memberInput-- Returns:
-
removeMember
public boolean removeMember(long uniqueEventID, String nodeId)From topologyManager- Specified by:
removeMemberin interfaceTopologyManager- Parameters:
uniqueEventID-nodeId-- Returns:
-
setSplitBrainDetection
public void setSplitBrainDetection(boolean splitBrainDetection)
Description copied from interface:ClusterConnectionThis is needed on replication, however we don't need it on shared storage.- Specified by:
setSplitBrainDetectionin interfaceClusterConnection
-
isSplitBrainDetection
public boolean isSplitBrainDetection()
- Specified by:
isSplitBrainDetectionin interfaceClusterConnection
-
onConnection
public void onConnection(ClientSessionFactoryInternal sf)
- Specified by:
onConnectionin interfaceAfterConnectInternalListener
-
isStarted
public boolean isStarted()
- Specified by:
isStartedin interfaceActiveMQComponent
-
getName
public SimpleString getName()
- Specified by:
getNamein interfaceClusterConnection
-
getNodeID
public String getNodeID()
- Specified by:
getNodeIDin interfaceClusterConnection
-
getServer
public ActiveMQServer getServer()
- Specified by:
getServerin interfaceClusterConnection
-
isNodeActive
public boolean isNodeActive(String nodeId)
- Specified by:
isNodeActivein interfaceClusterConnection
-
getCallTimeout
public long getCallTimeout()
- Specified by:
getCallTimeoutin interfaceClusterConnection
-
getNodes
public Map<String,String> getNodes()
Description copied from interface:ClusterConnectionOnly used for tests?- Specified by:
getNodesin interfaceClusterConnection- Returns:
- a Map of node ID and addresses
-
getConnector
public TransportConfiguration getConnector()
- Specified by:
getConnectorin interfaceClusterConnection
-
nodeDown
public void nodeDown(long eventUID, String nodeID)Description copied from interface:ClusterTopologyListenerTriggered when a node leaves the cluster.- Specified by:
nodeDownin interfaceClusterTopologyListenernodeID- the id of the node leaving the cluster
-
nodeUP
public void nodeUP(TopologyMember topologyMember, boolean last)
Description copied from interface:ClusterTopologyListenerTriggered when a node joins the cluster.- Specified by:
nodeUPin interfaceClusterTopologyListenerlast- if the whole cluster topology is being transmitted (after adding the listener to the cluster connection) this parameter will betruefor the last topology member.
-
getSfQueueName
public SimpleString getSfQueueName(String nodeID)
-
informClusterOfBackup
public void informClusterOfBackup()
- Specified by:
informClusterOfBackupin interfaceClusterConnection
-
getMetrics
public ClusterConnectionMetrics getMetrics()
Description copied from interface:ClusterConnectionThe metric for this cluster connection- Specified by:
getMetricsin interfaceClusterConnection- Returns:
-
getBridgeMetrics
public BridgeMetrics getBridgeMetrics(String nodeId)
Description copied from interface:ClusterConnectionReturns the BridgeMetrics for the bridge to the given node if exists- Specified by:
getBridgeMetricsin interfaceClusterConnection- Returns:
-
getRecords
public Map<String,MessageFlowRecord> getRecords()
-
describe
public String describe()
- Specified by:
describein interfaceClusterConnection
-
verify
public boolean verify(String clusterUser0, String clusterPassword0)
Description copied from interface:ClusterConnectionVerifies whether user and password match the ones configured for this ClusterConnection.- Specified by:
verifyin interfaceClusterConnection- Returns:
trueif username and password match,falseotherwise.
-
removeRecord
public void removeRecord(String targetNodeID)
- Specified by:
removeRecordin interfaceClusterConnection
-
disconnectRecord
public void disconnectRecord(String targetNodeID)
- Specified by:
disconnectRecordin interfaceClusterConnection
-
-