public boolean checkLive(TransportConfiguration liveTransportConfiguration) { try { ClusterControl control = clusterController.connectToNode(liveTransportConfiguration); control.close(); return true; } catch (Throwable t) { return false; } }
public void activated() { for (BackupConnector backupConnector : backupConnectors) { backupConnector.close(); } }
public void addClusterChannelHandler(Channel channel, Acceptor acceptorUsed, CoreRemotingConnection remotingConnection, Activation activation) { clusterController.addClusterChannelHandler(channel, acceptorUsed, remotingConnection, activation); }
void start() { stopping = false; backupAnnounced = false; ClusterConnection clusterConnection = clusterManager.getClusterConnection(name); //NB we use the same topology as the sister cluster connection so it knows when started about all the nodes to bridge to backupServerLocator = createServerLocator(clusterConnection.getTopology()); if (backupServerLocator != null) { backupServerLocator.setIdentity("backupLocatorFor='" + server + "'"); backupServerLocator.setReconnectAttempts(-1); backupServerLocator.setInitialConnectAttempts(-1); backupServerLocator.setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(backupServerLocator)); } }
private void pauseClusteringBridges(ActiveMQServer server) throws Exception { for (ClusterConnection clusterConnection : server.getClusterManager().getClusterConnections()) { for (MessageFlowRecord record : ((ClusterConnectionImpl) clusterConnection).getRecords().values()) { record.getBridge().pause(); } } }
protected void stopClusterConnections(final int... nodes) throws Exception { for (int node : nodes) { if (servers[node].isStarted()) { for (ClusterConnection cc : servers[node].getClusterManager().getClusterConnections()) { cc.stop(); cc.flushExecutor(); } } } }
@Override public BridgeMetrics getBridgeMetrics(String nodeId) { final MessageFlowRecord record = records.get(nodeId); return record != null && record.getBridge() != null ? record.getBridge().getMetrics() : null; }
@Override public boolean isNodeActive(String nodeId) { MessageFlowRecord rec = records.get(nodeId); if (rec == null) { return false; } return rec.getBridge().isConnected(); }
public String describe() { StringWriter str = new StringWriter(); PrintWriter out = new PrintWriter(str); out.println("Information on " + this); out.println("*******************************************************"); for (ClusterConnection conn : cloneClusterConnections()) { out.println(conn.describe()); } out.println("*******************************************************"); return str.toString(); }
/** * connect to an already defined node in the cluster * * @param sf the session factory * @return the Cluster Control */ public ClusterControl connectToNodeInCluster(ClientSessionFactoryInternal sf) { sf.getServerLocator().setProtocolManagerFactory(ActiveMQServerSideProtocolManagerFactory.getInstance(sf.getServerLocator())); return new ClusterControl(sf, server); }
public static ActiveMQServerSideProtocolManagerFactory getInstance(ServerLocator locator) { ActiveMQServerSideProtocolManagerFactory instance = new ActiveMQServerSideProtocolManagerFactory(); instance.setLocator(locator); return instance; }
public boolean isBackupAnnounced() { for (BackupConnector backupConnector : backupConnectors) { if (!backupConnector.isBackupAnnounced()) { return false; } } return true; }
@Override public void destroyBridge(String name) throws Exception { if (clusterManager != null) { clusterManager.destroyBridge(name); } }
public void announceBackup() { for (BackupConnector backupConnector : backupConnectors) { backupConnector.announceBackup(); } }
public void close() { if (clusterControl != null) { clusterControl.close(); } } }
@Override public void deployBridge(BridgeConfiguration config) throws Exception { if (clusterManager != null) { clusterManager.deployBridge(config); } }
@Override public ClientProtocolManager newProtocolManager() { return new ActiveMQReplicationProtocolManager(); }
public QuorumManager getQuorumManager() { return clusterController.getQuorumManager(); }
public void informTopology() { clusterManager.informClusterOfBackup(name); }
@Override public synchronized void stop() { if (!started) return; for (BackupConnector backupConnector : backupConnectors) { backupConnector.close(); } started = false; }