use of org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage in project geode by apache.
the class GMSJoinLeave method sendRemoveMessages.
private void sendRemoveMessages(List<InternalDistributedMember> removals, List<String> reasons, Set<InternalDistributedMember> oldIds) {
Iterator<String> reason = reasons.iterator();
for (InternalDistributedMember mbr : removals) {
// if olds not contains mbr then send remove request
if (!oldIds.contains(mbr)) {
RemoveMemberMessage response = new RemoveMemberMessage(mbr, mbr, reason.next());
services.getMessenger().send(response);
} else {
reason.next();
}
}
}
use of org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage in project geode by apache.
the class GMSJoinLeave method remove.
@Override
public void remove(InternalDistributedMember m, String reason) {
NetView v = this.currentView;
services.getCancelCriterion().checkCancelInProgress(null);
if (v != null && v.contains(m)) {
Set<InternalDistributedMember> filter = new HashSet<>();
filter.add(m);
RemoveMemberMessage msg = new RemoveMemberMessage(v.getPreferredCoordinators(filter, getMemberID(), 5), m, reason);
msg.setSender(this.localAddress);
processRemoveRequest(msg);
if (!this.isCoordinator) {
msg.resetRecipients();
msg.setRecipients(v.getPreferredCoordinators(Collections.emptySet(), localAddress, 10));
services.getMessenger().send(msg);
}
} else {
RemoveMemberMessage msg = new RemoveMemberMessage(m, m, reason);
services.getMessenger().send(msg);
}
}
use of org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage in project geode by apache.
the class GMSJoinLeaveJUnitTest method testRemoveCausesForcedDisconnect.
@Test
public void testRemoveCausesForcedDisconnect() throws Exception {
String reason = "testing";
initMocks();
prepareAndInstallView(mockMembers[0], createMemberList(mockMembers[0], gmsJoinLeaveMemberId));
gmsJoinLeave.getView().add(mockMembers[1]);
RemoveMemberMessage msg = new RemoveMemberMessage(mockMembers[0], gmsJoinLeave.getMemberID(), reason);
msg.setSender(mockMembers[1]);
gmsJoinLeave.processMessage(msg);
verify(manager).forceDisconnect(reason);
}
use of org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage in project geode by apache.
the class GMSJoinLeaveJUnitTest method processRemoveMessage.
private void processRemoveMessage(InternalDistributedMember rMember) {
RemoveMemberMessage msg = new RemoveMemberMessage(gmsJoinLeave.getMemberID(), rMember, "testing");
msg.setSender(gmsJoinLeave.getMemberID());
gmsJoinLeave.processMessage(msg);
}
use of org.apache.geode.distributed.internal.membership.gms.messages.RemoveMemberMessage in project geode by apache.
the class GMSJoinLeaveJUnitTest method testViewNotSentWhenShuttingDown.
@Test
public void testViewNotSentWhenShuttingDown() throws Exception {
try {
initMocks(false);
System.setProperty(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY, "true");
gmsJoinLeave.join();
installView(1, gmsJoinLeaveMemberId, createMemberList(mockMembers[0], mockMembers[1], mockMembers[2], gmsJoinLeaveMemberId, mockMembers[3]));
assertTrue(gmsJoinLeave.getViewCreator().isAlive());
when(manager.shutdownInProgress()).thenReturn(Boolean.TRUE);
for (int i = 1; i < 4; i++) {
RemoveMemberMessage msg = new RemoveMemberMessage(gmsJoinLeaveMemberId, mockMembers[i], "crashed");
msg.setSender(gmsJoinLeaveMemberId);
gmsJoinLeave.processMessage(msg);
}
Awaitility.await("waiting for view creator to stop").atMost(5000, MILLISECONDS).until(() -> !gmsJoinLeave.getViewCreator().isAlive());
assertEquals(1, gmsJoinLeave.getView().getViewId());
} finally {
System.getProperties().remove(GMSJoinLeave.BYPASS_DISCOVERY_PROPERTY);
}
}
Aggregations