org.jgroups.service.lease

Interface Lease

public interface Lease

Lease interface represents a token granted by lease manager that allows access to some resource for a limited period of time.

Author:
Roman Rokytskyy (rrokytskyy@acm.org)

Method Summary

long
getDuration()
Get lease duration.
long
getExpiration()
Get lease expiration time.
LeaseFactory
getFactory()
Get instance of LeaseFactory that created this lease.
Object
getLeaseTarget()
Get target of this lease.
Object
getTenant()
Get tenant that was granted this lease.
boolean
isExpired()
Check if lease has expired.

Method Details

getDuration

public long getDuration()
Get lease duration. Lease duration is always relative. Lease duration specifies number of milliseconds left to lease expiration.

Returns:
number of milliseconds left to lease expiration or -1 is lease is expired.


getExpiration

public long getExpiration()
Get lease expiration time. Lease expiration time is always absolute.

Returns:
time when lease expires.


getFactory

public LeaseFactory getFactory()
Get instance of LeaseFactory that created this lease.

Returns:
instance of LeaseFactory.


getLeaseTarget

public Object getLeaseTarget()
Get target of this lease. Usually target represents a unique identifier of particular resource we want to access.

Returns:
unique identifier representing leased resource.


getTenant

public Object getTenant()
Get tenant that was granted this lease.

Returns:
unique identifier of entity that was granted a lease.


isExpired

public boolean isExpired()
Check if lease has expired.

Returns:
true if lease has expired.


Copyright B) 2001,2002 www.jgroups.com . All Rights Reserved.