提交 62cdd2bb authored 作者: Thomas Mueller's avatar Thomas Mueller

Allow testing if the thread finished

上级 e71508b9
......@@ -22,6 +22,8 @@ public abstract class Task implements Runnable {
*/
protected Object result;
private volatile boolean finished;
private Thread thread;
private Exception ex;
......@@ -40,6 +42,7 @@ public abstract class Task implements Runnable {
} catch (Exception e) {
this.ex = e;
}
finished = true;
}
/**
......@@ -79,6 +82,15 @@ public abstract class Task implements Runnable {
return result;
}
/**
* Whether the call method has returned (with or without exception).
*
* @return true if yes
*/
public boolean isFinished() {
return finished;
}
/**
* Get the exception that was thrown in the call (if any).
*
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论