org.objectweb.easybeans.component.quartz
Class EasyBeansTimer

java.lang.Object
  extended by org.objectweb.easybeans.component.quartz.EasyBeansTimer
All Implemented Interfaces:
Timer

public class EasyBeansTimer
extends java.lang.Object
implements Timer

Implementation of the Timer interface of EJB specification.

Author:
Florent Benoit

Field Summary
private  EasyBeansJobDetail jobDetail
          Job Detail for this timer.
private  org.quartz.Scheduler scheduler
          Scheduler used for this timer.
private  org.quartz.Trigger trigger
          Trigger used by this timer.
 
Constructor Summary
EasyBeansTimer(EasyBeansJobDetail jobDetail, org.quartz.Trigger trigger, org.quartz.Scheduler scheduler)
          Create a new Timer object with the given objects (job, trigger and scheduler).
 
Method Summary
 void cancel()
          Cause the timer and all its associated expiration notifications to be cancelled.
 TimerHandle getHandle()
          Get a serializable handle to the timer.
 java.io.Serializable getInfo()
          Get the information associated with the timer at the time of creation.
 java.util.Date getNextTimeout()
          Get the point in time at which the next timer expiration is scheduled to occur.
 long getTimeRemaining()
          Get the number of milliseconds that will elapse before the next scheduled timer expiration.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

jobDetail

private EasyBeansJobDetail jobDetail
Job Detail for this timer.


trigger

private org.quartz.Trigger trigger
Trigger used by this timer.


scheduler

private org.quartz.Scheduler scheduler
Scheduler used for this timer.

Constructor Detail

EasyBeansTimer

public EasyBeansTimer(EasyBeansJobDetail jobDetail,
                      org.quartz.Trigger trigger,
                      org.quartz.Scheduler scheduler)
Create a new Timer object with the given objects (job, trigger and scheduler).

Parameters:
jobDetail - the given job used to cancel the timer or in order to get Serializable info
trigger - the trigger used to get the next fire
scheduler - for canceling jobs
Method Detail

cancel

public void cancel()
            throws java.lang.IllegalStateException,
                   NoSuchObjectLocalException,
                   EJBException
Cause the timer and all its associated expiration notifications to be cancelled.

Specified by:
cancel in interface Timer
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getTimeRemaining

public long getTimeRemaining()
                      throws java.lang.IllegalStateException,
                             NoSuchObjectLocalException,
                             EJBException
Get the number of milliseconds that will elapse before the next scheduled timer expiration.

Specified by:
getTimeRemaining in interface Timer
Returns:
the number of milliseconds that will elapse before the next scheduled timer expiration.
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getNextTimeout

public java.util.Date getNextTimeout()
                              throws java.lang.IllegalStateException,
                                     NoSuchObjectLocalException,
                                     EJBException
Get the point in time at which the next timer expiration is scheduled to occur.

Specified by:
getNextTimeout in interface Timer
Returns:
the point in time at which the next timer expiration is scheduled to occur.
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getInfo

public java.io.Serializable getInfo()
                             throws java.lang.IllegalStateException,
                                    NoSuchObjectLocalException,
                                    EJBException
Get the information associated with the timer at the time of creation.

Specified by:
getInfo in interface Timer
Returns:
The Serializable object that was passed in at timer creation, or null if the info argument passed in at timer creation was null.
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.

getHandle

public TimerHandle getHandle()
                      throws java.lang.IllegalStateException,
                             NoSuchObjectLocalException,
                             EJBException
Get a serializable handle to the timer. This handle can be used at a later time to re-obtain the timer reference.

Specified by:
getHandle in interface Timer
Returns:
a serializable handle to the timer.
Throws:
java.lang.IllegalStateException - If this method is invoked while the instance is in a state that does not allow access to this method.
NoSuchObjectLocalException - If invoked on a timer that has expired or has been cancelled.
EJBException - If this method could not complete due to a system-level failure.