org.apache.activemq.artemis.core.server.cluster.ClusterController

Here are the examples of the java api class org.apache.activemq.artemis.core.server.cluster.ClusterController taken from open source projects.

1. ColocatedHAManager#requestBackup()

View license
/**
    * send a request to a live server to start a backup for us
    *
    * @param connectorPair the connector for the node to request a backup from
    * @param backupSize    the current size of the requested nodes backups
    * @param replicated
    * @return true if the request wa successful.
    * @throws Exception
    */
public boolean requestBackup(Pair<TransportConfiguration, TransportConfiguration> connectorPair, int backupSize, boolean replicated) throws Exception {
    ClusterController clusterController = server.getClusterManager().getClusterController();
    try (ClusterControl clusterControl = clusterController.connectToNode(connectorPair.getA())) {
        clusterControl.authorize();
        if (replicated) {
            return clusterControl.requestReplicatedBackup(backupSize, server.getNodeID());
        } else {
            return clusterControl.requestSharedStoreBackup(backupSize, server.getConfiguration().getJournalLocation().getAbsolutePath(), server.getConfiguration().getBindingsLocation().getAbsolutePath(), server.getConfiguration().getLargeMessagesLocation().getAbsolutePath(), server.getConfiguration().getPagingLocation().getAbsolutePath());
        }
    }
}

2. ReplicationTest#testClusterConnectionConfigs()

View license
@Test
public void testClusterConnectionConfigs() throws Exception {
    final long ttlOverride = 123456789;
    final long checkPeriodOverride = 987654321;
    ExtraConfigurer configurer = new ExtraConfigurer() {

        @Override
        public void config(Configuration liveConfig, Configuration backupConfig) {
            List<ClusterConnectionConfiguration> ccList = backupConfig.getClusterConfigurations();
            assertTrue(ccList.size() > 0);
            ClusterConnectionConfiguration cc = ccList.get(0);
            cc.setConnectionTTL(ttlOverride);
            cc.setClientFailureCheckPeriod(checkPeriodOverride);
        }
    };
    this.setupServer(true, true, configurer);
    assertTrue(backupServer instanceof ActiveMQServerImpl);
    ClusterController controller = backupServer.getClusterManager().getClusterController();
    ServerLocator replicationLocator = controller.getReplicationLocator();
    assertNotNull(replicationLocator);
    assertEquals(ttlOverride, replicationLocator.getConnectionTTL());
    assertEquals(checkPeriodOverride, replicationLocator.getClientFailureCheckPeriod());
}