@Test public void ringDeletionsOnly() { final MembershipView mview = new MembershipView(K); final int numNodes = 10; int numThrows = 0; for (int i = 0; i < numNodes; i++) { try { mview.ringDelete(Utils.hostFromParts("127.0.0.1", i)); } catch (final MembershipView.NodeNotInRingException e) { numThrows++; } } assertEquals(numNodes, numThrows); }
void ringDelete(final Endpoint node) { Objects.requireNonNull(node); rwLock.writeLock().lock(); try { if (!rings.get(0).contains(node)) { throw new NodeNotInRingException(node); } final Set<Endpoint> affectedSubjects = new HashSet<>(); for (int k = 0; k < K; k++) { final NavigableSet<Endpoint> endpoints = rings.get(k); final Endpoint oldSubject = endpoints.lower(node); if (oldSubject != null) { affectedSubjects.add(oldSubject); } endpoints.remove(node); addressComparators.get(k).removeEndpoint(node); cachedObservers.remove(node); } allNodes.remove(node); for (final Endpoint subject : affectedSubjects) { cachedObservers.remove(subject); } shouldUpdateConfigurationId = true; } finally { rwLock.writeLock().unlock(); } }
MembershipView { void ringDelete(final Endpoint node) { Objects.requireNonNull(node); rwLock.writeLock().lock(); try { if (!rings.get(0).contains(node)) { throw new NodeNotInRingException(node); } final Set<Endpoint> affectedSubjects = new HashSet<>(); for (int k = 0; k < K; k++) { final NavigableSet<Endpoint> endpoints = rings.get(k); final Endpoint oldSubject = endpoints.lower(node); if (oldSubject != null) { affectedSubjects.add(oldSubject); } endpoints.remove(node); addressComparators.get(k).removeEndpoint(node); cachedObservers.remove(node); } allNodes.remove(node); for (final Endpoint subject : affectedSubjects) { cachedObservers.remove(subject); } shouldUpdateConfigurationId = true; } finally { rwLock.writeLock().unlock(); } } }
MembershipView { void ringDelete(final Endpoint node) { Objects.requireNonNull(node); rwLock.writeLock().lock(); try { if (!rings.get(0).contains(node)) { throw new NodeNotInRingException(node); } final Set<Endpoint> affectedSubjects = new HashSet<>(); for (int k = 0; k < K; k++) { final NavigableSet<Endpoint> endpoints = rings.get(k); final Endpoint oldSubject = endpoints.lower(node); if (oldSubject != null) { affectedSubjects.add(oldSubject); } endpoints.remove(node); addressComparators.get(k).removeEndpoint(node); cachedObservers.remove(node); } allNodes.remove(node); for (final Endpoint subject : affectedSubjects) { cachedObservers.remove(subject); } shouldUpdateConfigurationId = true; } finally { rwLock.writeLock().unlock(); } } MembershipView(final int K);   MembershipView(final int K, final Collection<NodeId> nodeIds,
                   final Collection<Endpoint> endpoints); }
MembershipView { void ringDelete(final Endpoint node) { Objects.requireNonNull(node); rwLock.writeLock().lock(); try { if (!rings.get(0).contains(node)) { throw new NodeNotInRingException(node); } final Set<Endpoint> affectedSubjects = new HashSet<>(); for (int k = 0; k < K; k++) { final NavigableSet<Endpoint> endpoints = rings.get(k); final Endpoint oldSubject = endpoints.lower(node); if (oldSubject != null) { affectedSubjects.add(oldSubject); } endpoints.remove(node); addressComparators.get(k).removeEndpoint(node); cachedObservers.remove(node); } allNodes.remove(node); for (final Endpoint subject : affectedSubjects) { cachedObservers.remove(subject); } shouldUpdateConfigurationId = true; } finally { rwLock.writeLock().unlock(); } } MembershipView(final int K);   MembershipView(final int K, final Collection<NodeId> nodeIds,
                   final Collection<Endpoint> endpoints);  }
MembershipView { void ringDelete(final Endpoint node) { Objects.requireNonNull(node); rwLock.writeLock().lock(); try { if (!rings.get(0).contains(node)) { throw new NodeNotInRingException(node); } final Set<Endpoint> affectedSubjects = new HashSet<>(); for (int k = 0; k < K; k++) { final NavigableSet<Endpoint> endpoints = rings.get(k); final Endpoint oldSubject = endpoints.lower(node); if (oldSubject != null) { affectedSubjects.add(oldSubject); } endpoints.remove(node); addressComparators.get(k).removeEndpoint(node); cachedObservers.remove(node); } allNodes.remove(node); for (final Endpoint subject : affectedSubjects) { cachedObservers.remove(subject); } shouldUpdateConfigurationId = true; } finally { rwLock.writeLock().unlock(); } } MembershipView(final int K);   MembershipView(final int K, final Collection<NodeId> nodeIds,
                   final Collection<Endpoint> endpoints);   }