提交 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 { ...@@ -22,6 +22,8 @@ public abstract class Task implements Runnable {
*/ */
protected Object result; protected Object result;
private volatile boolean finished;
private Thread thread; private Thread thread;
private Exception ex; private Exception ex;
...@@ -40,6 +42,7 @@ public abstract class Task implements Runnable { ...@@ -40,6 +42,7 @@ public abstract class Task implements Runnable {
} catch (Exception e) { } catch (Exception e) {
this.ex = e; this.ex = e;
} }
finished = true;
} }
/** /**
...@@ -78,6 +81,15 @@ public abstract class Task implements Runnable { ...@@ -78,6 +81,15 @@ public abstract class Task implements Runnable {
} }
return result; 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). * Get the exception that was thrown in the call (if any).
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论