ptolemy.copernicus.kernel
Class WatchDogTimer

java.lang.Object
  extended bysoot.Transformer
      extended bysoot.SceneTransformer
          extended byptolemy.copernicus.kernel.WatchDogTimer
All Implemented Interfaces:
soot.HasPhaseOptions

public class WatchDogTimer
extends soot.SceneTransformer
implements soot.HasPhaseOptions

A transformer that calls System.exit() after a certain amount of time. This transformer is useful for killing tests that are in tight loops. We use a transformer instead of building this directly into the KernelMain class to get parameter handling for free.

Since:
Ptolemy II 2.0
Version:
$Id: WatchDogTimer.java,v 1.23 2004/04/13 05:12:24 cxh Exp $
Author:
Stephen Neuendorffer, Christopher Hylands
Accepted Rating:
Red (cxh)
Proposed Rating:
Red (cxh)

Method Summary
 void cancel()
           
 java.lang.String getDeclaredOptions()
           
 java.lang.String getDefaultOptions()
           
 java.lang.String getPhaseName()
           
protected  void internalTransform(java.lang.String phaseName, java.util.Map options)
          Start up a watch dog timer that will call System.exit().
static WatchDogTimer v()
           
 
Methods inherited from class soot.SceneTransformer
transform, transform
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

v

public static WatchDogTimer v()

cancel

public void cancel()

getPhaseName

public java.lang.String getPhaseName()
Specified by:
getPhaseName in interface soot.HasPhaseOptions

getDefaultOptions

public java.lang.String getDefaultOptions()
Specified by:
getDefaultOptions in interface soot.HasPhaseOptions

getDeclaredOptions

public java.lang.String getDeclaredOptions()
Specified by:
getDeclaredOptions in interface soot.HasPhaseOptions

internalTransform

protected void internalTransform(java.lang.String phaseName,
                                 java.util.Map options)
Start up a watch dog timer that will call System.exit(). Sample option arguments:
        -p wjtp.watchDogTimer time:10000
  
means that exit will be called in 10,000 ms, or 10 seconds

Parameters:
phaseName - The name of the phase, for example wjtp.watchDogTimer.
options - The options Map. This method uses the time option to specify the number of milliseconds until System.exit() should be called.