|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.lang.Thread
de.cau.cs.kieler.sim.kiem.execution.TimeoutThread
public class TimeoutThread
The Class TimeoutThread. It is used to handle timeouts of methods implemented by DataComponents
during the execution. An instance of this class is designed to run in a concurrent worker thread.
Whenever the timeout method is called the timeout is activated.
There are two possibilities to stop or deactivate the timeout when the component finished in
time:
1. set another new timeout by calling
timeout(int, String, DataComponentWrapper, Execution)
again.
2. reset the timeout by calling abortTimeout()
.
When a timeout is triggered then an error message is generated and the execution is stopped
immediately. Note that the execution manager only tries to stop all concurrent threads but cannot
guarantee that they really terminate in the end.
If a timeout is triggered and the execution is stopped, the timeout thread itself also
terminates.
A timeout must be at least 100ms (reasonable).
Field Summary |
---|
Fields inherited from class java.lang.Thread |
---|
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
Constructor Summary | |
---|---|
TimeoutThread()
Instantiates a new timeout thread. |
Method Summary | |
---|---|
void |
abortTimeout()
Abort a timeout. |
static boolean |
isAwaitUserResponse()
Checks whether await user response is true. |
void |
run()
When an object implementing interface Runnable is used
to create a thread, starting the thread causes the object's
run method to be called in that separately executing
thread. |
static void |
setAwaitUserRepsonse(boolean awaitUserResponseParam)
Sets the await user repsonse flag. |
void |
terminate()
Terminates this thread by awaking it (if it is suspended). |
void |
timeout(int timeoutParam,
String jobDescriptionParam,
DataComponentWrapper dataComponentWrapperParam,
Execution executionParam)
Activate as a new timeout. |
Methods inherited from class java.lang.Thread |
---|
currentThread, getName, getPriority, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, setDaemon, setName, setPriority, sleep, start, yield |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public TimeoutThread()
Method Detail |
---|
public static void setAwaitUserRepsonse(boolean awaitUserResponseParam)
awaitUserResponseParam
- the new await user repsonsepublic static boolean isAwaitUserResponse()
public void timeout(int timeoutParam, String jobDescriptionParam, DataComponentWrapper dataComponentWrapperParam, Execution executionParam)
timeoutParam
- the timeout in msjobDescriptionParam
- the job descriptiondataComponentWrapperParam
- the affected DataComponentWrapperexecutionParam
- a link to the executionpublic void abortTimeout()
timeout(int, String, DataComponentWrapper, Execution)
.
public void terminate()
run()
method will
terminate if it sees the terminate
flag to be true.
public void run()
Runnable
Runnable
is used
to create a thread, starting the thread causes the object's
run
method to be called in that separately executing
thread.
run
in interface Runnable
run
in class Thread
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |