|
Oracle Fusion Middleware Oracle WebLogic Server API Reference 12c Release 1 (12.1.1) Part Number E24391-02 |
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface TimerManager
A facility for threads to schedule future work.
Each time an application calls schedule or scheduledAtAFixedRate a timer is created and returned to the user. The timer can then be queried and used to cancel the timer. When a timer expires its listener is executed. If the timer is a repeating timer, then the timer is rescheduled and the listener will be executed again. This class is thread-safe. Any number of threads may schedule timers without external synchronization. Each timer is guaranteed to execute within only one thread of execution. However, a listener that is associated with multiple timers can be concurrently executed. Repeating timers that have not been cancelled will continue until they are cancelled or until the timer manager is stopped.
Method Summary | |
---|---|
boolean |
isStopped()
Returns true if all TimerListeners have completed following stop. |
boolean |
isStopping()
Returns true if TimerManager is stopping or has already stopped. |
boolean |
isSuspended()
Returns true if all TimerListeners have completed following suspend. |
boolean |
isSuspending()
Returns true if TimerManager is suspending or is already suspended. |
void |
resume()
Resume the timer manager. |
Timer |
schedule(TimerListener listener,
Date time)
Schedules the specified task for execution at the specified time. |
Timer |
schedule(TimerListener listener,
Date firstTime,
long period)
Schedules the specified listener for repeated execution starting at the specified date, and then repeatedly with a fixed delay between subsequent executions. |
Timer |
schedule(TimerListener listener,
long delay)
Schedules the specified listener for execution after the specified delay. |
Timer |
schedule(TimerListener listener,
long delay,
long period)
Schedules the specified listener for repeated execution with an initial delay before the first execution and then repeatedly with a fixed delay between subsequent executions. |
Timer |
schedule(TimerListener listener,
ScheduleExpression schedule)
Schedules the specified listener for a calendar-based timer. |
Timer |
scheduleAtFixedRate(TimerListener listener,
Date firstTime,
long period)
Schedules the specified listener for repeated execution with an initial delay before the first execution and then repeatedly at a fixed rate. |
Timer |
scheduleAtFixedRate(TimerListener listener,
long delay,
long period)
Schedules the specified listener for repeated execution starting at the specified date, and then repeatedly at a fixed rate. |
void |
stop()
Stop the timer manager permanently. |
void |
suspend()
Suspend the timer manager. |
boolean |
waitForStop(long timeout_ms)
Blocks until all TimerListeners have completed execution after a stop request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
boolean |
waitForSuspend(long timeout_ms)
Blocks until all TimerListeners have completed execution after a suspend request, or the timeout occurs, or the current thread is interrupted, whichever happens first. |
Method Detail |
---|
Timer schedule(TimerListener listener, long delay)
listener
- listener to be scheduled.delay
- delay in milliseconds before listener is executed
IllegalArgumentException
- if delay is negative
IllegalStateException
- if timer manager is stoppedTimer schedule(TimerListener listener, Date time)
listener
- listener to be scheduled.time
- time at which listener is to be executed.
IllegalArgumentException
- if time.getTime() is negative.
IllegalStateException
- if timer manager is stoppedTimer schedule(TimerListener listener, long delay, long period)
listener
- listener to be scheduleddelay
- delay in milliseconds before listener is executedperiod
- time in milliseconds between successive executions
IllegalArgumentException
- if delay is negative
IllegalArgumentException
- if period is negative
IllegalStateException
- if timer manager stoppedTimer schedule(TimerListener listener, Date firstTime, long period)
listener
- listener to be scheduledfirstTime
- time at which listener is first to be executed.period
- time in milliseconds between successive executions
IllegalArgumentException
- if period is negative
IllegalStateException
- if timer manager is stoppedTimer schedule(TimerListener listener, ScheduleExpression schedule)
listener
- listener to be scheduledschedule
- The schedule expression describing the timeouts for this timer.
IllegalArgumentException
- if the schedule represents an invalid schedule expression
IllegalStateException
- if timer manager is stoppedTimer scheduleAtFixedRate(TimerListener listener, Date firstTime, long period)
listener
- listener to be scheduledfirstTime
- delay in milliseconds before listener is executedperiod
- time in milliseconds between successive executions
IllegalArgumentException
- if delay is negative
IllegalArgumentException
- if period is negative
IllegalStateException
- if timer manager is stoppedTimer scheduleAtFixedRate(TimerListener listener, long delay, long period)
listener
- listener to be scheduleddelay
- delay in milliseconds before listener is executedperiod
- time in milliseconds between successive executions
IllegalArgumentException
- if delay is negative
IllegalArgumentException
- if period is negative
IllegalStateException
- if timer manager is stoppedvoid resume()
IllegalStateException
- if the timer manager has
been stoppedvoid suspend()
IllegalStateException
- if the timer manager has
been stopped.void stop()
Attempts to schedule timer, resume, or suspend stopped timer managers will result in an IllegalStateException.
boolean waitForStop(long timeout_ms) throws InterruptedException
timeout_ms
- the maximum time to wait
InterruptedException
- if interrupted while waitingboolean isStopping()
boolean isStopped()
boolean waitForSuspend(long timeout_ms) throws InterruptedException
timeout_ms
- the maximum time to wait
InterruptedException
- if interrupted while waitingboolean isSuspending()
boolean isSuspended()
|
Copyright 1996, 2011, 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 Oracle WebLogic Server API Reference 12c Release 1 (12.1.1) Part Number E24391-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |