cz.cuni.pogamut.experiments
Class AbstractExperimentHandle

java.lang.Object
  extended by cz.cuni.pogamut.experiments.AbstractExperimentHandle
All Implemented Interfaces:
ExperimentHandle
Direct Known Subclasses:
Experiment

public abstract class AbstractExperimentHandle
extends java.lang.Object
implements ExperimentHandle

Abstract implementation of ExperimentHandle. Classes implementing this abstract class should count down the experimentRunningLatch, getResult() waits on this latch.


Field Summary
protected  java.lang.Exception exception
          Exception that was raised during execution of the experiment.
protected  java.util.concurrent.CountDownLatch experimentRunningLatch
          Latch where thread can wait for results of the experiment.
protected  ExperimentResult result
          Result of this experiment, it is set from the user code setResult()
protected  Flag<ExperimentExecutionState> stateFlag
          Flag with a state of execution.
 
Constructor Summary
AbstractExperimentHandle()
          Creates a new instance of AbstractHandle
 
Method Summary
 java.lang.Exception getException()
          Blocking method returning exception that may have been raised during execution of the experiment.
 Flag<ExperimentExecutionState> getExperimentExecutionFlag()
           
 ExperimentResult getResult()
          Returns result of the experiment, blocks if called during execution of the experiment.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface cz.cuni.pogamut.experiments.ExperimentHandle
getName, stop
 

Field Detail

experimentRunningLatch

protected java.util.concurrent.CountDownLatch experimentRunningLatch
Latch where thread can wait for results of the experiment.


exception

protected java.lang.Exception exception
Exception that was raised during execution of the experiment.


result

protected ExperimentResult result
Result of this experiment, it is set from the user code setResult()


stateFlag

protected Flag<ExperimentExecutionState> stateFlag
Flag with a state of execution.

Constructor Detail

AbstractExperimentHandle

public AbstractExperimentHandle()
Creates a new instance of AbstractHandle

Method Detail

getResult

public ExperimentResult getResult()
                           throws java.lang.Exception
Returns result of the experiment, blocks if called during execution of the experiment.

Specified by:
getResult in interface ExperimentHandle
Returns:
Result of the experiment
Throws:
java.lang.Exception - exception that may have been raised during execution of the experiment

getException

public java.lang.Exception getException()
Description copied from interface: ExperimentHandle
Blocking method returning exception that may have been raised during execution of the experiment. It is advised to check this method before getting the results from getResult() method.

Specified by:
getException in interface ExperimentHandle
Returns:
null if no exception was thrown

getExperimentExecutionFlag

public Flag<ExperimentExecutionState> getExperimentExecutionFlag()
Specified by:
getExperimentExecutionFlag in interface ExperimentHandle
Returns:
Flag with execution state of experiment.