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, wait
compute, computeIfAbsent, computeIfPresent, forEach, getOrDefault, isEmpty, keySet, merge, putIfAbsent, remove, replace, replace, replaceAll, size, values
private 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()
LeaseMap
private void applyException(Throwable t)
public void renewAll() throws LeaseMapException, RemoteException
LeaseMap
renewAll
in interface LeaseMap
LeaseMapException
RemoteException
public boolean canContainKey(Object key)
LeaseMap
canContainKey
in interface LeaseMap
key
- 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 Map
containsKey
in class AbstractMap
public boolean containsValue(Object value)
containsValue
in interface Map
containsValue
in class AbstractMap
public Object get(Object key)
get
in interface Map
get
in class AbstractMap
public Object put(Object key, Object value)
put
in interface Map
put
in class AbstractMap
public Object remove(Object key)
remove
in interface Map
remove
in class AbstractMap
public void putAll(Map m)
putAll
in interface Map
putAll
in class AbstractMap
public void clear()
clear
in interface Map
clear
in class AbstractMap
public boolean equals(Object o)
equals
in interface Map
equals
in class AbstractMap
public int hashCode()
hashCode
in interface Map
hashCode
in class AbstractMap
public Set entrySet()
entrySet
in interface Map
entrySet
in class AbstractMap
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.