jrun.jms.core.scheduler
Class BaseLease

java.lang.Object
  |
  +--jrun.jms.core.scheduler.SchedulableEvent
        |
        +--jrun.jms.core.scheduler.BaseLease
All Implemented Interfaces:
java.lang.Comparable, LeaseIfc, java.lang.Runnable, java.io.Serializable
Direct Known Subclasses:
MessageLease

public class BaseLease
extends SchedulableEvent
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.3 $ $Date: 2001/06/08 06:44:02 $
Author:
Jim Alateras
See Also:
Serialized Form

Field Summary
protected  long m_duration
          The duration of the lease in milliseconds
 
Fields inherited from class jrun.jms.core.scheduler.SchedulableEvent
CREATED, FIRED, SCHEDULED
 
Constructor Summary
BaseLease()
          Default constructor for the Serailizable/Externalizable interface
BaseLease(java.lang.Object object, long duration, SchedulableEventListener 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.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
 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
 SchedulableEventListener 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 jrun.jms.core.scheduler.SchedulableEvent
getContext, getListener, getNickTime, getType, run, setStatus
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

m_duration

protected long m_duration
The duration of the lease in milliseconds
Constructor Detail

BaseLease

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

BaseLease

public BaseLease(java.lang.Object object,
                 long duration,
                 SchedulableEventListener 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: jrun.jms.core.scheduler.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: jrun.jms.core.scheduler.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: jrun.jms.core.scheduler.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: jrun.jms.core.scheduler.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: jrun.jms.core.scheduler.LeaseIfc
Returns:
Class

getLeaseEventListener

public SchedulableEventListener 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 � 2002 Macromedia Corporation. All Rights Reserved.