summaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/RunnableTask.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/java/com/jogamp/common/util/RunnableTask.java')
-rw-r--r--src/java/com/jogamp/common/util/RunnableTask.java19
1 files changed, 18 insertions, 1 deletions
diff --git a/src/java/com/jogamp/common/util/RunnableTask.java b/src/java/com/jogamp/common/util/RunnableTask.java
index f885f46..eac6255 100644
--- a/src/java/com/jogamp/common/util/RunnableTask.java
+++ b/src/java/com/jogamp/common/util/RunnableTask.java
@@ -36,6 +36,7 @@ public class RunnableTask implements Runnable {
Runnable runnable;
Object notifyObject;
boolean catchExceptions;
+ Object attachment;
Throwable runnableException;
long ts0, ts1, ts2;
@@ -57,6 +58,22 @@ public class RunnableTask implements Runnable {
ts2 = 0;
}
+ public Runnable getRunnable() {
+ return runnable;
+ }
+
+ /**
+ * Attach a custom object to this task.
+ * Useful to piggybag further information, ie tag a task final.
+ */
+ public void setAttachment(Object o) {
+ attachment = o;
+ }
+
+ public Object getAttachment() {
+ return attachment;
+ }
+
public void run() {
ts1 = System.currentTimeMillis();
if(null == notifyObject) {
@@ -109,7 +126,7 @@ public class RunnableTask implements Runnable {
public long getDurationTotal() { return ts2 - ts0; }
public String toString() {
- return "RunnableTask[executed "+isExecuted()+", t2-t0 "+getDurationTotal()+", t2-t1 "+getDurationInExec()+", t1-t0 "+getDurationInQueue()+", throwable "+getThrowable()+", Runnable "+runnable+"]";
+ return "RunnableTask[executed "+isExecuted()+", t2-t0 "+getDurationTotal()+", t2-t1 "+getDurationInExec()+", t1-t0 "+getDurationInQueue()+", throwable "+getThrowable()+", Runnable "+runnable+", Attachment "+attachment+"]";
}
}