コード例 #1
0
  /**
   * 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);
  }
コード例 #2
0
 /** @param r Reservation. */
 public void removeReservation(GridDhtPartitionsReservation r) {
   if (!reservations.remove(r))
     throw new IllegalStateException("Reservation was already removed.");
 }