org.edg.security.voms.service
Class VOMSTimer

java.lang.Object
  |
  +--java.util.Timer
        |
        +--org.edg.security.voms.service.VOMSTimer

public class VOMSTimer
extends java.util.Timer

General timer for VOMS: a decorated singleton for Timer that extends it with an interface for waiting for the currently running timer (if any) to finish execution. The timer thread is used by CAUpdater to schedule updates on the CA table and for various other periodic administrative activities.

Version:
$Id: VOMSTimer.java,v 1.4 2003/11/30 19:00:03 szamcsi Exp $
Author:
Akos Frohner , Karoly Lorentey

Nested Class Summary
private  class VOMSTimer.TracedTimerTask
           
 
Field Summary
private  boolean cancelled
          True if the timer has been cancelled.
private static org.apache.log4j.Logger log
           
private  int running_tasks
           
private static VOMSTimer vomsTimer
           
 
Fields inherited from class java.util.Timer
 
Constructor Summary
private VOMSTimer()
           
 
Method Summary
 void cancel()
           
private  void endRunning()
           
 java.util.TimerTask getTracedTimerTask(java.util.TimerTask t)
           
 boolean isCancelled()
          Returns true if the timer has been cancelled.
 boolean isRunning()
           
 void schedule(java.util.TimerTask task, java.util.Date time)
           
 void schedule(java.util.TimerTask task, java.util.Date firstTime, long period)
           
 void schedule(java.util.TimerTask task, long delay)
           
 void schedule(java.util.TimerTask task, long delay, long period)
           
 void scheduleAtFixedRate(java.util.TimerTask task, java.util.Date firstTime, long period)
           
 void scheduleAtFixedRate(java.util.TimerTask task, long delay, long period)
           
private  void startRunning()
           
static VOMSTimer theTimer()
           
 
Methods inherited from class java.util.Timer
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

private static org.apache.log4j.Logger log

vomsTimer

private static VOMSTimer vomsTimer

running_tasks

private int running_tasks

cancelled

private boolean cancelled
True if the timer has been cancelled.

Constructor Detail

VOMSTimer

private VOMSTimer()
Method Detail

isRunning

public boolean isRunning()

startRunning

private void startRunning()

endRunning

private void endRunning()

getTracedTimerTask

public java.util.TimerTask getTracedTimerTask(java.util.TimerTask t)

isCancelled

public boolean isCancelled()
Returns true if the timer has been cancelled. This should be periodically checked in timer tasks to allow for a prompt service shutdown.

Important note: timer tasks should store a reference to their instance of VOMSTimer, and their run() methods should call isCancelled() through that reference. Calling isCancelled() through theTimer() always returns true, even if the currently running timer was cancelled.


theTimer

public static VOMSTimer theTimer()

cancel

public void cancel()
Overrides:
cancel in class java.util.Timer

schedule

public void schedule(java.util.TimerTask task,
                     java.util.Date time)
Overrides:
schedule in class java.util.Timer

schedule

public void schedule(java.util.TimerTask task,
                     java.util.Date firstTime,
                     long period)
Overrides:
schedule in class java.util.Timer

schedule

public void schedule(java.util.TimerTask task,
                     long delay)
Overrides:
schedule in class java.util.Timer

schedule

public void schedule(java.util.TimerTask task,
                     long delay,
                     long period)
Overrides:
schedule in class java.util.Timer

scheduleAtFixedRate

public void scheduleAtFixedRate(java.util.TimerTask task,
                                java.util.Date firstTime,
                                long period)
Overrides:
scheduleAtFixedRate in class java.util.Timer

scheduleAtFixedRate

public void scheduleAtFixedRate(java.util.TimerTask task,
                                long delay,
                                long period)
Overrides:
scheduleAtFixedRate in class java.util.Timer