/** * test hook * @return the current membership view coordinator */ public DistributedMember getCoordinator() { // note - we go straight to JoinLeave because the // DistributionManager queues view changes in a serial executor, where // they're asynchronously installed. The DS may still see the old coordinator latestViewLock.readLock().lock(); try { return latestView == null? null : latestView.getCoordinator(); } finally { latestViewLock.readLock().unlock(); } }
/** * Returns the coordinator of this view, rejecting any in the * given collection of IDs */ public InternalDistributedMember getCoordinator(Collection<InternalDistributedMember> rejections) { if (rejections == null) { return getCoordinator(); } synchronized (members) { for (InternalDistributedMember addr : members) { if (addr.getNetMember().preferredForCoordinator() && !rejections.contains(addr)) { return addr; } } for (InternalDistributedMember addr: members) { if (!rejections.contains(addr)) { return addr; } } } return null; }
@Override public void installView(NetView v) { this.view = v; if (this.jgAddress.getVmViewId() < 0) { this.jgAddress.setVmViewId(this.localAddress.getVmViewId()); } List<JGAddress> mbrs = new ArrayList<JGAddress>(v.size()); for (InternalDistributedMember idm: v.getMembers()) { mbrs.add(new JGAddress(idm)); } ViewId vid = new ViewId(new JGAddress(v.getCoordinator()), v.getViewId()); View jgv = new View(vid, new ArrayList<Address>(mbrs)); logger.trace("installing JGroups view: {}", jgv); this.myChannel.down(new Event(Event.VIEW_CHANGE, jgv)); addressesWithioExceptionsProcessed.clear(); }
private void processFindCoordinatorRequest(FindCoordinatorRequest req) { FindCoordinatorResponse resp; if (this.isJoined) { NetView v = currentView; resp = new FindCoordinatorResponse(v.getCoordinator(), localAddress); } else { resp = new FindCoordinatorResponse(localAddress, localAddress); } resp.setRecipient(req.getMemberID()); services.getMessenger().send(resp); }
if (viewId > findRequest.getLastViewId()) { coord = v.getCoordinator(Collections.<InternalDistributedMember>emptyList()); } else { coord = v.getCoordinator(findRequest.getRejectedCoordinators());
if (cv.getCoordinator().equals(localAddress)) { for (SuspectRequest req: incomingRequest.getMembers()) { logger.info("received suspect message from {} for {}: {}", InternalDistributedMember coordinator = check.getCoordinator(); if (coordinator != null && coordinator.equals(localAddress)) {
check.removeAll(leftMembers); if (check.getCoordinator().equals(localAddress)) { synchronized(viewInstallationLock) { becomeCoordinator(mbr);
private void sendHeartbeats(List<InternalDistributedMember> mbrs, int startIndex) { InternalDistributedMember coordinator = currentView.getCoordinator(); if (coordinator != null && !coordinator.equals(localAddress)) { HeartbeatMessage message = new HeartbeatMessage(-1);
check.removeAll(leftMembers); if (check.getCoordinator().equals(localAddress)) { synchronized(viewInstallationLock) { becomeCoordinator(incomingRequest.getMemberID());