Code example for SortedSet

Methods: add, remove

0
  synchronized void renewLease(String holder) {
    renewLease(getLease(holder));
  } 
  synchronized void renewLease(Lease lease) {
    if (lease != null) {
      sortedLeases.remove(lease);
      lease.renew();
      sortedLeases.add(lease);
    } 
  } 
 
  /************************************************************ 
   * A Lease governs all the locks held by a single client. 
   * For each client there's a corresponding lease, whose 
   * timestamp is updated when the client periodically 
   * checks in.  If the client dies and allows its lease to 
   * expire, all the corresponding locks can be released. 
   *************************************************************/ 
  class Lease implements Comparable<Lease> {
    private final String holder;
    private long lastUpdate;