Package org.simpleframework.util.lease
Class LeaseMap<T>
java.lang.Object
java.util.AbstractMap<K,V>
java.util.concurrent.ConcurrentHashMap<T,Lease<T>>
org.simpleframework.util.lease.LeaseMap<T>
- All Implemented Interfaces:
Serializable
,ConcurrentMap<T,
,Lease<T>> Map<T,
Lease<T>>
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
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from class java.util.concurrent.ConcurrentHashMap
ConcurrentHashMap.KeySetView<K extends Object,
V extends Object> Nested classes/interfaces inherited from class java.util.AbstractMap
AbstractMap.SimpleEntry<K extends Object,
V extends Object>, AbstractMap.SimpleImmutableEntry<K extends Object, V extends Object> -
Constructor Summary
Constructors -
Method Summary
Methods inherited from class java.util.concurrent.ConcurrentHashMap
clear, compute, computeIfAbsent, computeIfPresent, contains, containsKey, containsValue, elements, entrySet, equals, forEach, forEach, forEach, forEachEntry, forEachEntry, forEachKey, forEachKey, forEachValue, forEachValue, getOrDefault, hashCode, isEmpty, keys, keySet, keySet, mappingCount, merge, newKeySet, newKeySet, put, putAll, putIfAbsent, reduce, reduceEntries, reduceEntries, reduceEntriesToDouble, reduceEntriesToInt, reduceEntriesToLong, reduceKeys, reduceKeys, reduceKeysToDouble, reduceKeysToInt, reduceKeysToLong, reduceToDouble, reduceToInt, reduceToLong, reduceValues, reduceValues, reduceValuesToDouble, reduceValuesToInt, reduceValuesToLong, remove, replace, replace, replaceAll, search, searchEntries, searchKeys, searchValues, size, toString, values
Methods inherited from class java.util.AbstractMap
clone
-
Constructor Details
-
LeaseMap
public LeaseMap()Constructor for theLeaseMap
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. -
LeaseMap
public LeaseMap(int capacity) Constructor for theLeaseMap
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.- Parameters:
capacity
- this is the initial capacity of the map
-
-
Method Details
-
get
This is used to acquire theLease
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. -
remove
This is used to remove theLease
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.
-