aboutsummaryrefslogtreecommitdiffstats
path: root/src/java/com/jogamp/common/util/RunnableTask.java
diff options
context:
space:
mode:
authorSven Gothel <[email protected]>2010-09-27 03:11:41 +0200
committerSven Gothel <[email protected]>2010-09-27 03:11:41 +0200
commitecb4673c21281143b394080b7c7ac42ccccd8fc4 (patch)
treee5c2dd9277026dcede6163dae0f7560e5880febf /src/java/com/jogamp/common/util/RunnableTask.java
parent34cf68fd0e1482ce42432cde142806c4b84270d2 (diff)
RunnableTask: Add attachment
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+"]";
}
}