|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcasa.JION.lease.LeaseMap
public class LeaseMap
An unsynchronized Map from Lease to Long (the duration to use when renewing the lease). For all methods of LeaseMap except canContainKey, an IllegalArgumentException is thrown if a key is not a Lease or a value is not a Long. Null keys and values are not supported.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
java.util.Map.Entry<K,V> |
Constructor Summary | |
---|---|
LeaseMap(Lease lease,
long duration)
Instantiates a new lease map. |
|
LeaseMap(java.util.Map<Lease,java.lang.Long> map,
Lease lease,
long duration)
Instantiates a new lease map. |
Method Summary | |
---|---|
void |
cancelAll()
Cancels all leases in the LeaseMap. |
boolean |
canContainKey(java.lang.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. |
void |
clear()
Removes all of the mappings from this map. |
boolean |
containsKey(java.lang.Object key)
Returns true if this map contains a mapping for the specified key. |
boolean |
containsValue(java.lang.Object value)
Returns true if this map maps one or more keys to the specified value. |
java.util.Set |
entrySet()
Returns a Set view of the mappings contained in this map. |
java.lang.Object |
get(java.lang.Object key)
Returns the value to which the specified key is mapped, or null if this map contains no mapping for the key. |
boolean |
isEmpty()
Returns true if this map contains no key-value mappings. |
java.util.Set |
keySet()
Returns a Set view of the keys contained in this map. |
static void |
main(java.lang.String[] args)
The main method. |
java.lang.Object |
put(java.lang.Object key,
java.lang.Object value)
Associates the specified value with the specified key in this map. |
void |
putAll(java.util.Map m)
Copies all of the mappings from the specified map to this map. |
java.lang.Object |
remove(java.lang.Object key)
Removes the mapping for the specified key from this map if present. |
void |
renewAll()
Renews all leases in the LeaseMap, using their current values as the renewal durations. |
int |
size()
Returns the number of key-value mappings in this map. |
java.lang.String |
toString()
|
java.util.Collection |
values()
Returns a Collection view of the values contained in this map. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Methods inherited from interface java.util.Map |
---|
equals, hashCode |
Constructor Detail |
---|
public LeaseMap(Lease lease, long duration)
lease
- the leaseduration
- the durationpublic LeaseMap(java.util.Map<Lease,java.lang.Long> map, Lease lease, long duration)
map
- the maplease
- the leaseduration
- the durationMethod Detail |
---|
public int size()
size
in interface java.util.Map
public boolean isEmpty()
isEmpty
in interface java.util.Map
public boolean containsKey(java.lang.Object key)
containsKey
in interface java.util.Map
key
- The key whose presence in this map is to be tested
public boolean containsValue(java.lang.Object value)
containsValue
in interface java.util.Map
value
- value whose presence in this map is to be tested
public java.lang.Object get(java.lang.Object key)
null
if this map contains no mapping for the key.
More formally, if this map contains a mapping from a key
k
to a value v
such that (key==null ? k==null :
key.equals(k))
, then this method returns v
; otherwise
it returns null
. (There can be at most one such mapping.)
A return value of null
does not necessarily
indicate that the map contains no mapping for the key; it's also
possible that the map explicitly maps the key to null
.
The containsKey
operation may be used to
distinguish these two cases.
get
in interface java.util.Map
put(Object, Object)
public java.lang.Object put(java.lang.Object key, java.lang.Object value)
put
in interface java.util.Map
key
- key with which the specified value is to be associatedvalue
- value to be associated with the specified key
public java.lang.Object remove(java.lang.Object key)
remove
in interface java.util.Map
key
- key whose mapping is to be removed from the map
public void putAll(java.util.Map m)
putAll
in interface java.util.Map
m
- mappings to be stored in this map
java.lang.NullPointerException
- if the specified map is nullpublic void clear()
clear
in interface java.util.Map
public java.util.Set keySet()
Set
view of the keys contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation), the results of
the iteration are undefined. The set supports element removal,
which removes the corresponding mapping from the map, via the
Iterator.remove, Set.remove,
removeAll, retainAll, and clear
operations. It does not support the add or addAll
operations.
keySet
in interface java.util.Map
public java.util.Collection values()
Collection
view of the values contained in this map.
The collection is backed by the map, so changes to the map are
reflected in the collection, and vice-versa. If the map is
modified while an iteration over the collection is in progress
(except through the iterator's own remove operation),
the results of the iteration are undefined. The collection
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Collection.remove, removeAll,
retainAll and clear operations. It does not
support the add or addAll operations.
values
in interface java.util.Map
public java.util.Set entrySet()
Set
view of the mappings contained in this map.
The set is backed by the map, so changes to the map are
reflected in the set, and vice-versa. If the map is modified
while an iteration over the set is in progress (except through
the iterator's own remove operation, or through the
setValue operation on a map entry returned by the
iterator) the results of the iteration are undefined. The set
supports element removal, which removes the corresponding
mapping from the map, via the Iterator.remove,
Set.remove, removeAll, retainAll and
clear operations. It does not support the
add or addAll operations.
entrySet
in interface java.util.Map
public boolean canContainKey(java.lang.Object key)
canContainKey
in interface net.jini.core.lease.LeaseMap
key
- an object that should be a lease
Lease.canBatch(net.jini.core.lease.Lease)
public void renewAll() throws net.jini.core.lease.LeaseMapException, java.rmi.RemoteException
renewAll
in interface net.jini.core.lease.LeaseMap
net.jini.core.lease.LeaseMapException
java.rmi.RemoteException
public void cancelAll() throws net.jini.core.lease.LeaseMapException, java.rmi.RemoteException
cancelAll
in interface net.jini.core.lease.LeaseMap
net.jini.core.lease.LeaseMapException
java.rmi.RemoteException
public java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] args)
args
- the arguments
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |