class ClientLeaseMapWrapper extends AbstractMap implements LeaseMap
LeaseRenewalManager. Objects of this
class are returned by createLeaseMap calls made on
ClientLeaseWrapper objects that are not deformed. This class only allows as keys ClientLeaseWrappers that are non-deformed. Internally the mapping from ClientLeaseWrappers to longs is held in two Maps. The first is a LeaseMap that is created by the client lease associated with the first ClientLeaseWrapper added to the set. The second is a Map from client leases to the ClientLeaseWrappers that wrap them.
ClientLeaseWrapper| Modifier and Type | Class and Description |
|---|---|
private class |
ClientLeaseMapWrapper.Entry
Our implementation of Map.Entry
|
private class |
ClientLeaseMapWrapper.EntryIterator
An implementation of Iterator backed by the ClientMapWrapper's mappings,
which are from wrapperMap's values to clientLeaseMap
|
private class |
ClientLeaseMapWrapper.EntrySet
An implementation of Set backed by the ClientLeaseMapWrapper's
mappings, which are from wrapperMap's values to clientLeaseMap
|
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>| Modifier and Type | Field and Description |
|---|---|
private LeaseMap |
clientLeaseMap
LeaseMap created by client lease, mapping client leases to Long
expiration times.
|
private ClientLeaseWrapper |
example
Retain initial wrapper so canContainKey can use it to determine if
a specified lease may be added.
|
private static Method[] |
leaseToLeaseMapMethods
Methods for converting lease constraints to lease map constraints.
|
private static long |
serialVersionUID |
private Map |
wrapperMap
Map from client leases to ClientLeaseWrapper instances.
|
| Constructor and Description |
|---|
ClientLeaseMapWrapper(ClientLeaseWrapper wrapper,
long duration)
Create a ClientLeaseMapWrapper object that will hold
the specified client Lease.
|
| Modifier and Type | Method and Description |
|---|---|
private void |
applyException(Throwable t)
For each lease in the map, call failedRenewal
|
void |
cancelAll()
Cancels all leases in the LeaseMap.
|
boolean |
canContainKey(Object key)
Returns true if the given object is a Lease which can be renewed
and cancelled in a batch with other leases in the map.
|
private Lease |
checkKey(Object key)
Check that the key is valid for this map, if it is return the client
lease, if not throw IllegalArgumentException.
|
private static void |
checkValue(Object value)
Check that the value is a Long.
|
void |
clear() |
boolean |
containsKey(Object key) |
boolean |
containsValue(Object value) |
Set |
entrySet() |
boolean |
equals(Object o) |
Object |
get(Object key) |
int |
hashCode() |
Object |
put(Object key,
Object value) |
void |
putAll(Map m) |
Object |
remove(Object key) |
void |
renewAll()
Renews all leases in the LeaseMap, using their current values as
the renewal durations.
|
finalize, getClass, notify, notifyAll, wait, wait, waitcompute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, valuesprivate static final long serialVersionUID
private static final Method[] leaseToLeaseMapMethods
private final LeaseMap clientLeaseMap
private final Map wrapperMap
private final ClientLeaseWrapper example
ClientLeaseMapWrapper(ClientLeaseWrapper wrapper, long duration)
wrapper - a wrapper for the lease that wants to be renewedduration - the duration to associate with wrapperIllegalArgumentException - if wrapper is deformedpublic void cancelAll()
LeaseMapprivate void applyException(Throwable t)
public void renewAll()
throws LeaseMapException,
RemoteException
LeaseMaprenewAll in interface LeaseMapLeaseMapExceptionRemoteExceptionpublic boolean canContainKey(Object key)
LeaseMapcanContainKey in interface LeaseMapkey - an object that should be a leaseLease.canBatch(net.jini.core.lease.Lease)private Lease checkKey(Object key)
private static void checkValue(Object value)
public boolean containsKey(Object key)
containsKey in interface MapcontainsKey in class AbstractMappublic boolean containsValue(Object value)
containsValue in interface MapcontainsValue in class AbstractMappublic Object get(Object key)
get in interface Mapget in class AbstractMappublic Object put(Object key, Object value)
put in interface Mapput in class AbstractMappublic Object remove(Object key)
remove in interface Mapremove in class AbstractMappublic void putAll(Map m)
putAll in interface MapputAll in class AbstractMappublic void clear()
clear in interface Mapclear in class AbstractMappublic boolean equals(Object o)
equals in interface Mapequals in class AbstractMappublic int hashCode()
hashCode in interface MaphashCode in class AbstractMappublic Set entrySet()
entrySet in interface MapentrySet in class AbstractMapCopyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.