|
Groovy Documentation | |||||||
| FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | METHOD | DETAIL: FIELD | METHOD | |||||||
interface Timers
This interface is available from any GLU script using timers property
class MyScript
{
def timer1 = {
log.info "hello world"
}
def install = {
timers.schedule(timer: timer1, repeatFrequency: '1m') // property
// timers.schedule(timer: 'timer1', repeatFrequency: '1m') // also valid (name of the property)
// timers.schedule(timer: { println 'hello world'}, repeatFrequency: '1m') // invalid (anonymous closure)
}
def uninstall = {
timers.cancel(timer: timer1)
}
}
| Method Summary | |
|---|---|
boolean
|
cancel(java.lang.Object args)
@param args.timer timer |
FutureExecution
|
schedule(java.lang.Object args)
Schedule a timer. |
| Method Detail |
|---|
boolean cancel(java.lang.Object args)
args.timer - timerfalse if the execution could not be cancelled, typically because it has already completed
normally; true otherwise
FutureExecution schedule(java.lang.Object args)
Closure.
args.timer - there can only be one timer with a given name (note that the timer needs
to be a pointer to a Closure, so it can either be the name of the property
holding the Closure or directly the property itself)args.initialFrequency - how long to wait the first time (optional)args.repeatFrequency - how long to wait after the first time
Groovy Documentation