Class AbstractLeaseMap

java.lang.Object
com.sun.jini.lease.AbstractLeaseMap
All Implemented Interfaces:
Map, LeaseMap
Direct Known Subclasses:
LandlordLeaseMap, SpaceLeaseMap

public abstract class AbstractLeaseMap extends Object implements LeaseMap
A base class for implementing LeaseMaps. This class implements all of the Map methods, and ensures keys and values are of the correct type. The subclass is responsible for implementing the actual LeaseMap methods: canContainKey, renewAll, and cancelAll, and serialization of any subclass state.
Author:
Sun Microsystems, Inc.
  • Field Details

    • map

      protected final Map map
      Map from Lease to Long(duration), where all leases have the same destination.
  • Constructor Details

    • AbstractLeaseMap

      protected AbstractLeaseMap(Map map)
      Provide a map of your choice.
    • AbstractLeaseMap

      protected AbstractLeaseMap(Lease lease, long duration)
      Default to using a small HashMap. It is assumed that canContainKey(lease) is true.
    • AbstractLeaseMap

      protected AbstractLeaseMap(Map map, Lease lease, long duration)
      Provide a map of your choice. It is assumed that canContainKey(lease) is true.
  • Method Details

    • checkKey

      protected void checkKey(Object key)
      Check that the key is valid for this map
    • checkValue

      protected static void checkValue(Object value)
      Check that the value is a Long
    • size

      public int size()
      Specified by:
      size in interface Map
    • isEmpty

      public boolean isEmpty()
      Specified by:
      isEmpty in interface Map
    • containsKey

      public boolean containsKey(Object key)
      Specified by:
      containsKey in interface Map
    • containsValue

      public boolean containsValue(Object value)
      Specified by:
      containsValue in interface Map
    • get

      public Object get(Object key)
      Specified by:
      get in interface Map
    • put

      public Object put(Object key, Object value)
      Specified by:
      put in interface Map
    • remove

      public Object remove(Object key)
      Specified by:
      remove in interface Map
    • putAll

      public void putAll(Map m)
      Specified by:
      putAll in interface Map
    • clear

      public void clear()
      Specified by:
      clear in interface Map
    • keySet

      public Set keySet()
      Specified by:
      keySet in interface Map
    • values

      public Collection values()
      Specified by:
      values in interface Map
    • entrySet

      public Set entrySet()
      Specified by:
      entrySet in interface Map
    • equals

      public boolean equals(Object o)
      Specified by:
      equals in interface Map
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Specified by:
      hashCode in interface Map
      Overrides:
      hashCode in class Object