summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-11-13 18:41:26 +0000
committerpjain <pjain@ae88bc3d-4319-0410-8dbf-d08b4c9d3795>1996-11-13 18:41:26 +0000
commitc8d8317032eb8b11aba34421ac55058b0af7118e (patch)
tree7ee862a6c624b0d1feaedff7e39a115f5466b771
parenta9d730d57e2630ed3b3d4488f039dac33c771db7 (diff)
downloadATCD-c8d8317032eb8b11aba34421ac55058b0af7118e.tar.gz
Fixed a small bug. In activate(), we need to make sure that an
instance of ThreadManager exists before we call thrCount(). This was not the case and therefore we were getting a NullPointerException.
-rw-r--r--java/src/Task.java8
1 files changed, 4 insertions, 4 deletions
diff --git a/java/src/Task.java b/java/src/Task.java
index 0c1c41ec826..af6251ec783 100644
--- a/java/src/Task.java
+++ b/java/src/Task.java
@@ -102,14 +102,14 @@ public abstract class Task implements Runnable, EventHandler
*/
public synchronized int activate (long flags, int nThreads, boolean forceActive)
{
- if (this.thrCount () > 0 && forceActive == false)
- return 1; // Already active.
- this.flags_ = flags;
-
// Create a Thread Manager if we do not already have one
if (this.thrMgr_ == null)
this.thrMgr_ = new ThreadManager ();
+ if (this.thrCount () > 0 && forceActive == false)
+ return 1; // Already active.
+ this.flags_ = flags;
+
if (ACE.BIT_ENABLED (flags, TaskFlags.THR_DAEMON))
this.thrMgr_.spawnN (nThreads, this, true); // Spawn off all threads as daemon threads
else // Spawn off all threads as normal threads