38daenzerorama * @author Michael Daenzer (University of Zurich)
3daenzerorama//TODO dmi introduce new Factory classes for easy handling of several parallel executions.
3daenzerorama//TODO dmi think about execute method for processes (this is OO)
2ronwalf * @see org.mindswap.owls.process.execution.ProcessExecutionEngine#execute(org.mindswap.owls.process.Process, org.mindswap.query.ValueMap)
3daenzerorama * (non-Javadoc)
3daenzerorama * @see impl.owls.process.execution.ProcessExecutionEngineImpl#executeAtomicProcess(org.mindswap.owls.process.AtomicProcess, org.mindswap.query.ValueMap)
3daenzerorama * (non-Javadoc)
3daenzerorama * @see impl.owls.process.execution.ProcessExecutionEngineImpl#executeConstruct(org.mindswap.owls.process.ControlConstruct)
3daenzerorama if (isInterrupted())
3daenzerorama if (isStopped())
3daenzerorama * (non-Javadoc)
3daenzerorama * @see org.mindswap.owls.process.execution.ThreadedProcessExecutionEngine#continueExecution()
2ronwalf setInterrupted(false);
3daenzerorama * (non-Javadoc)
3daenzerorama * @see org.mindswap.owls.process.execution.ThreadedProcessExecutionEngine#interruptExecution()
3daenzerorama * (non-Javadoc)
3daenzerorama * @see org.mindswap.owls.process.execution.ThreadedProcessExecutionEngine#interruptExecution(int)
2ronwalf setInterrupted(true);
3daenzerorama setStopped(true);
3daenzerorama /**
3daenzerorama * Checks whether interrupted flag is set or not
3daenzerorama * @return true, if flag set. false, otherwise.
2ronwalf return interrupted;
3daenzerorama /**
3daenzerorama * Sets the interrupted flag for the given process
3daenzerorama * @param interrupted the new value of the flag
3daenzerorama /**
3daenzerorama * Checks whether interrupted flag is set or not
3daenzerorama * @return true, if flag set. false, otherwise.
3daenzerorama return stopped;
3daenzerorama /**
3daenzerorama * Sets the interrupted flag for the given process
3daenzerorama * @param interrupted the new value of the flag
3daenzerorama /**
3daenzerorama * Handles the interruption in a loop checking each <code>sleepInterval</code>.
3daenzerorama * milliseconds the interruption state.
2ronwalf while (isInterrupted()) {
2ronwalf } catch (InterruptedException e) {
2ronwalf e.printStackTrace();
3daenzerorama * Handles a stop of the execution and loops until object is garbage collected
3daenzerorama while (true) {
3daenzerorama try {
3daenzerorama } catch (InterruptedException e) {
3daenzerorama * invokes the executionInterrupted() method on all registred monitors
3daenzerorama * invokes the executionContinued() method on all registered monitors
3daenzerorama * invokes the getProcessResults() method on all registered monitors
3daenzerorama * (non-Javadoc)
3daenzerorama * @see org.mindswap.owls.process.execution.ThreadedProcessExecutionEngine#getSleepInterval()
3daenzerorama return sleepInterval;
3daenzerorama * (non-Javadoc)
3daenzerorama * @see org.mindswap.owls.process.execution.ThreadedProcessExecutionEngine#setSleepInterval(int)