All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.simpleframework.util.lease.LeaseMap Maven / Gradle / Ivy

Go to download

Simple is a high performance asynchronous HTTP server for Java

There is a newer version: 5.1.6
Show newest version
/*
 * LeaseMap.java May 2004
 *
 * Copyright (C) 2004, Niall Gallagher 
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the 
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General 
 * Public License along with this library; if not, write to the 
 * Free Software Foundation, Inc., 59 Temple Place, Suite 330, 
 * Boston, MA  02111-1307  USA
 */

package org.simpleframework.util.lease;

import java.util.concurrent.ConcurrentHashMap;

/**
 * The LeaseMap object is used to map lease keys to the
 * lease objects managing those objects. This allows components that
 * are using the leasing framework to associate an object with its
 * lease and vice versa. Such a capability enables lease renewals to
 * be performed without the need for a direct handle on the lease.
 * 
 * @author Niall Gallagher
 */
public class LeaseMap extends ConcurrentHashMap> {
   
   /**
    * Constructor for the LeaseMap object. This will
    * create a map for mapping leased resource keys to the leases
    * that manage them. Having such a map allows leases to be 
    * maintained without having a direct handle on the lease.
    */
   public LeaseMap() {
      super();
   }
   
   /**
    * Constructor for the LeaseMap object. This will
    * create a map for mapping leased resource keys to the leases
    * that manage them. Having such a map allows leases to be 
    * maintained without having a direct handle on the lease.
    * 
    * @param capacity this is the initial capacity of the map
    */
   public LeaseMap(int capacity) {
      super(capacity);
   }
   
   /**
    * This is used to acquire the Lease object that is
    * mapped to the specified key. Overriding this method ensures
    * that even without generic parameters a type safe method for
    * acquiring the registered lease objects can be used.
    * 
    * @param key this is the key used to acquire the lease object
    * 
    * @return this is the lease that is associated with the key
    */
   public Lease get(Object key) {
      return super.get(key);
   }
   
   /**
    * This is used to remove the Lease object that is
    * mapped to the specified key. Overriding this method ensures
    * that even without generic parameters a type safe method for
    * removing the registered lease objects can be used.
    * 
    * @param key this is the key used to remove the lease object
    * 
    * @return this is the lease that is associated with the key
    */
   public Lease remove(Object key) {
      return super.remove(key);
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy