org.exolab.jms.lease
Class BaseLease

java.lang.Object
  |
  +--org.exolab.jms.lease.BaseLease
All Implemented Interfaces:
java.lang.Comparable, LeaseIfc, java.io.Serializable
Direct Known Subclasses:
MessageLease

public class BaseLease
extends java.lang.Object
implements LeaseIfc, java.lang.Comparable, java.io.Serializable

This is the implementation of a non-specific lease object. It can be used to lease any Objeect. .

Version:
$Revision: 1.6 $ $Date: 2003/08/17 01:32:24 $
Author:
Jim Alateras
See Also:
Serialized Form

Field Summary
protected  long duration_
          The duration of the lease in milliseconds
protected  long expiryTime_
          This is the time that the lease will expire
protected  java.lang.Object leasedObject_
          This is the object that is leased
protected  LeaseEventListenerIfc listener_
          The listener that will be notified when the lease expires
 
Constructor Summary
BaseLease()
          Default constructor for the Serailizable/Externalizable interface
BaseLease(java.lang.Object object, long duration, LeaseEventListenerIfc listener)
          Construct an instance of this class with the specified objct, and duration
 
Method Summary
 int compareTo(java.lang.Object object)
          Compares this object with the specified object.
 long getDuration()
          Return the orginal duration of the lease.
 long getExpiryTime()
          Return the absolute expiry time of this lease
 java.lang.Object getLeasedObject()
          Return the leased object
 java.lang.Class getLeasedObjectType()
          Return the class of leased object
 LeaseEventListenerIfc getLeaseEventListener()
          Return a reference to the listener registered with this object
 long getRemainingTime()
          Return the time remaining on the lease in milliseconds
 void setDuration(long duration)
           
 java.lang.String toString()
          Return a string representation of this object
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

leasedObject_

protected java.lang.Object leasedObject_
This is the object that is leased

duration_

protected long duration_
The duration of the lease in milliseconds

expiryTime_

protected long expiryTime_
This is the time that the lease will expire

listener_

protected LeaseEventListenerIfc listener_
The listener that will be notified when the lease expires
Constructor Detail

BaseLease

public BaseLease()
Default constructor for the Serailizable/Externalizable interface

BaseLease

public BaseLease(java.lang.Object object,
                 long duration,
                 LeaseEventListenerIfc listener)
Construct an instance of this class with the specified objct, and duration
Parameters:
object - leased object
duration - duration of lease
listener - will get notified on lease events
Method Detail

getExpiryTime

public long getExpiryTime()
Description copied from interface: LeaseIfc
Return the absolute expiry time of this lease
Specified by:
getExpiryTime in interface LeaseIfc
Following copied from interface: org.exolab.jms.lease.LeaseIfc
Returns:
long

getDuration

public long getDuration()
Description copied from interface: LeaseIfc
Return the orginal duration of the lease. The returned value is in milliseconds
Specified by:
getDuration in interface LeaseIfc
Following copied from interface: org.exolab.jms.lease.LeaseIfc
Returns:
long

setDuration

public void setDuration(long duration)

getRemainingTime

public long getRemainingTime()
Description copied from interface: LeaseIfc
Return the time remaining on the lease in milliseconds
Specified by:
getRemainingTime in interface LeaseIfc
Following copied from interface: org.exolab.jms.lease.LeaseIfc
Returns:
long

getLeasedObject

public java.lang.Object getLeasedObject()
Description copied from interface: LeaseIfc
Return the leased object
Specified by:
getLeasedObject in interface LeaseIfc
Following copied from interface: org.exolab.jms.lease.LeaseIfc
Returns:
Object

getLeasedObjectType

public java.lang.Class getLeasedObjectType()
Description copied from interface: LeaseIfc
Return the class of leased object
Specified by:
getLeasedObjectType in interface LeaseIfc
Following copied from interface: org.exolab.jms.lease.LeaseIfc
Returns:
Class

getLeaseEventListener

public LeaseEventListenerIfc getLeaseEventListener()
Return a reference to the listener registered with this object
Returns:
LeaseEventListenerIfc

compareTo

public int compareTo(java.lang.Object object)
Compares this object with the specified object. It returns a negative integer is this object is less than the specified object; zero if this object is equal to the specified object or a positive integer if this object is greater than the specified object

The comparison is based on the expiration time.

Specified by:
compareTo in interface java.lang.Comparable

toString

public java.lang.String toString()
Return a string representation of this object
Overrides:
toString in class java.lang.Object
Returns:
String


Copyright © 1999-2004 The OpenJMS Group. All Rights Reserved.