public class Timer extends Object implements TimerInterface
Modifier and Type | Field and Description |
---|---|
static String |
KEY_DERIVED_TIMERACTIVATIONPERIOD
The Timer Configuration key that holds the derived value for
the timer activation period.
|
static String |
KEY_DERIVED_TIMERINITIALDELAY
The Timer Configuration key that holds the derived value for
the initial timer delay.
|
Constructor and Description |
---|
Timer()
Constructs a Timer.
|
Modifier and Type | Method and Description |
---|---|
protected Long |
convertTimerInterval(String value)
Computes the number of milliseconds in a period of time specified
as a string.
|
protected Long |
convertTimerInterval(String value,
String daySuffix,
String hourSuffix,
String minuteSuffix,
String secondSuffix)
Computes the number of milliseconds in a period of time specified
as a string.
|
protected void |
deriveTimerActivationPeriod()
Derives the activation period, based on the Timer configuration,
and stores the derived value backinto the configuration.
|
protected void |
deriveTimerInitialDelay()
Gets the initial delay, based on this Server's configuration parameters.
|
Date |
getLastActivation()
Gets the time of the last timer expiration.
|
Date |
getNextActivation()
Gets the time of the next timer expiration.
|
protected long |
getTimerActivationPeriod()
Gets the activation period, based on the Timer configuration.
|
protected long |
getTimerInitialDelay()
Gets the initial delay, based on the Timer configuration.
|
void |
initialize(TimerContext context,
AttributeValueTable avt)
Initializes the Timer.
|
void |
reset()
Resets this Timer.
|
void |
start()
Starts the Timer.
|
void |
stop()
Stops this Timer.
|
public static final String KEY_DERIVED_TIMERACTIVATIONPERIOD
public static final String KEY_DERIVED_TIMERINITIALDELAY
public void initialize(TimerContext context, AttributeValueTable avt) throws IfsException
initialize
in interface TimerInterface
context
- the Timer context (the caller)avt
- the Server properties, which include timer settingsIfsException
- if the operation failspublic void start()
start
in interface TimerInterface
public void stop()
stop
in interface TimerInterface
public void reset()
reset
in interface TimerInterface
public Date getLastActivation()
getLastActivation
in interface TimerInterface
public Date getNextActivation()
getNextActivation
in interface TimerInterface
protected void deriveTimerActivationPeriod() throws IfsException
IfsException
- if the operation failsprotected long getTimerActivationPeriod() throws IfsException
IfsException
- if the operation failsprotected void deriveTimerInitialDelay() throws IfsException
IfsException
- if the operation failsprotected long getTimerInitialDelay() throws IfsException
IfsException
- if the operation failsprotected Long convertTimerInterval(String value) throws IfsException
For example, convert "36s" to new Long(36000).
value
- string value to be convertedIfsException
- (IFS-45348) if the operation failsprotected Long convertTimerInterval(String value, String daySuffix, String hourSuffix, String minuteSuffix, String secondSuffix) throws IfsException
For example, convert "36s" to 36000 ms.
value
- string value to be converteddaySuffix
- suffix used for dayhourSuffix
- suffix used for hourminuteSuffix
- suffix used for minutesecondSuffix
- suffix used for secondIfsException
- (IFS-45348) if the operation failsCopyright © 2023. All rights reserved.