org.javagroups.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.
 java.lang.Object getLeaseTarget()
          Get target of this lease.
 java.lang.Object getTenant()
          Get tenant that was granted this lease.
 boolean isExpired()
          Check if lease has expired.
 

Method Detail

getExpiration

public long getExpiration()
Get lease expiration time. Lease expiration time is always absolute.
Returns:
time when lease expires.

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.

isExpired

public boolean isExpired()
Check if lease has expired.
Returns:
true if lease has expired.

getLeaseTarget

public java.lang.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 java.lang.Object getTenant()
Get tenant that was granted this lease.
Returns:
unique identifier of entity that was granted a lease.

getFactory

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


Copyright © 2001,2002 www.javagroups.com . All Rights Reserved.