org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy

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

1. ActiveMQServerControlImpl#scaleDown()

View license
@Override
public void scaleDown(String connector) throws Exception {
    checkStarted();
    clearIO();
    HAPolicy haPolicy = server.getHAPolicy();
    if (haPolicy instanceof LiveOnlyPolicy) {
        LiveOnlyPolicy liveOnlyPolicy = (LiveOnlyPolicy) haPolicy;
        if (liveOnlyPolicy.getScaleDownPolicy() == null) {
            liveOnlyPolicy.setScaleDownPolicy(new ScaleDownPolicy());
        }
        liveOnlyPolicy.getScaleDownPolicy().setEnabled(true);
        if (connector != null) {
            liveOnlyPolicy.getScaleDownPolicy().getConnectors().add(0, connector);
        }
        server.stop(true);
    }
}

2. FailoverTest#testFailBack()

Project: activemq-artemis
Source File: FailoverTest.java
View license
/**
    * Basic fail-back test.
    *
    * @throws Exception
    */
@Test
public void testFailBack() throws Exception {
    boolean doFailBack = true;
    HAPolicy haPolicy = backupServer.getServer().getHAPolicy();
    if (haPolicy instanceof ReplicaPolicy) {
        ((ReplicaPolicy) haPolicy).setMaxSavedReplicatedJournalsSize(0);
    }
    simpleReplication(doFailBack);
}