class FiddlerLease extends AbstractLease implements ReferentUuid
Clients only see instances of this class via the Lease
interface.
Modifier and Type | Class and Description |
---|---|
(package private) static class |
FiddlerLease.ConstrainableFiddlerLease
The constrainable version of the class
FiddlerLease . |
Modifier and Type | Field and Description |
---|---|
(package private) Uuid |
leaseID
The internal identifier assigned to this lease by the granting entity.
|
(package private) Uuid |
registrationID
The unique identifier assigned by the lookup discovery service to
the registration to which this lease corresponds.
|
private static long |
serialVersionUID |
(package private) Fiddler |
server
The reference to the back-end server of the lookup discovery service
that granted this lease (the granting entity).
|
(package private) Uuid |
serverID
The unique ID associated with the server referenced in this class
(used to compare server references).
|
expiration, serialFormat
Modifier | Constructor and Description |
---|---|
private |
FiddlerLease(Fiddler server,
Uuid serverID,
Uuid registrationID,
Uuid leaseID,
long expiration)
Constructs a proxy to the lease the Fiddler implementation of the
lookup discovery service places on a client's requested registration.
|
Modifier and Type | Method and Description |
---|---|
boolean |
canBatch(Lease lease)
Examines the input parameter to determine if that parameter, along
with the current lease (the current instance of this class), can
be batched in a
LeaseMap . |
void |
cancel()
This method allows the entity to which the current lease is granted
(the lease holder) to indicate that it is no longer interested
in the resources provided to the entity by the lookup discovery
service.
|
static FiddlerLease |
createLease(Fiddler server,
Uuid serverID,
Uuid registrationID,
Uuid leaseID,
long expiration)
Public static factory method that creates and returns an instance of
FiddlerLease . |
LeaseMap |
createLeaseMap(long duration)
Creates a
LeaseMap object that can contain leases whose
renewal or cancellation can be batched. |
protected long |
doRenew(long duration)
This method allows the entity to which the current lease is granted
(the lease holder) to indicate that it is still interested in the
resources of the lookup discovery service, and to request continued
access to those resources for an amount of time (in milliseconds)
relative to the current time.
|
boolean |
equals(Object obj)
For any instance of this class, indicates whether the object input
to this method is equal to the current instance of this class; where
equality of leases granted by a lookup discovery service is defined by
reference equality.
|
(package private) Uuid |
getLeaseID()
Returns the identifier assigned to the current lease by the entity
that granted it.
|
Uuid |
getReferentUuid()
Returns the universally unique identifier that has been assigned to the
resource this proxy represents.
|
(package private) Uuid |
getRegistrationID()
Returns the unique identifier assigned by the lookup discovery
service to the registration to which the current lease corresponds.
|
(package private) Fiddler |
getServer()
Returns a reference to the back-end server of the lookup discovery
service that granted this lease.
|
(package private) Uuid |
getServerID()
Returns the unique ID associated with the server referenced in this
class.
|
int |
hashCode()
For any instance of this class, returns the hashcode value generated
by the hashCode method of the lease ID associated with the current
instance of this lease.
|
private void |
readObject(ObjectInputStream s)
When an instance of this class is deserialized, this method is
automatically invoked.
|
private void |
readObjectNoData()
During deserialization of an instance of this class, if it is found
that the stream contains no data, this method is automatically
invoked.
|
(package private) void |
setExpiration(long expiration)
Replaces the current value of the
expiration field
(defined in the AbstractLease super class) with the
value contained in the input parameter. |
getExpiration, getSerialFormat, renew, setSerialFormat
private static final long serialVersionUID
final Fiddler server
final Uuid serverID
final Uuid registrationID
final Uuid leaseID
private FiddlerLease(Fiddler server, Uuid serverID, Uuid registrationID, Uuid leaseID, long expiration)
expiration
parameter.server
- reference to the back-end server of the lookup
discovery service that granted this lease (the
granting entity)serverID
- the service ID of the service referenced by the
server parameterregistrationID
- unique identifier assigned to the registration
to which this lease correspondsleaseID
- identifier assigned to this lease by the
granting entityexpiration
- the time of expiration of the lease being grantedpublic static FiddlerLease createLease(Fiddler server, Uuid serverID, Uuid registrationID, Uuid leaseID, long expiration)
FiddlerLease
. If the server associated with this proxy
implements RemoteMethodControl
, then the object returned by
this method will also implement RemoteMethodControl
.server
- reference to the server object through which
communication occurs between the client-side and
server-side of the associated service.serverID
- the service ID of the service referenced by the
server parameterregistrationID
- the unique identifier assigned by the service to
each instance of this proxyleaseID
- identifier assigned to this lease by the
granting entityexpiration
- the time of expiration of the lease being grantedFiddlerLease
that implements
RemoteMethodControl
if the given
server
does.public LeaseMap createLeaseMap(long duration)
LeaseMap
object that can contain leases whose
renewal or cancellation can be batched. Additionally, upon creating
the map the current lease is placed in the map as a key, and
the value of the duration
parameter is placed in
the map as the lease's corresponding mapped value of type
Long
.createLeaseMap
in interface Lease
duration
- the amount of time (in milliseconds) during which
the lease being placed in the map will remain in
effect. This value will be converted to an instance
of Long
prior to being placed in the
map with its associated lease.
the lease in the map.LeaseMap
that contains as its
first mapping, the ordered pair consisting of this lease
and the value of the duration
parameter.Lease.createLeaseMap(long)
public boolean canBatch(Lease lease)
LeaseMap
.
For this implementation of the service, two leases can be batched
(placed in the same service-specific instance of LeaseMap
)
if those leases satisfy the following conditions:
Lease
implementation
canBatch
in interface Lease
lease
- reference to the Lease
object that this
method examines for batching compatibility with the
the current current instance of this classtrue
if the input parameter is compatible for
batching with the current current instance of this class,
false
otherwiseLease.canBatch(net.jini.core.lease.Lease)
Fiddler getServer()
Uuid getServerID()
Uuid
that contains the
universally unique ID associated with the server referenced
in this class.Uuid getRegistrationID()
net.jini.id.Uuid
value
corresponding to the unique ID assigned to the registration
associated with the current lease.Uuid getLeaseID()
long
value corresponding to the ID assigned
to the current lease.void setExpiration(long expiration)
expiration
field
(defined in the AbstractLease
super class) with the
value contained in the input parameter. The value contained in the
expiration
field represents the absolute (non-relative)
time (in milliseconds) at which the current lease will expire.expiration
- the new value of the expiration
fieldpublic void cancel() throws UnknownLeaseException, RemoteException
cancel
in interface Lease
UnknownLeaseException
- this exception occurs
when the lease being cancelled is unknown to the lease grantor.RemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server. When this exception does occur, the lease may or may
not have been cancelled successfully.Lease.cancel()
protected long doRenew(long duration) throws UnknownLeaseException, RemoteException
Note that the duration of the renewed lease will be no greater than the requested duration, and may be less than that duration.
doRenew
in class AbstractLease
duration
- the requested duration for the lease being renewedlong
value representing the actual duration that
was granted for the renewed lease. Note that the actual
duration granted and returned by this method may be less than
the duration requested.UnknownLeaseException
- this exception occurs
when the lease being renewed does not exist, or is unknown
to the lease grantor; typically because the lease has expired.RemoteException
- typically, this exception occurs when
there is a communication failure between the client and the
server. When this exception does occur, the lease may or may
not have been renewed successfully.Lease.renew(long)
,
AbstractLease.renew(long)
,
AbstractLease.doRenew(long)
public Uuid getReferentUuid()
getReferentUuid
in interface ReferentUuid
Uuid
that is associated with the
resource this proxy represents. This method will not return
null
.ReferentUuid
public int hashCode()
public boolean equals(Object obj)
private void readObject(ObjectInputStream s) throws IOException, ClassNotFoundException
InvalidObjectException
- if the state of the
deserialized instance of this class is found to be invalid.IOException
ClassNotFoundException
private void readObjectNoData() throws InvalidObjectException
InvalidObjectException
- to indicate that there
was no data in the stream during deserialization of an
instance of this class; declaring that something is wrong.InvalidObjectException
Copyright 2007-2013, multiple authors.
Licensed under the Apache License, Version 2.0, see the NOTICE file for attributions.