/**
   * Adds group reservation to this partition.
   *
   * @param r Reservation.
   * @return {@code false} If such reservation already added.
   */
  public boolean addReservation(GridDhtPartitionsReservation r) {
    assert state.getReference() != EVICTED : "we can reserve only active partitions";
    assert state.getStamp() != 0
        : "partition must be already reserved before adding group reservation";

    return reservations.addIfAbsent(r);
  }
Exemplo n.º 2
0
 /**
  * Adds the specified element to this set if it is not already present. More formally, adds the
  * specified element <tt>e</tt> to this set if the set contains no element <tt>e2</tt> such that
  * <tt>(e==null&nbsp;?&nbsp;e2==null&nbsp;:&nbsp;e.equals(e2))</tt>. If this set already contains
  * the element, the call leaves the set unchanged and returns <tt>false</tt>.
  *
  * @param e element to be added to this set
  * @return <tt>true</tt> if this set did not already contain the specified element
  */
 public boolean add(E e) {
   return al.addIfAbsent(e);
 }