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

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

1. ScaleDownHandler#scaleDown()

View license
public long scaleDown(ClientSessionFactory sessionFactory, ResourceManager resourceManager, Map<SimpleString, List<Pair<byte[], Long>>> duplicateIDMap, SimpleString managementAddress, SimpleString targetNodeId) throws Exception {
    ClusterControl clusterControl = clusterController.connectToNodeInCluster((ClientSessionFactoryInternal) sessionFactory);
    clusterControl.authorize();
    long num = scaleDownMessages(sessionFactory, targetNodeId, clusterControl.getClusterUser(), clusterControl.getClusterPassword());
    ActiveMQServerLogger.LOGGER.info("Scaled down " + num + " messages total.");
    scaleDownTransactions(sessionFactory, resourceManager, clusterControl.getClusterUser(), clusterControl.getClusterPassword());
    scaleDownDuplicateIDs(duplicateIDMap, sessionFactory, managementAddress, clusterControl.getClusterUser(), clusterControl.getClusterPassword());
    clusterControl.announceScaleDown(new SimpleString(this.targetNodeId), nodeManager.getNodeId());
    return num;
}

2. 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());
        }
    }
}