tppt.util
Class RunExperiment

java.lang.Object
  |
  +--tppt.util.RunExperiment

public class RunExperiment
extends java.lang.Object

RunExperiment is the class to activate the experiment progress. Create the RunExperiment and call RunExperiment.go() to start the experiment. The go method utilizes SwingWorker class to handle the time-comsuming experiment running that is controlled by the inner class execExperiment so the GUI could remain responsive.

Version:
1.1 04/25/00
Author:
Jie Su, 9/11/99 by Helen 11/14/00 Jiang Yin
See Also:
SwingWorker, RunExperiment.execExperiment

Inner Class Summary
(package private)  class RunExperiment.execExperiment
          This class runs the experiment progress in the background thread created by SwingWorker class.
 
Field Summary
(package private)  int currentTime
          keep track of number of seconds passed by
static boolean expDone
          true - if experiment is done
static boolean expError
          true - if transaction encounters error
(package private)  int expLength
          total number of seconds the experiment need to run
(package private)  GlobalData global
           
(package private)  int i
           
(package private)  int num
          number of terminals user requests.
(package private) static int numOfDeadlocks
          The total number of deadlocks happened in all terminals.
(package private)  int ONE_SECOND
           
(package private)  long showEndTime
          The duration of experiment in seconds.
(package private)  long showStartTime
          The start time of experiment in milliseconds.
(package private)  long showTime
          The duration of experiment has run in seconds so far.
(package private)  Terminal term
           
(package private)  java.util.Vector terminals
          A Vector of Terminal instance.
(package private)  javax.swing.Timer timer
           
(package private)  SwingWorker worker
           
 
Constructor Summary
RunExperiment()
          Constructs the RunExperiment.
 
Method Summary
 void abort()
          abort the experiemnt.
 int getCurrent()
          get the number of seconds the experiment have been executed so far.
 int getLengthOfExp()
          Return how many seconds the experiemnt should be run.
 int getNumOfDeadlocks()
          Get the total number of deadlocks happened in all terminals.
 void go()
          This method creates a SwingWorker to run the experiment.
private  void showError(java.lang.String errorMsg)
           
 void stopExperiment()
          Terminate the terminals and timer before the experiemnt stops.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

ONE_SECOND

final int ONE_SECOND

terminals

java.util.Vector terminals
A Vector of Terminal instance.

global

GlobalData global

numOfDeadlocks

static int numOfDeadlocks
The total number of deadlocks happened in all terminals.

i

int i

num

int num
number of terminals user requests.

term

Terminal term

timer

javax.swing.Timer timer

expLength

int expLength
total number of seconds the experiment need to run

currentTime

int currentTime
keep track of number of seconds passed by

expDone

public static boolean expDone
true - if experiment is done

expError

public static boolean expError
true - if transaction encounters error

showTime

long showTime
The duration of experiment has run in seconds so far.

showStartTime

long showStartTime
The start time of experiment in milliseconds.

showEndTime

long showEndTime
The duration of experiment in seconds.

worker

SwingWorker worker
Constructor Detail

RunExperiment

public RunExperiment()
Constructs the RunExperiment.
Method Detail

go

public void go()
This method creates a SwingWorker to run the experiment.
See Also:
SwingWorker, RunExperiment.execExperiment

abort

public void abort()
abort the experiemnt.

getLengthOfExp

public int getLengthOfExp()
Return how many seconds the experiemnt should be run.

getCurrent

public int getCurrent()
get the number of seconds the experiment have been executed so far.

getNumOfDeadlocks

public int getNumOfDeadlocks()
Get the total number of deadlocks happened in all terminals.

stopExperiment

public void stopExperiment()
Terminate the terminals and timer before the experiemnt stops.
See Also:
Terminal.stopTerm()

showError

private void showError(java.lang.String errorMsg)