org.mobicents.servlet.sip.core.timers
Class ServletTimerImpl

java.lang.Object
  extended by org.mobicents.servlet.sip.core.timers.ServletTimerImpl
All Implemented Interfaces:
java.lang.Runnable, ServletTimer

public class ServletTimerImpl
extends java.lang.Object
implements ServletTimer, java.lang.Runnable


Constructor Summary
ServletTimerImpl(java.io.Serializable info, long delay, boolean fixedDelay, long period, TimerListener listener, MobicentsSipApplicationSession appSession)
          Constructor for repeating times
ServletTimerImpl(java.io.Serializable info, long delay, TimerListener listener, MobicentsSipApplicationSession appSession)
          Constructor for non-repeating timer.
 
Method Summary
 void cancel()
           
 void cancel(boolean mayInterruptIfRunning)
          Cancel this timer, possibly by also interrupting the thread (from the thread pool) running the task.
 boolean canRun()
           
 MobicentsSipApplicationSession getApplicationSession()
           
 long getDelay()
          Getter for delay property.
 java.lang.String getId()
           
 java.io.Serializable getInfo()
           
 long getPeriod()
          Getter for period property
 long getTimeRemaining()
          
 void run()
          Method that actually
 long scheduledExecutionTime()
           
 void setApplicationSession(MobicentsSipApplicationSession sipApplicationSession)
           
 void setFuture(java.util.concurrent.ScheduledFuture<?> f)
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ServletTimerImpl

public ServletTimerImpl(java.io.Serializable info,
                        long delay,
                        TimerListener listener,
                        MobicentsSipApplicationSession appSession)
Constructor for non-repeating timer.

Parameters:
info - Information about the timer
delay - Delay until execution
listener - Listener that will get timeout events.

ServletTimerImpl

public ServletTimerImpl(java.io.Serializable info,
                        long delay,
                        boolean fixedDelay,
                        long period,
                        TimerListener listener,
                        MobicentsSipApplicationSession appSession)
Constructor for repeating times

Parameters:
info - Information about the timer
delay - Delay until first execution
fixedDelay - Whether fixed delay mode should be used
period - Period between execution
listener - Listener that will get timeout events.
Method Detail

cancel

public void cancel()
Specified by:
cancel in interface ServletTimer

cancel

public void cancel(boolean mayInterruptIfRunning)
Cancel this timer, possibly by also interrupting the thread (from the thread pool) running the task. Note that interupting the thread may have undesired consequences.

Parameters:
mayInterruptIfRunning -

getDelay

public long getDelay()
Getter for delay property.

Returns:

getPeriod

public long getPeriod()
Getter for period property

Returns:

getApplicationSession

public MobicentsSipApplicationSession getApplicationSession()
Specified by:
getApplicationSession in interface ServletTimer

setApplicationSession

public void setApplicationSession(MobicentsSipApplicationSession sipApplicationSession)

getInfo

public java.io.Serializable getInfo()
Specified by:
getInfo in interface ServletTimer

scheduledExecutionTime

public long scheduledExecutionTime()
Specified by:
scheduledExecutionTime in interface ServletTimer

setFuture

public void setFuture(java.util.concurrent.ScheduledFuture<?> f)

canRun

public boolean canRun()

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

run

public void run()
Method that actually

Specified by:
run in interface java.lang.Runnable

getId

public java.lang.String getId()
Specified by:
getId in interface ServletTimer

getTimeRemaining

public long getTimeRemaining()

Specified by:
getTimeRemaining in interface ServletTimer


Copyright © 2010. All Rights Reserved.