Search in sources :

Example 1 with SharedNothingLiveActivation

use of org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation in project activemq-artemis by apache.

the class ActiveMQServerControlImpl method freezeReplication.

@Override
public boolean freezeReplication() {
    Activation activation = server.getActivation();
    if (activation instanceof SharedNothingLiveActivation) {
        SharedNothingLiveActivation liveActivation = (SharedNothingLiveActivation) activation;
        liveActivation.freezeReplication();
        return true;
    }
    return false;
}
Also used : SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation)

Example 2 with SharedNothingLiveActivation

use of org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation in project activemq-artemis by apache.

the class QuorumFailOverTest method testQuorumVotingLiveNotDead.

@Test
public void testQuorumVotingLiveNotDead() throws Exception {
    int[] liveServerIDs = new int[] { 0, 1, 2 };
    setupCluster();
    startServers(0, 1, 2);
    new BackupSyncDelay(servers[4], servers[1], PacketImpl.REPLICATION_SCHEDULED_FAILOVER);
    startServers(3, 4, 5);
    for (int i : liveServerIDs) {
        waitForTopology(servers[i], 3, 3);
    }
    waitForFailoverTopology(3, 0, 1, 2);
    waitForFailoverTopology(4, 0, 1, 2);
    waitForFailoverTopology(5, 0, 1, 2);
    for (int i : liveServerIDs) {
        setupSessionFactory(i, i + 3, isNetty(), false);
        createQueue(i, QUEUES_TESTADDRESS, QUEUE_NAME, null, true);
        addConsumer(i, i, QUEUE_NAME, null);
    }
    waitForBindings(0, QUEUES_TESTADDRESS, 1, 1, true);
    waitForBindings(1, QUEUES_TESTADDRESS, 1, 1, true);
    waitForBindings(2, QUEUES_TESTADDRESS, 1, 1, true);
    send(0, QUEUES_TESTADDRESS, 10, false, null);
    verifyReceiveRoundRobinInSomeOrder(true, 10, 0, 1, 2);
    final TopologyListener liveTopologyListener = new TopologyListener("LIVE-1");
    locators[0].addClusterTopologyListener(liveTopologyListener);
    assertTrue("we assume 3 is a backup", servers[3].getHAPolicy().isBackup());
    assertFalse("no shared storage", servers[3].getHAPolicy().isSharedStore());
    SharedNothingLiveActivation liveActivation = (SharedNothingLiveActivation) servers[0].getActivation();
    liveActivation.freezeReplication();
    assertFalse(servers[0].isReplicaSync());
    waitForRemoteBackupSynchronization(servers[0]);
    assertTrue(servers[0].isReplicaSync());
}
Also used : BackupSyncDelay(org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) ClusterTopologyListener(org.apache.activemq.artemis.api.core.client.ClusterTopologyListener) Test(org.junit.Test)

Example 3 with SharedNothingLiveActivation

use of org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation in project activemq-artemis by apache.

the class HAPolicyConfigurationTest method ReplicatedTest.

@Test
public void ReplicatedTest() throws Exception {
    Configuration configuration = createConfiguration("replicated-hapolicy-config.xml");
    ActiveMQServerImpl server = new ActiveMQServerImpl(configuration);
    try {
        server.start();
        Activation activation = server.getActivation();
        assertTrue(activation instanceof SharedNothingLiveActivation);
        HAPolicy haPolicy = server.getHAPolicy();
        assertTrue(haPolicy instanceof ReplicatedPolicy);
        ReplicatedPolicy replicatedPolicy = (ReplicatedPolicy) haPolicy;
        assertEquals(replicatedPolicy.getGroupName(), "purple");
        assertTrue(replicatedPolicy.isCheckForLiveServer());
        assertEquals(replicatedPolicy.getClusterName(), "abcdefg");
        assertEquals(replicatedPolicy.getInitialReplicationSyncTimeout(), 9876);
    } finally {
        server.stop();
    }
}
Also used : Configuration(org.apache.activemq.artemis.core.config.Configuration) StoreConfiguration(org.apache.activemq.artemis.core.config.StoreConfiguration) HAPolicyConfiguration(org.apache.activemq.artemis.core.config.HAPolicyConfiguration) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) HAPolicy(org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy) ReplicatedPolicy(org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy) SharedNothingBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation) ColocatedActivation(org.apache.activemq.artemis.core.server.impl.ColocatedActivation) Activation(org.apache.activemq.artemis.core.server.impl.Activation) SharedNothingLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation) SharedStoreLiveActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation) SharedStoreBackupActivation(org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation) LiveOnlyActivation(org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation) ActiveMQServerImpl(org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl) Test(org.junit.Test)

Aggregations

SharedNothingLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingLiveActivation)3 Activation (org.apache.activemq.artemis.core.server.impl.Activation)2 Test (org.junit.Test)2 ClusterTopologyListener (org.apache.activemq.artemis.api.core.client.ClusterTopologyListener)1 Configuration (org.apache.activemq.artemis.core.config.Configuration)1 HAPolicyConfiguration (org.apache.activemq.artemis.core.config.HAPolicyConfiguration)1 StoreConfiguration (org.apache.activemq.artemis.core.config.StoreConfiguration)1 HAPolicy (org.apache.activemq.artemis.core.server.cluster.ha.HAPolicy)1 ReplicatedPolicy (org.apache.activemq.artemis.core.server.cluster.ha.ReplicatedPolicy)1 ActiveMQServerImpl (org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl)1 ColocatedActivation (org.apache.activemq.artemis.core.server.impl.ColocatedActivation)1 LiveOnlyActivation (org.apache.activemq.artemis.core.server.impl.LiveOnlyActivation)1 SharedNothingBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedNothingBackupActivation)1 SharedStoreBackupActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreBackupActivation)1 SharedStoreLiveActivation (org.apache.activemq.artemis.core.server.impl.SharedStoreLiveActivation)1 BackupSyncDelay (org.apache.activemq.artemis.tests.integration.cluster.util.BackupSyncDelay)1