|
Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.2.1) Part Number E55141-01 P4 Change 1723563 on 2015/10/09 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Timer
A Timer is returned when a TimerListener is scheduled using one of the TimerManager.schedule
methods. It allows retrieving information about the scheduled TimerListener and allows cancelling it.
Timers are transient and not transactional and run inside the JVM which created them. If a cluster-wide scheduled event is required or it needs to be persistent, transactional or recoverable then a service such as the EJB 2.1 Timer service should be used instead.
Timer
, TimerListener
Method Summary | |
---|---|
abstract boolean |
cancel() This cancels the timer and all future TimerListener invocations and may be called during the TimerListener.timerExpired method. |
abstract long |
getPeriod() Return the period used to compute the time this timer will repeat. |
abstract long |
getScheduledExecutionTime() Returns the next absolute scheduled execution time in milliseconds. |
abstract TimerListener |
getTimerListener() Returns the application-supplied TimerListener associated with this Timer. |
Method Detail |
---|
boolean cancel()
TimerListener.timerExpired
method.
CancelTimerListener.timerCancel
events may be called concurrently with any TimerListener.timerExpired
methods. Proper thread synchronization techiniques must be employed to ensure consistency. Once a Timer is cancelled an application must not use the Timer instance again.
CancelTimerListener
TimerListener getTimerListener()
IllegalStateException
- if the TimerManager has been stopped.long getScheduledExecutionTime() throws IllegalStateException
If invoked while a TimerListener is running, the return value is the scheduled execution time of the current TimerListener execution.
This method is typically invoked from within a TimerListener's timerExpired method, to determine whether the current execution of the task is sufficiently timely to warrant performing the scheduled activity:
public void timerExpired(Timer t) { if (System.currentTimeMillis() - t.scheduledExecutionTime() >= MAX_TARDINESS) return; // Too late; skip this execution. // Perform the task }If the timer has been suspended, the time reflects the most recently-calculated execution time prior to being suspended.
IllegalStateException
- if the TimerManager has been stopped.long getPeriod()
|
Copyright 1996, 2015, Oracle and/or its affiliates. All rights reserved. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Oracle Fusion Middleware Java API Reference for Oracle WebLogic Server 12c (12.2.1) Part Number E55141-01 P4 Change 1723563 on 2015/10/09 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |