Ejemplo n.º 1
0
  /**
   * @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;
    }
  }
Ejemplo n.º 2
0
 @Override
 public UUID apply(ReaderId e) {
   return e.nodeId();
 }
Ejemplo n.º 3
0
  /**
   * @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;
  }