LEONARDI Application Composer - 8.9.0.40 by W4 S.A.

leon.misc
Class LyTimer

java.lang.Object
  extended by leon.misc.LyTimer
All Implemented Interfaces:
java.lang.Runnable

public class LyTimer
extends java.lang.Object
implements java.lang.Runnable

This class implements a simple timer which notify a client when timeout expires. The client can stop the timer with the stop() method.


Field Summary
static java.lang.String __VERSION
           
 
Constructor Summary
LyTimer(LyTimerClientInterface client, long duration)
          Default constructor.
LyTimer(LyTimerClientInterface client, long duration, java.lang.String name)
          Default constructor.
 
Method Summary
 java.lang.Object getClientData()
          Gets the client data.
 void restart()
          Restart this timer.
 void run()
          Run the timer.
 void setClientData(java.lang.Object clientData)
          Sets the client data.
 void setDuration(int duration)
          Change the timer timeout duration.
 void start()
          Start this timer.
 void stop()
          Stop this timer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

__VERSION

public static final java.lang.String __VERSION
See Also:
Constant Field Values
Constructor Detail

LyTimer

public LyTimer(LyTimerClientInterface client,
               long duration)
Default constructor. Calls the constructor LyTimer(client, duration, "BF AppEngine : timer thread")

Parameters:
client - Thread listener client
duration - expected timer duration

LyTimer

public LyTimer(LyTimerClientInterface client,
               long duration,
               java.lang.String name)
Default constructor. Initializes duration, client and name with the given values, then initializes the status to STOPPED, needRestart and need Stop to false.

Parameters:
client - Thread listener client
duration - expected timer duration
name - Name of the timer
Method Detail

setDuration

public void setDuration(int duration)
Change the timer timeout duration. This modification will only happen after the current time interval is finished.

Parameters:
duration - the new timer duration

run

public void run()
Run the timer.

Specified by:
run in interface java.lang.Runnable
See Also:
Thread.run()

start

public void start()
Start this timer.


stop

public void stop()
Stop this timer. Will not notify client.


restart

public void restart()
Restart this timer. Will not notify client.


getClientData

public java.lang.Object getClientData()
Gets the client data.

Returns:
user client data freely set by the user

setClientData

public void setClientData(java.lang.Object clientData)
Sets the client data.

Parameters:
clientData - user client data freely set by the user

(c) January 2013 - W4 S.A.

Website: W4 S.A., contact us: support@w4global.com