aboutsummaryrefslogtreecommitdiffstats
path: root/ardor3d-core/src/main/java
diff options
context:
space:
mode:
authorRenanse <[email protected]>2013-03-14 22:20:03 -0500
committerRenanse <[email protected]>2013-03-14 22:20:03 -0500
commitfc33fb191bc5707824c9e2596afde38a0b5ad3af (patch)
treece3f2a275cf90b3a12dedd0749193b4c3586ac5e /ardor3d-core/src/main/java
parente4b91fa96b41364e78aa6516c0b0cb2487f4a7cf (diff)
Fields are now protected.
cancel now uses isDone() to determine if task already ran since result may be null at end of some tasks.
Diffstat (limited to 'ardor3d-core/src/main/java')
-rw-r--r--ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java21
1 files changed, 12 insertions, 9 deletions
diff --git a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
index 99034b4..11bdd37 100644
--- a/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
+++ b/ardor3d-core/src/main/java/com/ardor3d/util/GameTask.java
@@ -24,25 +24,28 @@ import java.util.logging.Logger;
* <code>GameTask</code> is used in <code>GameTaskQueue</code> to manage tasks that have yet to be accomplished.
*/
public class GameTask<V> implements Future<V> {
- private static final Logger logger = Logger.getLogger(GameTask.class.getName());
+ protected static final Logger logger = Logger.getLogger(GameTask.class.getName());
- private final Callable<V> callable;
+ protected final Callable<V> callable;
- private V _result;
- private ExecutionException _exception;
- private boolean _cancelled, _finished;
- private final ReentrantLock _stateLock = new ReentrantLock();
- private final Condition _finishedCondition = _stateLock.newCondition();
+ protected V _result;
+ protected ExecutionException _exception;
+ protected boolean _cancelled, _finished;
+ protected final ReentrantLock _stateLock = new ReentrantLock();
+ protected final Condition _finishedCondition = _stateLock.newCondition();
public GameTask(final Callable<V> callable) {
this.callable = callable;
}
+ /**
+ * @param mayInterruptIfRunning
+ * ignored by this implementation.
+ */
public boolean cancel(final boolean mayInterruptIfRunning) {
- // TODO mayInterruptIfRunning was ignored in previous code, should this param be removed?
_stateLock.lock();
try {
- if (_result != null) {
+ if (isDone()) {
return false;
}
_cancelled = true;