use of org.apache.geode.distributed.internal.membership.NetView in project geode by apache.
the class GMSMembershipManager method memberExists.
public boolean memberExists(DistributedMember m) {
latestViewReadLock.lock();
NetView v = latestView;
latestViewReadLock.unlock();
return v.contains(m);
}
use of org.apache.geode.distributed.internal.membership.NetView in project geode by apache.
the class JGroupsMessenger method handleJGroupsIOException.
/**
* If JGroups is unable to send a message it may mean that the network is down. If so we need to
* initiate suspect processing on the recipient.
* <p>
* see Transport._send()
*/
@SuppressWarnings("UnusedParameters")
public void handleJGroupsIOException(IOException e, Address dest) {
if (services.getManager().shutdownInProgress()) {
// shutdown
return;
}
if (addressesWithIoExceptionsProcessed.contains(dest)) {
return;
}
addressesWithIoExceptionsProcessed.add(dest);
NetView v = this.view;
JGAddress jgMbr = (JGAddress) dest;
if (jgMbr != null && v != null) {
List<InternalDistributedMember> members = v.getMembers();
InternalDistributedMember recipient = null;
for (InternalDistributedMember mbr : members) {
GMSMember gmsMbr = ((GMSMember) mbr.getNetMember());
if (jgMbr.getUUIDLsbs() == gmsMbr.getUuidLSBs() && jgMbr.getUUIDMsbs() == gmsMbr.getUuidMSBs() && jgMbr.getVmViewId() == gmsMbr.getVmViewId()) {
recipient = mbr;
break;
}
}
if (recipient != null) {
services.getHealthMonitor().suspect(recipient, "Unable to send messages to this member via JGroups");
}
}
}
use of org.apache.geode.distributed.internal.membership.NetView in project geode by apache.
the class JGroupsMessenger method getQuorumChecker.
public QuorumChecker getQuorumChecker() {
NetView view = this.view;
if (view == null) {
view = services.getJoinLeave().getView();
if (view == null) {
view = services.getJoinLeave().getPreviousView();
if (view == null) {
return null;
}
}
}
GMSQuorumChecker qc = new GMSQuorumChecker(view, services.getConfig().getLossThreshold(), this.myChannel);
qc.initialize();
return qc;
}
use of org.apache.geode.distributed.internal.membership.NetView in project geode by apache.
the class GMSHealthMonitor method processSuspectMembersRequest.
/**
* Process a Suspect request from another member. This may cause this member to become the new
* membership coordinator. it will to final check on that member and then it will send remove
* request for that member
*/
private void processSuspectMembersRequest(SuspectMembersMessage incomingRequest) {
this.stats.incSuspectsReceived();
NetView cv = currentView;
if (cv == null) {
return;
}
List<SuspectRequest> sMembers = incomingRequest.getMembers();
InternalDistributedMember sender = incomingRequest.getSender();
int viewId = sender.getVmViewId();
if (cv.getViewId() >= viewId && !cv.contains(incomingRequest.getSender())) {
logger.info("Membership ignoring suspect request for " + incomingRequest + " from non-member " + incomingRequest.getSender());
services.getJoinLeave().remove(sender, "this process is initiating suspect processing but is no longer a member");
return;
}
// take care of any suspicion of this member by sending a heartbeat back
if (!playingDead) {
for (Iterator<SuspectRequest> it = incomingRequest.getMembers().iterator(); it.hasNext(); ) {
SuspectRequest req = it.next();
if (req.getSuspectMember().equals(localAddress)) {
HeartbeatMessage message = new HeartbeatMessage(-1);
message.setRecipient(sender);
try {
services.getMessenger().send(message);
this.stats.incHeartbeatsSent();
it.remove();
} catch (CancelException e) {
return;
}
}
}
}
if (cv.getCoordinator().equals(localAddress)) {
for (SuspectRequest req : incomingRequest.getMembers()) {
logger.info("received suspect message from {} for {}: {}", sender, req.getSuspectMember(), req.getReason());
}
checkIfAvailable(sender, sMembers, cv);
} else // coordinator ends
{
NetView check = new NetView(cv, cv.getViewId() + 1);
ArrayList<SuspectRequest> smbr = new ArrayList<>();
synchronized (viewVsSuspectedMembers) {
recordSuspectRequests(sMembers, cv);
Set<SuspectRequest> viewVsMembers = viewVsSuspectedMembers.get(cv);
for (final SuspectRequest sr : viewVsMembers) {
check.remove(sr.getSuspectMember());
smbr.add(sr);
}
}
InternalDistributedMember coordinator = check.getCoordinator();
if (coordinator != null && coordinator.equals(localAddress)) {
// new coordinator
for (SuspectRequest req : incomingRequest.getMembers()) {
logger.info("received suspect message from {} for {}: {}", sender, req.getSuspectMember(), req.getReason());
}
checkIfAvailable(sender, smbr, cv);
} else {
recordSuspectRequests(sMembers, cv);
}
}
}
use of org.apache.geode.distributed.internal.membership.NetView in project geode by apache.
the class GMSHealthMonitor method checkMember.
private void checkMember(final InternalDistributedMember mbr) {
final NetView cv = GMSHealthMonitor.this.currentView;
// as check may take time
setNextNeighbor(cv, mbr);
// we need to check this member
checkExecutor.execute(() -> {
boolean pinged = false;
try {
pinged = GMSHealthMonitor.this.doCheckMember(mbr, true);
} catch (CancelException e) {
return;
}
if (!pinged) {
suspectedMemberInView.put(mbr, currentView);
String reason = "Member isn't responding to heartbeat requests";
GMSHealthMonitor.this.initiateSuspicion(mbr, reason);
} else {
logger.trace("Setting next neighbor as member {} has responded.", mbr);
suspectedMemberInView.remove(mbr);
// back to previous one
setNextNeighbor(GMSHealthMonitor.this.currentView, null);
}
});
}
Aggregations