Main Page   Packages   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members  

Reporter.java

00001 package gov.nasa.arc.ase.jpf;
00002 
00003 import gov.nasa.arc.ase.util.Debug;
00004 
00005 /**
00006  * This class defines the reporter for the non distributed model checker. A
00007  * reporter is a thread that periodically prints information about the status
00008  * of the verification. This class implements the iReporter interface for a
00009  * non-distributed search.
00010  */
00011 public class Reporter implements iReporter, Runnable {
00012   /**
00013    * The Thread that periodically reports information about the search.
00014    */
00015   private Thread thread;
00016 
00017   /**
00018    * It is set to true when the reporter is running.
00019    */
00020   private boolean running;
00021 
00022   /**
00023    * Inizialize the Reporter.
00024    */
00025   public Reporter() {
00026     thread = new Thread(this);
00027     thread.setDaemon(true);
00028   }  
00029   public Thread getThread() {
00030     return thread;
00031   }  
00032   /**
00033    * Periodically prints a report line.
00034    */
00035   public void run() {
00036     try {
00037       long t = Engine.options.report_period * 1000;
00038 
00039       if(t != 0) {
00040     while(running) {
00041       try {
00042         Thread.sleep(t);
00043         Engine.getJPF().report();
00044       } catch(InterruptedException e) {
00045       }
00046     }
00047       }
00048     } catch(JPFErrorException e) {
00049       Debug.println(Debug.ERROR, "jpf: " + e.getMessage());
00050       System.exit(1);
00051     }
00052   }  
00053   /**
00054    * Starts the reporter.
00055    */
00056   public void start() {
00057     running = true;
00058     thread.start();
00059   }  
00060   /**
00061    * Stops the reporter.
00062    */
00063   public void stop() {
00064     running = false;
00065     thread.interrupt();
00066   }  
00067 }

Generated at Thu Feb 7 06:53:53 2002 for Bandera by doxygen1.2.10 written by Dimitri van Heesch, © 1997-2001