You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@river.apache.org by pa...@apache.org on 2010/09/19 23:35:06 UTC

svn commit: r998737 - in /incubator/river/jtsk/skunk/patsTaskManager: ./ qa/src/com/sun/jini/test/impl/lookupdiscovery/ qa/src/com/sun/jini/test/impl/mahalo/ qa/src/com/sun/jini/test/impl/outrigger/matching/ qa/src/com/sun/jini/test/impl/thread/ qa/src...

Author: pats
Date: Sun Sep 19 21:35:05 2010
New Revision: 998737

URL: http://svn.apache.org/viewvc?rev=998737&view=rev
Log:
Update interface between TaskManager and its callers:
1. Make Task a static nested class rather than an interface, so that it can
have implemented methods and carry private working data.
2. Change runAfter to take an Iterable<Task>, increasing flexibility, and
return the first conflicting task in the Iterable.
3. Add a private method with the same type as the old runAfter method to
make any failures to update into compile time errors.
These changes are preparatory to TaskManager reimplementation.

Change common.xml to specify 1.5 as default target, to allow use of 
Iterable and enum.

Modified:
    incubator/river/jtsk/skunk/patsTaskManager/common.xml
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/mahalo/RandomStressTask.java
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/outrigger/matching/StressTest.java
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/thread/TaskManagerTaskExceptionTest.java
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java
    incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/reggie/RegistrarImpl.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/fiddler/FiddlerImpl.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/ParticipantTask.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/SettlerTask.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mercury/MailboxImpl.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/norm/event/EventType.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/Notifier.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/TxnMonitorTask.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/reggie/RegistrarImpl.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/RetryTask.java
    incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/TaskManager.java
    incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupDiscovery.java
    incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupLocatorDiscovery.java
    incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lease/LeaseRenewalManager.java
    incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/JoinManager.java
    incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/ServiceDiscoveryManager.java

Modified: incubator/river/jtsk/skunk/patsTaskManager/common.xml
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/common.xml?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/common.xml (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/common.xml Sun Sep 19 21:35:05 2010
@@ -175,7 +175,7 @@
         <attribute name="debug" default="${debug}"/>
         <attribute name="debuglevel" default="${debuglevel}"/>
         <attribute name="source" default="5"/>
-        <attribute name="target" default="jsr14"/>
+        <attribute name="target" default="1.5"/>
         <attribute name="deprecation" default="${deprecation}"/>
         <attribute name="verbose" default="${verbose}"/>
         <attribute name="nowarn" default="${nowarn}"/>

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/lookupdiscovery/RestoreContextForTasks.java Sun Sep 19 21:35:05 2010
@@ -88,8 +88,9 @@ public class RestoreContextForTasks exte
 	    }
 	}
     }
-    public static class DangerousTask extends DangerousRunnable
-	implements TaskManager.Task {
+    public static class DangerousTask extends TaskManager.Task {
+    	public boolean securityException = false;
+    	public boolean done = false;
 
 	public void run() {
 	    try {
@@ -104,9 +105,7 @@ public class RestoreContextForTasks exte
 		this.notify();
 	    }
 	}
-	public boolean runAfter(List l, int i) {
-	    return false;
-	}
+
     }
     public void setup(QAConfig sysConfig) throws Exception {
 	super.setup(sysConfig);

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/mahalo/RandomStressTask.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/mahalo/RandomStressTask.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/mahalo/RandomStressTask.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/mahalo/RandomStressTask.java Sun Sep 19 21:35:05 2010
@@ -66,13 +66,6 @@ public abstract class RandomStressTask e
         }
     }
 
-    /*
-     * RetryTask abstract method definition
-     * note: subclass needs to define tryOnce
-     */
-    public boolean runAfter(List list, int max) {
-        return false;
-    }
 
     public void setBehavior(int op) {
         try {

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/outrigger/matching/StressTest.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/outrigger/matching/StressTest.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/outrigger/matching/StressTest.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/outrigger/matching/StressTest.java Sun Sep 19 21:35:05 2010
@@ -24,6 +24,7 @@ import com.sun.jini.qa.harness.TestExcep
 import com.sun.jini.qa.harness.QAConfig;
 
 // All other imports
+import java.util.Collection;
 import java.util.List;
 import java.rmi.RemoteException;
 import net.jini.core.lease.Lease;
@@ -494,7 +495,7 @@ public class StressTest extends MatchTes
      * subsequent comsumption by the reader tasks.
      */
     class WriteRandomEntryTask extends StressTask
-            implements TaskManager.Task, TimeConstants {
+            implements TimeConstants {
 
         /**
          * Allocated number of write requests for this task.
@@ -650,19 +651,6 @@ public class StressTest extends MatchTes
             writeCount.increment();
         }
 
-        /**
-         * Determines whether this task can be scheduled.
-         * The given lists of tasks can be queried for any
-         * dependency conditions.
-         * Called prior to scheduling this task object.
-         * Currently, writeTasks have no dependency on any other
-         * tasks, so it just returns false.
-         */
-        public boolean runAfter(java.util.List tasks, int size) {
-
-            // Write tasks are not dependent on any other tasks
-            return false;
-        }
     }
 
 
@@ -671,7 +659,7 @@ public class StressTest extends MatchTes
      * from the <code>writeList</code> and subesequent read/take of that entry
      * from the space.
      */
-    class ReadAndTakeEntryTask extends StressTask implements TaskManager.Task {
+    class ReadAndTakeEntryTask extends StressTask{
 
         /**
          * Number of requested read operations.
@@ -911,20 +899,20 @@ public class StressTest extends MatchTes
          * read tasks will wait for all write tasks to complete
          * before executing.
          */
-        public boolean runAfter(java.util.List tasks, int size) {
+        public TaskManager.Task runAfter(java.lang.Iterable<TaskManager.Task> tasks) {
 
             /*
              * If not interleaving then check to see if any
-             * write tasks exist. If so, then return true.
+             * write tasks exist. If so, return the first one.
              */
             if (!interleave) {
-                for (int i = 0; i < size; ++i) {
-                    if (tasks.get(i) instanceof WriteRandomEntryTask) {
-                        return true;
+                for (TaskManager.Task task : tasks) {
+                    if (task instanceof WriteRandomEntryTask) {
+                        return task;
                     }
                 }
             }
-            return false;
+            return null;
         }
     }
 
@@ -935,7 +923,7 @@ public class StressTest extends MatchTes
      * a unique identifier for each instantiation.
      * It also provides print utiility functions.
      */
-    class StressTask {
+    abstract class StressTask extends TaskManager.Task{
 
         /**
          * Unique identifier for each StressTask object

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/thread/TaskManagerTaskExceptionTest.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/thread/TaskManagerTaskExceptionTest.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/thread/TaskManagerTaskExceptionTest.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/impl/thread/TaskManagerTaskExceptionTest.java Sun Sep 19 21:35:05 2010
@@ -26,6 +26,7 @@ import com.sun.jini.thread.TaskManager.T
 
 //java.util
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.List;
 
 /**
@@ -45,18 +46,17 @@ public class TaskManagerTaskExceptionTes
         long goodTaskTime = badTaskTime + (10*1000);
         ArrayList taskList = new ArrayList();
         taskList.add(0, new Task() {
-            public boolean runAfter(List tasks, int size){
-                return false;
-
-            }
             public void run() {
                 throw new RuntimeException("Expected Exception");
             }
         });
         final boolean result[] = new boolean[]{false};
         taskList.add(1, new Task() {
-            public boolean runAfter(List tasks, int size){
-                return (tasks.size()>1);
+            public Task runAfter(java.lang.Iterable<Task> tasks){
+                for(Task t : tasks){
+                	return t;
+                }
+                return null;
             }
             public void run() {
                 result[0] = true;

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/DiscoveryProtocolSimulator.java Sun Sep 19 21:35:05 2010
@@ -789,7 +789,7 @@ public class DiscoveryProtocolSimulator 
 	}
     }
 
-    private final class AddressTask implements TaskManager.Task {
+    private final class AddressTask extends TaskManager.Task {
 
 	/** The address */
 	public final InetAddress addr;
@@ -824,14 +824,10 @@ public class DiscoveryProtocolSimulator 
 	    }
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }//end class AddressTask
 
     /** Socket for unicast discovery response. */
-    private final class SocketTask implements TaskManager.Task {
+    private final class SocketTask extends TaskManager.Task {
 
 	/** The socket */
 	public final Socket socket;
@@ -846,10 +842,6 @@ public class DiscoveryProtocolSimulator 
 	    respond(socket);
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }//end class SocketTask
 
     /** Process a unicast discovery request, and respond. */

Modified: incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/reggie/RegistrarImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/reggie/RegistrarImpl.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/reggie/RegistrarImpl.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/qa/src/com/sun/jini/test/share/reggie/RegistrarImpl.java Sun Sep 19 21:35:05 2010
@@ -1749,7 +1749,7 @@ public class RegistrarImpl implements Re
     }
 
     /** An event to be sent, and the listener to send it to. */
-    private final class EventTask implements TaskManager.Task {
+    private final class EventTask extends TaskManager.Task {
 
 	/** The event registration */
 	public final EventReg reg;
@@ -1800,19 +1800,18 @@ public class RegistrarImpl implements Re
 	}
 
 	/** Keep events going to the same listener ordered. */
-	public boolean runAfter(List tasks, int size) {
-	    for (int i = size; --i >= 0; ) {
-		Object obj = tasks.get(i);
-		if (obj instanceof EventTask &&
-		    reg.listener.equals(((EventTask)obj).reg.listener))
-		    return true;
+	public TaskManager.Task runAfter(Iterable<TaskManager.Task> tasks) {
+	    for (TaskManager.Task task : tasks) {
+		if (task instanceof EventTask &&
+		    reg.listener.equals(((EventTask)task).reg.listener))
+		    return task;
 	    }
-	    return false;
+	    return null;
 	}
     }
 
     /** Address for unicast discovery response. */
-    private final class AddressTask implements TaskManager.Task {
+    private final class AddressTask extends TaskManager.Task {
 
 	/** The address */
 	public final InetAddress addr;
@@ -1845,15 +1844,10 @@ public class RegistrarImpl implements Re
 	    } catch (SecurityException e) {
 	    }
 	}
-
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }
 
     /** Socket for unicast discovery response. */
-    private final class SocketTask implements TaskManager.Task {
+    private final class SocketTask extends TaskManager.Task {
 
 	/** The socket */
 	public final Socket socket;
@@ -1868,10 +1862,6 @@ public class RegistrarImpl implements Re
 	    respond(socket);
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }
 
     /** Service lease expiration thread code */

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/fiddler/FiddlerImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/fiddler/FiddlerImpl.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/fiddler/FiddlerImpl.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/fiddler/FiddlerImpl.java Sun Sep 19 21:35:05 2010
@@ -811,7 +811,7 @@ class FiddlerImpl implements ServerProxy
      *  discovered, and will send the appropriate remote discovery event to
      *  the registration's listener.
      */
-    private final class NewRegistrationTask implements TaskManager.Task {
+    private final class NewRegistrationTask extends TaskManager.Task {
         /** The data structure record corresponding to the new registration */
         public final RegistrationInfo regInfo;
         /** Constructs an instance of this class and stores the registration
@@ -837,20 +837,6 @@ class FiddlerImpl implements ServerProxy
             }
         }//end run
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class NewRegistrationTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -864,7 +850,7 @@ class FiddlerImpl implements ServerProxy
      *  appropriate <code>RemoteDiscoveryEvent</code> should be sent; and
      *  then sends that event.
      */
-    private final class DiscoveredEventTask implements TaskManager.Task {
+    private final class DiscoveredEventTask extends TaskManager.Task {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -922,20 +908,6 @@ class FiddlerImpl implements ServerProxy
             }
         }//end run
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class DiscoveredEventTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -950,7 +922,7 @@ class FiddlerImpl implements ServerProxy
      *  registrations the appropriate <code>RemoteDiscoveryEvent</code>
      *  should be sent; and then sends that event.
      */
-    private final class DiscardedEventTask implements TaskManager.Task {
+    private final class DiscardedEventTask extends TaskManager.Task {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -1095,21 +1067,6 @@ class FiddlerImpl implements ServerProxy
             return discardedRegs;
         }//end maybeSendDiscardedEvent
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
-
     }//end class DiscardedEventTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1122,7 +1079,7 @@ class FiddlerImpl implements ServerProxy
      *  if successfully removed, will build and send a remote discarded event
      *  to the registration's listener.
      */
-    private final class DiscardRegistrarTask implements TaskManager.Task {
+    private final class DiscardRegistrarTask extends TaskManager.Task {
         /** Data structure record corresponding to the registration that has
          *  requested to have one of its discovered registrars discarded
          */
@@ -1167,20 +1124,6 @@ class FiddlerImpl implements ServerProxy
             }
         }//end run
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class DiscardRegistrarTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1199,7 +1142,7 @@ class FiddlerImpl implements ServerProxy
      *  will be sent to each active registration that has lost interest
      *  in any of the registrars of the event.
      */
-    private final class ChangedEventTask implements TaskManager.Task {
+    private final class ChangedEventTask extends TaskManager.Task {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -1349,21 +1292,6 @@ class FiddlerImpl implements ServerProxy
             return discardedRegs;
         }//end maybeSendDiscardedEvent
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
-
     }//end class ChangedEventTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1372,7 +1300,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the augmentation of the set of groups
      *  that currently will be discovered for it.
      */
-    private final class AddGroupsTask implements TaskManager.Task {
+    private final class AddGroupsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The group set with which to replace the registration's old set */
@@ -1458,20 +1386,6 @@ class FiddlerImpl implements ServerProxy
             return newGroupSet;
         }//end addRegInfoGroups
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class AddGroupsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1480,7 +1394,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the replacement of the set of groups
      *  that currently will be discovered for it.
      */
-    private final class SetGroupsTask implements TaskManager.Task {
+    private final class SetGroupsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The group set with which to replace the registration's old set */
@@ -1593,20 +1507,6 @@ class FiddlerImpl implements ServerProxy
             }//end if (groups == DiscoveryGroupManagement.ALL_GROUPS)
         }//end setRegInfoGroups
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class SetGroupsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1615,7 +1515,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the removal of a set of groups from
      *  the current set of groups to discover for it.
      */
-    private final class RemoveGroupsTask implements TaskManager.Task {
+    private final class RemoveGroupsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The groups to remove from the registration's old set */
@@ -1670,20 +1570,6 @@ class FiddlerImpl implements ServerProxy
             (regInfo.groups).removeAll(removeSet);
         }//end setRegInfoGroups
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class RemoveGroupsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1692,7 +1578,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the augmentation of the set of locators
      *  that currently will be discovered for it.
      */
-    private final class AddLocatorsTask implements TaskManager.Task {
+    private final class AddLocatorsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The locator set with which to replace the registration's old set */
@@ -1779,20 +1665,6 @@ class FiddlerImpl implements ServerProxy
             return newLocSet;
         }//end addRegInfoLocators
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class AddLocatorsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1801,7 +1673,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the replacement of the set of locators
      *  that currently will be discovered for it.
      */
-    private final class SetLocatorsTask implements TaskManager.Task {
+    private final class SetLocatorsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The locator set with which to replace the registration's old set */
@@ -1916,20 +1788,6 @@ class FiddlerImpl implements ServerProxy
             (regInfo.locators).addAll(newLocSet);
         }//end setRegInfoLocators
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class SetLocatorsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -1938,7 +1796,7 @@ class FiddlerImpl implements ServerProxy
      *  a registration has requested the removal of a set of locators
      *  from the current set of locators to discover for it.
      */
-    private final class RemoveLocatorsTask implements TaskManager.Task {
+    private final class RemoveLocatorsTask extends TaskManager.Task {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The locators to remove from the registration's old set */
@@ -2004,20 +1862,6 @@ class FiddlerImpl implements ServerProxy
             (regInfo.locators).removeAll(removeSet);
         }//end removeRegInfoLocators
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class RemoveLocatorsTask
 
     /** This class represents a <code>Task</code> object that is placed
@@ -2029,7 +1873,7 @@ class FiddlerImpl implements ServerProxy
      *  making the remote call to the registration's listener within a
      *  synchronization block.
      */
-    private final class SendEventTask implements TaskManager.Task {
+    private final class SendEventTask extends TaskManager.Task {
         /** Data structure record corresponding to registration to get event */
         public final RegistrationInfo     regInfo;
         /** The remote event to send to the given registration's listener */
@@ -2083,20 +1927,6 @@ class FiddlerImpl implements ServerProxy
             }//end try
         }//end run
 
-        /** This method returns true if the current instance of this class
-         *  must be run after at least one task in the input task list with
-         *  an index less than the <code>size</code> parameter (size may be
-         *  less than tasks.size()).
-         *  <p>
-         *  Note that using List.get will be more efficient than List.iterator.
-         *
-         *  @param tasks the tasks to consider.  A read-only List, with all
-         *         elements being an instanceof Task.
-         *  @param size elements with index less than size should be considered
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class SendEventTask
 
     /**

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/ParticipantTask.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/ParticipantTask.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/ParticipantTask.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/ParticipantTask.java Sun Sep 19 21:35:05 2010
@@ -62,15 +62,6 @@ public class ParticipantTask extends Ret
 	this.handle = handle;
     }
 
-    /**
-     * Inherit doc comment from supertype.
-     *
-     * @see com.sun.jini.thread.RetryTask
-     */
-
-    public boolean runAfter(List list, int max) {
-        return false;
-    }
 
     public boolean tryOnce() {
         if (operationsLogger.isLoggable(Level.FINER)) {

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/SettlerTask.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/SettlerTask.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/SettlerTask.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mahalo/SettlerTask.java Sun Sep 19 21:35:05 2010
@@ -75,14 +75,6 @@ public class SettlerTask extends RetryTa
 	this.tid = tid;
     }
 
-    /**
-     * Inherit doc comment from supertype.
-     *
-     * @see com.sun.jini.thread.RetryTask
-     */
-    public boolean runAfter(List list, int max) {
-        return false;
-    }
 
     public boolean tryOnce() {
         if (operationsLogger.isLoggable(Level.FINER)) {

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mercury/MailboxImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mercury/MailboxImpl.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mercury/MailboxImpl.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/mercury/MailboxImpl.java Sun Sep 19 21:35:05 2010
@@ -3227,16 +3227,6 @@ class MailboxImpl implements MailboxBack
     	    return succeeded;
     	}
     
-        /**
-         * Return <code>true</code> if this task needs to runAfter any
-         * of the tasks in the provided list and <code>false</code>
-         * otherwise.  The notifier thread ensures that there should only
-         * be one task per registration, so this method just returns
-         * false.
-         */
-    	public boolean runAfter(java.util.List list, int max) {
-    	    return false;
-       	}
     }
 
 

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/norm/event/EventType.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/norm/event/EventType.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/norm/event/EventType.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/norm/event/EventType.java Sun Sep 19 21:35:05 2010
@@ -488,10 +488,5 @@ public class EventType implements Serial
 	    
 	}
 
-	// Inherit java doc from super type
-	public boolean runAfter(List tasks, int size) {
-	    // We don't need to run these tasks in any particular order
-	    return false;
-	}
     }
 }

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/Notifier.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/Notifier.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/Notifier.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/Notifier.java Sun Sep 19 21:35:05 2010
@@ -19,6 +19,7 @@ package com.sun.jini.outrigger;
 
 import java.io.IOException;
 import java.rmi.RemoteException;
+import java.util.Collection;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import net.jini.core.event.UnknownEventException;
@@ -243,16 +244,15 @@ class Notifier implements com.sun.jini.c
 	    return successful;
 	}
 
-	public boolean runAfter(java.util.List list, int max) {
-	    for (int i = 0; i < max; i++) {
-		Object task = list.get(i);
+	public TaskManager.Task runAfter(java.lang.Iterable<TaskManager.Task> tasks) {
+	    for (TaskManager.Task task : tasks) {
 		if (task instanceof NotifyTask) {
 		    NotifyTask nt = (NotifyTask)task;
 		    if (sender.runAfter(nt.sender))
-			return true;
+			return task;
 		}
 	    }
-	    return false;
+	    return null;
 	}
 
 	/** Log a failed delivery attempt */

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/TxnMonitorTask.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/TxnMonitorTask.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/TxnMonitorTask.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/outrigger/TxnMonitorTask.java Sun Sep 19 21:35:05 2010
@@ -201,13 +201,6 @@ class TxnMonitorTask extends RetryTask
 	return nextQuery;
     }
 
-    /**
-     * We can run in parallel with any task, so just return
-     * <CODE>false</CODE>.  
-     */
-    public boolean runAfter(java.util.List tasks, int size) {
-	return false;
-    }
 
     /**
      * Add a ``sibling'' transaction, one that is now blocking progress

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/reggie/RegistrarImpl.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/reggie/RegistrarImpl.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/reggie/RegistrarImpl.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/reggie/RegistrarImpl.java Sun Sep 19 21:35:05 2010
@@ -68,6 +68,7 @@ import java.rmi.activation.ActivationID;
 import java.rmi.activation.ActivationSystem;
 import java.util.ArrayList;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
 import java.util.Enumeration;
 import java.util.HashMap;
@@ -1788,7 +1789,7 @@ class RegistrarImpl implements Registrar
     }
 
     /** An event to be sent, and the listener to send it to. */
-    private final class EventTask implements TaskManager.Task {
+    private final class EventTask extends TaskManager.Task {
 
 	/** The event registration */
 	public final EventReg reg;
@@ -1858,19 +1859,18 @@ class RegistrarImpl implements Registrar
 	}
 
 	/** Keep events going to the same listener ordered. */
-	public boolean runAfter(List tasks, int size) {
-	    for (int i = size; --i >= 0; ) {
-		Object obj = tasks.get(i);
-		if (obj instanceof EventTask &&
-		    reg.listener.equals(((EventTask)obj).reg.listener))
-		    return true;
+	public TaskManager.Task runAfter(java.lang.Iterable<TaskManager.Task> tasks) {
+	    for (TaskManager.Task task : tasks) {
+		if (task instanceof EventTask &&
+		    reg.listener.equals(((EventTask)task).reg.listener))
+		    return task;
 	    }
-	    return false;
+	    return null;
 	}
     }
 
     /** Task for decoding multicast request packets. */
-    private final class DecodeRequestTask implements TaskManager.Task {
+    private final class DecodeRequestTask extends TaskManager.Task {
 
 	/** The multicast packet to decode */
 	private final DatagramPacket datagram;
@@ -1939,14 +1939,10 @@ class RegistrarImpl implements Registrar
 	    }
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }
 
     /** Address for unicast discovery response. */
-    private final class AddressTask implements TaskManager.Task {
+    private final class AddressTask extends TaskManager.Task {
 
 	/** The address */
 	public final String host;
@@ -2040,11 +2036,6 @@ class RegistrarImpl implements Registrar
 	    }
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
-
         /** attempt a connection to multicast request client */
         private void attemptResponse(InetSocketAddress addr, int timeout) 
             throws Exception 
@@ -2064,7 +2055,7 @@ class RegistrarImpl implements Registrar
     }
 
     /** Socket for unicast discovery response. */
-    private final class SocketTask implements TaskManager.Task {
+    private final class SocketTask extends TaskManager.Task {
 
 	/** The socket */
 	public final Socket socket;
@@ -2094,10 +2085,6 @@ class RegistrarImpl implements Registrar
 	    }
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
     }
 
     /** Service lease expiration thread code */

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/RetryTask.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/RetryTask.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/RetryTask.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/RetryTask.java Sun Sep 19 21:35:05 2010
@@ -63,7 +63,7 @@ import com.sun.jini.constants.TimeConsta
  */
 import com.sun.jini.thread.WakeupManager.Ticket;
 
-public abstract class RetryTask implements TaskManager.Task, TimeConstants {
+public abstract class RetryTask extends TaskManager.Task implements TimeConstants {
     private TaskManager	  manager;	// the TaskManager for this task
     private RetryTime	  retry;	// the retry object for this task
     private boolean	  cancelled;	// have we been cancelled?

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/TaskManager.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/TaskManager.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/TaskManager.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/com/sun/jini/thread/TaskManager.java Sun Sep 19 21:35:05 2010
@@ -25,6 +25,7 @@ import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
+
 /**
  * A task manager manages a single queue of tasks, and some number of
  * worker threads.  New tasks are added to the tail of the queue.  Each
@@ -56,20 +57,32 @@ import java.util.logging.Logger;
  */
 public class TaskManager {
 
-    /** The interface that tasks must implement */
-    public interface Task extends Runnable {
-	/**
-	 * Return true if this task must be run after at least one task
-	 * in the given task list with an index less than size (size may be
-	 * less then tasks.size()).  Using List.get will be more efficient
-	 * than List.iterator.
-	 *
-	 * @param tasks the tasks to consider.  A read-only List, with all
-	 * elements instanceof Task.
-	 * @param size elements with index less than size should be considered
-	 */
-	boolean runAfter(List tasks, int size);
-    }
+	/** The class that tasks must extend */
+	public static abstract class Task implements Runnable {
+		/**
+		 * If this Task must run after completion of any Task in
+		 * candidates, return the first such Task in iteration order. If
+		 * not, return null. Completion due to a throw is logged, but
+		 * otherwise equivalent to returning the first element in
+		 * candidates. If candidates is empty, it is equivalent to
+		 * returning null.
+		 * 
+		 * @param tasks
+		 *                the tasks to consider. A read-only Collection.
+		 */
+		public Task runAfter(Iterable<Task> candidates) {
+			return null;
+		}
+		
+		/**
+		 * Temporary way to force an error for classes that have
+		 * not been updated to use the new runAfter method. Bars
+		 * all subclasses from having an old-style runAfter method.
+		 */
+		public final boolean runAfter(List list, int i){
+			return true;
+		}
+	}
 
     /** Logger */
     protected static final Logger logger =
@@ -82,7 +95,7 @@ public class TaskManager {
     /** Read-only view of tasks */
     protected final List roTasks = Collections.unmodifiableList(tasks);
     /** Active threads */
-    protected final List threads = new ArrayList();
+    protected final List<TaskThread> threads = new ArrayList<TaskThread>();
     /** Maximum number of threads allowed */
     protected final int maxThreads;
     /** Idle time before a thread should exit */
@@ -130,10 +143,10 @@ public class TaskManager {
 	tasks.add(t);
 	boolean poke = true;
 	while (threads.size() < maxThreads && needThread()) {
-	    Thread th;
+            TaskThread task;
 	    try {
-		th = new TaskThread();
-		th.start();
+                task = new TaskThread();
+                task.start();
 	    } catch (Throwable tt) {
 		try {
 		    logger.log(threads.isEmpty() ?
@@ -143,7 +156,7 @@ public class TaskManager {
 		}
 		break;
 	    }
-	    threads.add(th);
+	    threads.add(task);
 	    poke = false;
 	}
 	if (poke &&
@@ -184,11 +197,11 @@ public class TaskManager {
     }
 
     /**
-     * Returns t.runAfter(i), or false if an exception is thrown.
+     * Returns t.runAfter for elements 0 through i-1 of the list, or false if an exception is thrown.
      */
     private boolean runAfter(Task t, int i) {
 	try {
-	    return t.runAfter(roTasks, i);
+	    return t.runAfter(roTasks.subList(0, i)) != null;
 	} catch (Throwable tt) {
 	    try {
 		logger.log(Level.WARNING, "Task.runAfter exception", tt);
@@ -228,10 +241,11 @@ public class TaskManager {
 		if (i < firstPending) {
 		    firstPending--;
 		    for (int j = threads.size(); --j >= 0; ) {
-			TaskThread thread = (TaskThread)threads.get(j);
-			if (thread.task == t) {
-			    if (thread != Thread.currentThread())
-				thread.interrupt();
+			TaskThread thread = threads.get(j);
+			if (thread.getTask() == t) {
+			    if (thread.getThread() != Thread.currentThread()) {
+                                thread.getThread().interrupt();
+                            }
 			    break;
 			}
 		    }
@@ -249,7 +263,7 @@ public class TaskManager {
     public synchronized void terminate() {
 	terminated = true;
 	for (int i = threads.size(); --i >= 0; ) {
-	    ((Thread)threads.get(i)).interrupt();
+	    (threads.get(i)).getThread().interrupt();
 	}
     }
 
@@ -267,15 +281,21 @@ public class TaskManager {
 	return maxThreads;
     }
 
-    private class TaskThread extends Thread {
+    private class TaskThread implements Runnable {
 
 	/** The task being run, if any */
-	public Task task = null;
+	private Task task;
+        private Thread thread;
 
 	public TaskThread() {
-	    super("task");
-	    setDaemon(true);
-	}
+            task = null;
+            thread = new Thread(this, "task");
+            thread.setDaemon(true);
+	}
+        
+        public void start(){
+            thread.start();
+        }
 
 	/**
 	 * Find the next task that can be run, and mark it taken by
@@ -293,7 +313,7 @@ public class TaskManager {
 			tasks.add(firstPending, t);
 		    }
 		    firstPending++;
-		    task = t;
+		    setTask(t);
 		    return true;
 		}
 	    }
@@ -305,16 +325,16 @@ public class TaskManager {
 		synchronized (TaskManager.this) {
 		    if (terminated)
 			return;
-		    if (task != null) {
+		    if (getTask() != null) {
 			for (int i = firstPending; --i >= 0; ) {
-			    if (tasks.get(i) == task) {
+			    if (tasks.get(i) == getTask()) {
 				tasks.remove(i);
 				firstPending--;
 				break;
 			    }
 			}
-			task = null;
-			interrupted(); // clear interrupt bit
+			setTask(null);
+			getThread().interrupted(); // clear interrupt bit
 		    }
 		    if (!takeTask()) {
 			try {
@@ -328,7 +348,7 @@ public class TaskManager {
 		    }
 		}
 		try {
-		    task.run();
+		    getTask().run();
 		} catch (Throwable t) {
 		    try {
 			logger.log(Level.WARNING, "Task.run exception", t);
@@ -337,5 +357,17 @@ public class TaskManager {
 		}
 	    }
 	}
+
+        public Task getTask() {
+            return task;
+        }
+
+        public void setTask(Task task) {
+            this.task = task;
+        }
+
+        public Thread getThread() {
+            return thread;
+        }
     }
 }

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupDiscovery.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupDiscovery.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupDiscovery.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupDiscovery.java Sun Sep 19 21:35:05 2010
@@ -1498,7 +1498,7 @@ public class LookupDiscovery implements 
      * signature verification, and would impede the packet receiving loop if it
      * were performed inline.
      */
-    private class DecodeAnnouncementTask implements TaskManager.Task {
+    private class DecodeAnnouncementTask extends TaskManager.Task {
 
 	private final DatagramPacket datagram;
 
@@ -1642,10 +1642,7 @@ public class LookupDiscovery implements 
 		return false;
 	    }
 	}
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
+
     }
 
     /** Task which retrieves elements from the set of pendingDiscoveries and
@@ -1705,7 +1702,7 @@ public class LookupDiscovery implements 
      *  unicast discoveries) will be missed whenever a lookup service
      *  disappears prior to the commencement of the unicast discovery stage.
      */
-    private class UnicastDiscoveryTask implements TaskManager.Task {
+    private class UnicastDiscoveryTask extends TaskManager.Task {
 	private Object req;
 	private Ticket ticket = null;
 	private boolean delayRun = false;
@@ -1858,14 +1855,6 @@ public class LookupDiscovery implements 
             logger.finest("LookupDiscovery - UnicastDiscoveryTask completed");
 	}//end run
 
-        /** Returns true if current instance must be run after task(s) in
-         *  task manager queue.
-         *  @param tasks the tasks to consider.
-         *  @param size  elements with index less than size are considered.
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class UnicastDiscoveryTask
 
     /**

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupLocatorDiscovery.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupLocatorDiscovery.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupLocatorDiscovery.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/discovery/LookupLocatorDiscovery.java Sun Sep 19 21:35:05 2010
@@ -744,14 +744,6 @@ public class LookupLocatorDiscovery impl
             return reg.getNextTryTime();
         }//end retryTime
 
-        /** Returns true if current instance must be run after task(s) in
-         *  task manager queue.
-         *  @param tasks the tasks to consider.
-         *  @param size  elements with index less than size are considered.
-         */
-        public boolean runAfter(java.util.List tasks, int size) {
-            return false;
-        }//end runAfter
     }//end class DiscoveryTask
 
     /**

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lease/LeaseRenewalManager.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lease/LeaseRenewalManager.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lease/LeaseRenewalManager.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lease/LeaseRenewalManager.java Sun Sep 19 21:35:05 2010
@@ -380,7 +380,7 @@ public class LeaseRenewalManager {
      */
     private List calcList;
 
-    private final class RenewTask implements TaskManager.Task {
+    private final class RenewTask extends TaskManager.Task {
 	/** Entries of leases to renew (if multiple, all can be batched) */
 	private final List bList;
 
@@ -454,11 +454,6 @@ public class LeaseRenewalManager {
 	    }
 	}
 
-	/** No ordering. */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
-
 	/**
 	 * Find any expired leases, remove them from bList and
 	 * leaseInRenew, and return any with listeners.
@@ -1522,7 +1517,7 @@ public class LeaseRenewalManager {
 	return ((Entry) leases.lastKey()).actualRenew;
     }
 
-    private class QueuerTask implements TaskManager.Task {
+    private class QueuerTask extends TaskManager.Task {
 
 	/** When to next wake up and queue a new renew task */
 	long wakeup;
@@ -1531,10 +1526,6 @@ public class LeaseRenewalManager {
 	    this.wakeup = wakeup;
 	}
 
-	/** No ordering */
-	public boolean runAfter(List tasks, int size) {
-	    return false;
-	}
 
         public void run() {
 	    synchronized (LeaseRenewalManager.this) {

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/JoinManager.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/JoinManager.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/JoinManager.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/JoinManager.java Sun Sep 19 21:35:05 2010
@@ -49,6 +49,7 @@ import net.jini.core.lookup.ServiceRegis
 import java.io.IOException;
 
 import java.util.ArrayList;
+import java.util.Collection;
 import java.util.Iterator;
 import java.util.List;
 import java.util.logging.Level;
@@ -668,22 +669,20 @@ public class JoinManager {
          *  queued tasks will run in parallel.
          *  
          *  @param tasks the tasks with which to compare the current task
-         *  @param size  elements with index less than size are considered
          */
-        public boolean runAfter(List tasks, int size) {
+        public TaskManager.Task runAfter(java.lang.Iterable<TaskManager.Task> tasks) {
             /* If the service's ID has already been set, then it's okay
              * to run all ProxyRegTask's in parallel, otherwise, the
              * ProxyRegTask with the lowest sequence number should be run.
              */
             synchronized(serviceItem) {//accessing serviceItem.serviceID
-                if(serviceItem.serviceID != null)  return false;
+                if(serviceItem.serviceID != null)  return null;
                 /* For task with lowest seq #, run it now; else run it later */
-                for(int i=0; i<size; i++) {
-                    TaskManager.Task t = (TaskManager.Task)tasks.get(i);
+                for(TaskManager.Task t : tasks) {
                     int nextTaskSeqN = ((ProxyRegTask)t).getSeqN();
-                    if( seqN > nextTaskSeqN )  return true;
+                    if( seqN > nextTaskSeqN )  return t;
                 }//end loop
-                return false;
+                return null;
 	    }//end sync(serviceItem)
         }//end runAfter
 

Modified: incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/ServiceDiscoveryManager.java
URL: http://svn.apache.org/viewvc/incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/ServiceDiscoveryManager.java?rev=998737&r1=998736&r2=998737&view=diff
==============================================================================
--- incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/ServiceDiscoveryManager.java (original)
+++ incubator/river/jtsk/skunk/patsTaskManager/src/net/jini/lookup/ServiceDiscoveryManager.java Sun Sep 19 21:35:05 2010
@@ -605,7 +605,7 @@ import java.util.Set;
 public class ServiceDiscoveryManager {
 
     /** Class for implementing register/lookup/notify/dropProxy/discard tasks*/
-    private static abstract class CacheTask implements TaskManager.Task {
+    private static abstract class CacheTask extends TaskManager.Task {
         protected ProxyReg reg;
         protected long thisTaskSeqN;
         public CacheTask(ProxyReg reg, long seqN) {
@@ -617,14 +617,6 @@ public class ServiceDiscoveryManager {
             if(this.reg == null) return false;
             return (this.reg).equals(reg);
         }//end isFromProxy
-        /** Returns true if current instance must be run after task(s) in
-         *  task manager queue.
-         *  @param tasks the tasks to consider.
-         *  @param size elements with index less than size are considered.
-         */
-        public boolean runAfter(List tasks, int size) {
-            return false;
-        }//end runAfter
 
         /** Returns the ProxyReg associated with this task (if any). */
         public ProxyReg getProxyReg() {
@@ -664,19 +656,18 @@ public class ServiceDiscoveryManager {
          *  @param tasks the tasks to consider.
          *  @param size elements with index less than size are considered.
          */
-        public boolean runAfter(List tasks, int size) {
-            for(int i=0; i<size; i++) {
-                TaskManager.Task t = (TaskManager.Task)tasks.get(i);
+        public TaskManager.Task runAfter(Iterable<TaskManager.Task> tasks) {
+            for(TaskManager.Task t : tasks) {
                 //Compare only instances of this task class
                 if( !(t instanceof ServiceIdTask) )  continue;
                 ServiceID otherTaskSid = ((ServiceIdTask)t).getServiceID();
                 if( thisTaskSid.equals(otherTaskSid) ) {
                     if(thisTaskSeqN > ((ServiceIdTask)t).getSeqN()) {
-                        return true;//run this task after the other task
+                        return t;//run this task after the other task
                     }//endif
                 }//endif
             }//end loop
-            return false;//run this task now
+            return null;//run this task now
         }//end runAfter
 
         /** Returns the ServiceID associated with this task. */
@@ -1029,20 +1020,20 @@ public class ServiceDiscoveryManager {
              *  @param tasks the tasks to consider.
              *  @param size elements with index less than size are considered.
              */
-            public boolean runAfter(List tasks, int size) {
-                for(int i=0; i<size; i++) {
-                    CacheTask t = (CacheTask)tasks.get(i);
+            public TaskManager.Task runAfter(Iterable<TaskManager.Task> tasks) {
+                for(TaskManager.Task task : tasks) {
+                    CacheTask t = (CacheTask)task;
                     if(   t instanceof RegisterListenerTask
                        || t instanceof LookupTask
                        || t instanceof NotifyEventTask )
                     {
                         ProxyReg otherReg = t.getProxyReg();
                         if( reg.equals(otherReg) ) {
-                            if(thisTaskSeqN > t.getSeqN()) return true;
+                            if(thisTaskSeqN > t.getSeqN()) return t;
                         }//endif
                     }//endif
                 }//end loop
-                return super.runAfter(tasks, size);
+                return super.runAfter(tasks);
             }//end runAfter
 
 	}//end class LookupCacheImpl.LookupTask
@@ -1181,19 +1172,19 @@ public class ServiceDiscoveryManager {
              *  @param tasks the tasks to consider.
              *  @param size elements with index less than size are considered.
              */
-            public boolean runAfter(List tasks, int size) {
-                for(int i=0; i<size; i++) {
-                    CacheTask t = (CacheTask)tasks.get(i);
+            public TaskManager.Task runAfter(Iterable<TaskManager.Task> tasks) {
+                for(TaskManager.Task task : tasks) {
+                    CacheTask t = (CacheTask)task;
                     if(   t instanceof RegisterListenerTask
                        || t instanceof LookupTask )
                     {
                         ProxyReg otherReg = t.getProxyReg();
                         if( reg.equals(otherReg) ) {
-                            if(thisTaskSeqN > t.getSeqN()) return true;
+                            if(thisTaskSeqN > t.getSeqN()) return t;
                         }//endif
                     }//endif
                 }//end loop
-                return super.runAfter(tasks, size);
+                return super.runAfter(tasks);
             }//end runAfter
 
 	}//end class LookupCacheImpl.NotifyEventTask
@@ -1204,7 +1195,7 @@ public class ServiceDiscoveryManager {
          *  a filter retry on an item in which the cache's filter initially
          *  returned indefinite.
          */
-        private final class ServiceDiscardTimerTask implements TaskManager.Task
+        private final class ServiceDiscardTimerTask extends TaskManager.Task
         {
             private final ServiceID serviceID;
 	    private final long endTime;
@@ -1321,14 +1312,7 @@ public class ServiceDiscoveryManager {
                 logger.finest("ServiceDiscoveryManager - "
                               +"ServiceDiscardTimerTask completed");
             }//end run
-            /** Returns true if current instance must be run after task(s) in
-             *  task manager queue.
-             *  @param tasks the tasks to consider.
-             *  @param size elements with index less than size are considered.
-             */
-            public boolean runAfter(List tasks, int size) {
-                return false;
-            }//end runAfter
+
         }//end class LookupCacheImpl.ServiceDiscardTimerTask
 
 	/** Task class used to asynchronously process the service state