class FiddlerLeaseMap extends AbstractLeaseMap
net.jini.core.lease.LeaseMap
interface.
This class is the implementation class of the LeaseMap
interface that is employed by the Fiddler implementation of the lookup
discovery service. When a client wishes to "batch" leases granted by
that service, the are placed in an instance of this class.
Clients only see instances of this class via the LeaseMap
interface.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
FiddlerLeaseMap.ConstrainableFiddlerLeaseMap
The constrainable version of the class
FiddlerLeaseMap . |
Modifier and Type | Field and Description |
---|---|
(package private) Fiddler |
server
The reference to the back-end server of the lookup discovery service
|
(package private) Uuid |
serverID
The unique ID associated with the server referenced in this class
(used to compare server references).
|
map
Modifier | Constructor and Description |
---|---|
private |
FiddlerLeaseMap(Fiddler server,
FiddlerLease lease,
long duration)
Constructs a new instance of FiddlerLeaseMap.
|
Modifier and Type | Method and Description |
---|---|
void |
cancelAll()
Cancels all leases in this map.
|
boolean |
canContainKey(Object key)
Examines the input parameter to determine if that parameter will be
accepted or rejected by this map as a "legal" key value.
|
(package private) static FiddlerLeaseMap |
createLeaseMap(FiddlerLease lease,
long duration)
Static factory method that creates and returns an instance of
FiddlerLeaseMap . |
void |
renewAll()
Renews all leases in this map.
|
checkKey, checkValue, clear, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, keySet, put, putAll, remove, size, values
final Fiddler server
final Uuid serverID
private FiddlerLeaseMap(Fiddler server, FiddlerLease lease, long duration)
server
- reference to the server object through which
communication occurs between the client-side and
server-side of the associated service.lease
- reference to a lease to add to the map as a key valueduration
- the duration of the corresponding lease. This value
is the "mapped" value corresponding to the lease key.static FiddlerLeaseMap createLeaseMap(FiddlerLease lease, long duration)
FiddlerLeaseMap
. If the lease input to this method
is and instance of ConstrainableFiddlerLease
, then
the object returned by this method will be an instance of
ConstrainableFiddlerLeaseMap
.
Note that because of the way the Lease
class for the
associated service is implemented, together with the way the
canBatch
method of that class is implemented, if the
lease
object input to this method implements
ConstrainableFiddlerLease
, then the server
object referenced in this class will implement
RemoteMethodControl
as well.lease
- reference to a lease to add to the map as a key valueduration
- the duration of the corresponding lease. This value
is the "mapped" value corresponding to the lease key.FiddlerLeaseMap
, or an instance
of ConstrainableFiddlerLeaseMap
if the given
lease
is an instance of
ConstrainableFiddlerLease
.public boolean canContainKey(Object key)
This method will return true if the key
parameter is
the type of lease which can be "batch-wise" renewed and cancelled
along with all of the other leases in the map.
For the Fiddler implementation of the lookup discovery service, two
leases can be batched (placed in the same FiddlerLeaseMap)
if they are both instances of FiddlerLease
and they
were both granted by the same Fiddler implementation of the lookup
discovery service. That is, they are the same type, and they were
granted by the same server.
key
- reference to the object that this method examines to
determine if this map will accept or reject it as a keykey
parameter,
false otherwiseLease.canBatch(net.jini.core.lease.Lease)
public void renewAll() throws LeaseMapException, RemoteException
LeaseMapException
.LeaseMapException
- this exception is thrown
when one or more leases in the map could not be renewed.RemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server. When this exception does occur, the leases in the map
may or may not have been renewed successfully.public void cancelAll() throws LeaseMapException, RemoteException
LeaseMapException
.
Note that a lease is removed from this map only when an attempt to cancel it fails; that is, every lease that is successfully cancelled is left in the map.
LeaseMapException
- this exception is thrown
when one or more leases in the map could not be cancelled.RemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server. When this exception does occur, the leases in the map
may or may not have been cancelled successfully.Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.