/** * @return Collection of readers after check. * @throws GridCacheEntryRemovedException If removed. */ public Collection<ReaderId> checkReaders() throws GridCacheEntryRemovedException { synchronized (mux) { checkObsolete(); if (!readers.isEmpty()) { List<ReaderId> rmv = null; for (ReaderId reader : readers) { if (!cctx.discovery().alive(reader.nodeId())) { if (rmv == null) rmv = new LinkedList<ReaderId>(); rmv.add(reader); } } if (rmv != null) { readers = new LinkedList<ReaderId>(readers); for (ReaderId rdr : rmv) readers.remove(rdr); readers = Collections.unmodifiableList(readers); } } return readers; } }
@Override public UUID apply(ReaderId e) { return e.nodeId(); }
/** * @param nodeId Node ID. * @return reader ID. */ @Nullable private ReaderId readerId(UUID nodeId) { for (ReaderId reader : readers) if (reader.nodeId().equals(nodeId)) return reader; return null; }