Search in sources :

Example 1 with NetworkPartitionMessage

use of org.apache.geode.distributed.internal.membership.gms.messages.NetworkPartitionMessage in project geode by apache.

the class GMSJoinLeave method sendNetworkPartitionMessage.

/**
   * Sends a message declaring a network partition to the members of the given view via Messenger
   *
   * @param view
   */
void sendNetworkPartitionMessage(NetView view) {
    List<InternalDistributedMember> recipients = new ArrayList<>(view.getMembers());
    recipients.remove(localAddress);
    NetworkPartitionMessage msg = new NetworkPartitionMessage(recipients);
    try {
        services.getMessenger().send(msg);
    } catch (RuntimeException e) {
        logger.debug("unable to send network partition message - continuing", e);
    }
}
Also used : NetworkPartitionMessage(org.apache.geode.distributed.internal.membership.gms.messages.NetworkPartitionMessage) InternalDistributedMember(org.apache.geode.distributed.internal.membership.InternalDistributedMember) ArrayList(java.util.ArrayList)

Example 2 with NetworkPartitionMessage

use of org.apache.geode.distributed.internal.membership.gms.messages.NetworkPartitionMessage in project geode by apache.

the class GMSJoinLeaveJUnitTest method testNetworkPartitionMessageReceived.

// Possibly modify test to check for network partition message in the force disconnect
@Test
public void testNetworkPartitionMessageReceived() throws Exception {
    initMocks();
    GMSJoinLeaveTestHelper.becomeCoordinatorForTest(gmsJoinLeave);
    NetworkPartitionMessage message = new NetworkPartitionMessage();
    gmsJoinLeave.processMessage(message);
    verify(manager).forceDisconnect(isA(String.class));
}
Also used : NetworkPartitionMessage(org.apache.geode.distributed.internal.membership.gms.messages.NetworkPartitionMessage) Test(org.junit.Test) MembershipTest(org.apache.geode.test.junit.categories.MembershipTest) IntegrationTest(org.apache.geode.test.junit.categories.IntegrationTest)

Aggregations

NetworkPartitionMessage (org.apache.geode.distributed.internal.membership.gms.messages.NetworkPartitionMessage)2 ArrayList (java.util.ArrayList)1 InternalDistributedMember (org.apache.geode.distributed.internal.membership.InternalDistributedMember)1 IntegrationTest (org.apache.geode.test.junit.categories.IntegrationTest)1 MembershipTest (org.apache.geode.test.junit.categories.MembershipTest)1 Test (org.junit.Test)1