com.novell.zos.jdl
Class Timer

java.lang.Object
  extended by com.novell.zos.jdl.Timer

public class Timer
extends java.lang.Object

Timer schedules a callback to a Job or Joblet method.

Timers can schedule a one time or a repeated callback on an interval basis. An active Timer will keep the Job or Joblet running. You must manually cancel or terminate the Job or Joblet or invoke the Timer's cancel() method.

Example to setup a Timer callback every 5 seconds with no delay. This Job will remain running subject to job timeout or cancellation.

 class timer(Job):
    def job_started_event(self):
       print "Started %s" % self.getFact("job.id")
       timer = Timer(self.timer_callback, 0, 5)

   def timer_callback(self):
       print "timer callback invoked"
 


Constructor Summary
Timer(org.python.core.PyMethod method, int delay)
          Construct a one-time Timer instance.
Timer(org.python.core.PyMethod method, int delay, int interval)
          Construct a Timer that repeatedly calls the method.
 
Method Summary
 void cancel()
          Stop this timer from repeating.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Timer

public Timer(org.python.core.PyMethod method,
             int delay)
Construct a one-time Timer instance.

Parameters:
method - Method to call after delay
delay - Seconds to wait before invoking method

Timer

public Timer(org.python.core.PyMethod method,
             int delay,
             int interval)
Construct a Timer that repeatedly calls the method.

Parameters:
method - Method to call at intervals
delay - Seconds to wait before first callback
interval - Seconds between when method is called repeatedly
Method Detail

cancel

public void cancel()
Stop this timer from repeating. No further callbacks will occur.



Copyright (c) 2011 Novell, Inc. All rights reserved.