river-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From peter_firmst...@apache.org
Subject svn commit: r1554723 [2/5] - in /river/jtsk/skunk/qa_refactor/trunk: qa/src/com/sun/jini/qa/harness/ qa/src/com/sun/jini/test/impl/mahalo/ qa/src/com/sun/jini/test/impl/reggie/ qa/src/com/sun/jini/test/resources/ qa/src/com/sun/jini/test/share/ qa/src/...
Date Thu, 02 Jan 2014 02:45:09 GMT
Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerImpl.java Thu Jan  2 02:45:07 2014
@@ -40,7 +40,6 @@ import com.sun.jini.thread.InterruptedSt
 import com.sun.jini.thread.ReadersWriter;
 import com.sun.jini.thread.ReadersWriter.ConcurrentLockException;
 import com.sun.jini.thread.ReadyState;
-import com.sun.jini.thread.TaskManager;
 
 import net.jini.activation.ActivationExporter;
 import net.jini.activation.ActivationGroup;
@@ -129,6 +128,7 @@ import java.util.List;
 import java.util.Map;
 import java.util.Set;
 import java.util.TreeMap;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.locks.Condition;
 import java.util.logging.Level;
@@ -274,8 +274,8 @@ class FiddlerImpl implements ServerProxy
     private final DiscoveryManagement joinMgrLDM;
     /** Manager for discovering and registering with lookup services */
     private JoinManager joinMgr;
-    /** Task manager for sending remote discovery events */
-    private final TaskManager taskMgr;
+    /** Executor for sending remote discovery events */
+    private final ExecutorService executorService;
     /** Registration lease expiration thread */
     private final LeaseExpireThread leaseExpireThread;
     /** Snapshot-taking thread */
@@ -497,7 +497,7 @@ class FiddlerImpl implements ServerProxy
         log = i.log;
         joinMgrLDM = i.joinMgrLDM;
         leaseMax = i.leaseMax;
-        taskMgr = i.taskMgr;
+        executorService = i.executorService;
         activationSystem = i.activationSystem;
         serverExporter = i.serverExporter;
         logHandler = i.logHandler;
@@ -557,13 +557,13 @@ class FiddlerImpl implements ServerProxy
             super();
         }
         public void discovered(DiscoveryEvent event) {
-            taskMgr.add(new DiscoveredEventTask(event));
+            executorService.execute(new DiscoveredEventTask(event));
         }
         public void discarded(DiscoveryEvent event) {
-            taskMgr.add(new DiscardedEventTask(event));
+            executorService.execute(new DiscardedEventTask(event));
         }
         public void changed(DiscoveryEvent event) {
-            taskMgr.add(new ChangedEventTask(event));
+            executorService.execute(new ChangedEventTask(event));
         }
     }//end class LookupDiscoveryListener
 
@@ -876,7 +876,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 implements Runnable {
         /** The data structure record corresponding to the new registration */
         public final RegistrationInfo regInfo;
         /** Constructs an instance of this class and stores the registration
@@ -902,20 +902,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
@@ -929,7 +915,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 implements Runnable {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -987,20 +973,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
@@ -1015,7 +987,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 implements Runnable {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -1160,21 +1132,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
@@ -1187,7 +1144,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 implements Runnable {
         /** Data structure record corresponding to the registration that has
          *  requested to have one of its discovered registrars discarded
          */
@@ -1231,21 +1188,6 @@ class FiddlerImpl implements ServerProxy
                 concurrentObj.writeUnlock();
             }
         }//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
@@ -1264,7 +1206,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 implements Runnable {
         /** The local event sent by the discovery manager. */
         public final DiscoveryEvent event;
         /** Constructs an instance of this class and stores the event*/
@@ -1413,22 +1355,6 @@ class FiddlerImpl implements ServerProxy
             }//endif
             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
@@ -1437,7 +1363,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 implements Runnable {
         /** 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 */
@@ -1523,20 +1449,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
@@ -1545,7 +1457,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 implements Runnable {
         /** 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 */
@@ -1657,21 +1569,6 @@ class FiddlerImpl implements ServerProxy
                 (regInfo.groups).addAll(newGroups);
             }//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
@@ -1680,7 +1577,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 implements Runnable {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The groups to remove from the registration's old set */
@@ -1736,20 +1633,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
@@ -1758,7 +1641,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 implements Runnable {
         /** 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 */
@@ -1844,21 +1727,6 @@ class FiddlerImpl implements ServerProxy
             }//endif
             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
@@ -1867,7 +1735,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 implements Runnable {
         /** 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 */
@@ -1982,20 +1850,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
@@ -2004,7 +1858,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 implements Runnable {
         /** Data structure record of the registration that made the request */
         public final RegistrationInfo regInfo;
         /** The locators to remove from the registration's old set */
@@ -2069,21 +1923,6 @@ class FiddlerImpl implements ServerProxy
             }//end loop
             (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
@@ -2095,7 +1934,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 implements Runnable {
         /** Data structure record corresponding to registration to get event */
         public final RegistrationInfo     regInfo;
         /** The remote event to send to the given registration's listener */
@@ -2148,21 +1987,6 @@ class FiddlerImpl implements ServerProxy
                 }//end switch
             }//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
 
     /**
@@ -2537,7 +2361,7 @@ class FiddlerImpl implements ServerProxy
 	    /* all daemons must terminate before deleting persistent store */
 	    leaseExpireThread.interrupt();
 	    if(log != null) snapshotThread.interrupt();
-	    taskMgr.terminate();
+	    executorService.shutdown();
 	    joinMgr.terminate();
             joinMgrLDM.terminate();
             discoveryMgr.terminate();
@@ -4394,7 +4218,7 @@ class FiddlerImpl implements ServerProxy
                  * send a remote discarded event, but don't ask the discovery
                  * manager to discard the registrar.
                  */
-                taskMgr.add(new DiscardRegistrarTask(regInfo,registrar));
+                executorService.execute(new DiscardRegistrarTask(regInfo,registrar));
             }//endif
         } finally {
             concurrentObj.writeUnlock();
@@ -5371,9 +5195,9 @@ class FiddlerImpl implements ServerProxy
             } catch(Throwable t) { }
         }//endif
 
-        if(taskMgr != null)  {
+        if(executorService != null)  {
             try {
-                taskMgr.terminate();
+                executorService.shutdown();
             } catch(Throwable t) { }
         }//endif
 
@@ -5554,7 +5378,7 @@ class FiddlerImpl implements ServerProxy
         logInfoRegistration("\nadded registration:  registrationID = ",regID);
         addLogRecord(new RegistrationGrantedLogObj(regInfo));
         /* Queue task for sending a discovered event */
-        taskMgr.add(new NewRegistrationTask(regInfo));
+        executorService.execute(new NewRegistrationTask(regInfo));
 	/* See if the expire thread needs to wake up earlier */
 	if (expiration < minExpiration) {
 	    minExpiration = expiration;
@@ -5671,7 +5495,7 @@ class FiddlerImpl implements ServerProxy
      * @see net.jini.discovery.LookupDiscoveryRegistration#addGroups
      */
     private void addGroupsDo(RegistrationInfo regInfo, String[] groups) {
-        taskMgr.add(new AddGroupsTask(regInfo,groups));
+        executorService.execute(new AddGroupsTask(regInfo,groups));
     }//end addGroupsDo
 
     /**
@@ -5721,7 +5545,7 @@ class FiddlerImpl implements ServerProxy
      * @see net.jini.discovery.LookupDiscoveryRegistration#setGroups
      */
     private void setGroupsDo(RegistrationInfo regInfo, String[] groups) {
-        taskMgr.add(new SetGroupsTask(regInfo,groups));
+        executorService.execute(new SetGroupsTask(regInfo,groups));
     }//end setGroupsDo
 
     /**
@@ -5770,7 +5594,7 @@ class FiddlerImpl implements ServerProxy
      * @see net.jini.discovery.LookupDiscoveryRegistration#removeGroups
      */
     private void removeGroupsDo(RegistrationInfo regInfo, String[] groups) {
-        taskMgr.add(new RemoveGroupsTask(regInfo,groups));
+        executorService.execute(new RemoveGroupsTask(regInfo,groups));
     }//end removeGroupsDo
 
     /**
@@ -5936,7 +5760,7 @@ class FiddlerImpl implements ServerProxy
     private void addLocatorsDo(RegistrationInfo regInfo,
                                LookupLocator[]  locators)
     {
-        taskMgr.add(new AddLocatorsTask(regInfo,locators));
+        executorService.execute(new AddLocatorsTask(regInfo,locators));
     }//end addLocatorsDo
 
     /**
@@ -5989,7 +5813,7 @@ class FiddlerImpl implements ServerProxy
     private void setLocatorsDo(RegistrationInfo regInfo,
                                LookupLocator[]  locators)
     {
-        taskMgr.add(new SetLocatorsTask(regInfo,locators));
+        executorService.execute(new SetLocatorsTask(regInfo,locators));
     }//end setLocatorsDo
 
     /**
@@ -6041,7 +5865,7 @@ class FiddlerImpl implements ServerProxy
     private void removeLocatorsDo(RegistrationInfo regInfo,
                                   LookupLocator[]  locators)
     {
-        taskMgr.add(new RemoveLocatorsTask(regInfo,locators));
+        executorService.execute(new RemoveLocatorsTask(regInfo,locators));
     }//end removeLocatorsDo
 
     /**
@@ -6810,7 +6634,7 @@ class FiddlerImpl implements ServerProxy
     private void queueEvent(RegistrationInfo regInfo,
                            RemoteDiscoveryEvent event)
     {
-        taskMgr.add(new SendEventTask(regInfo,event));
+        executorService.execute(new SendEventTask(regInfo,event));
     }//end queueEvent
     /* END Private Event-Related Methods ----------------------------------- */
 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerInit.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerInit.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerInit.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/fiddler/FiddlerInit.java Thu Jan  2 02:45:07 2014
@@ -19,11 +19,8 @@
 package com.sun.jini.fiddler;
 
 import com.sun.jini.config.Config;
-import com.sun.jini.fiddler.FiddlerImpl.LeaseExpireThread;
 import com.sun.jini.fiddler.FiddlerImpl.LocalLogHandler;
-import com.sun.jini.fiddler.FiddlerImpl.SnapshotThread;
 import com.sun.jini.reliableLog.ReliableLog;
-import com.sun.jini.thread.TaskManager;
 import java.io.IOException;
 import java.rmi.activation.ActivationException;
 import java.rmi.activation.ActivationGroup;
@@ -32,6 +29,10 @@ import java.rmi.activation.ActivationSys
 import java.rmi.server.ExportException;
 import java.security.AccessControlContext;
 import java.security.AccessController;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import javax.security.auth.login.LoginContext;
 import net.jini.activation.ActivationExporter;
@@ -51,6 +52,7 @@ import net.jini.jeri.ServerEndpoint;
 import net.jini.jeri.tcp.TcpServerEndpoint;
 import net.jini.security.BasicProxyPreparer;
 import net.jini.security.ProxyPreparer;
+import org.apache.river.impl.thread.NamedThreadFactory;
 
 /**
  * Initialization common to all modes in which instances of this service
@@ -70,7 +72,7 @@ class FiddlerInit {
     ReliableLog log = null;
     DiscoveryManagement joinMgrLDM;
     long leaseMax;
-    TaskManager taskMgr;
+    ExecutorService executorService;
     ActivationSystem activationSystem;
     Exporter serverExporter;
     LocalLogHandler logHandler;
@@ -189,20 +191,17 @@ class FiddlerInit {
                                            FiddlerImpl.MAX_LEASE, 0, Long.MAX_VALUE);
 
             /* Get a general-purpose task manager for this service */
-            taskMgr = (TaskManager)Config.getNonNullEntry
-                                              (config,
-                                               FiddlerImpl.COMPONENT_NAME,
-                                               "taskManager",
-                                               TaskManager.class,
-                                               new TaskManager(10,1000*15,1.0f) );
+            executorService = Config.getNonNullEntry(config,
+                                             FiddlerImpl.COMPONENT_NAME,
+                                             "executorService",
+                                             ExecutorService.class,
+                                             new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, new LinkedBlockingQueue<Runnable>(), new NamedThreadFactory("Fiddler Executor", false)) );
             /* Get the discovery manager to pass to this service's join manager. */
             try {
-                joinMgrLDM  = 
-                    (DiscoveryManagement)Config.getNonNullEntry
-                                                      (config,
-                                                       FiddlerImpl.COMPONENT_NAME,
-                                                       "discoveryManager",
-                                                       DiscoveryManagement.class);
+                joinMgrLDM = Config.getNonNullEntry(config,
+                                                    FiddlerImpl.COMPONENT_NAME,
+                                                    "discoveryManager",
+                                                    DiscoveryManagement.class);
                 if( joinMgrLDM instanceof DiscoveryGroupManagement ) {
                     String[] groups0 =
                                ((DiscoveryGroupManagement)joinMgrLDM).getGroups();
@@ -292,9 +291,9 @@ class FiddlerInit {
      * terminates any threads that may have been started, etc.
      */
     private void cleanupInitFailure() {
-        if(taskMgr != null)  {
+        if(executorService != null)  {
             try {
-                taskMgr.terminate();
+                executorService.shutdown();
             } catch(Throwable t) { }
         }//endif
         

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/AbortJob.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/AbortJob.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/AbortJob.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/AbortJob.java Thu Jan  2 02:45:07 2014
@@ -113,8 +113,8 @@ class AbortJob extends Job implements Tr
      * Creates the <code>TaskManager.Task</code>s necessary to
      * inform participants to roll-back.
      */
-    TaskManager.Task[] createTasks() {
-	TaskManager.Task[] tmp = new TaskManager.Task[handles.length];
+    Runnable[] createTasks() {
+	Runnable[] tmp = new Runnable[handles.length];
 
 	for (int i = 0; i < handles.length; i++) {
 	    tmp[i] = 
@@ -139,7 +139,7 @@ class AbortJob extends Job implements Tr
      * @see com.sun.jini.mahalo.Job
      * @see com.sun.jini.thread.TaskManager.Task
      */
-    Object doWork(TaskManager.Task who, Object param) {
+    Object doWork(Runnable who, Object param) {
         ParticipantHandle handle = (ParticipantHandle)param;
         TransactionParticipant par = null;
  

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/CommitJob.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/CommitJob.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/CommitJob.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/CommitJob.java Thu Jan  2 02:45:07 2014
@@ -122,7 +122,7 @@ class CommitJob extends Job implements T
      * @see com.sun.jini.mahalo.Job
      * @see com.sun.jini.thread.TaskManager.Task
      */
-    Object doWork(TaskManager.Task who, Object param) {
+    Object doWork(Runnable who, Object param) {
         ParticipantHandle handle = (ParticipantHandle)param;
         TransactionParticipant par = null;
 
@@ -236,8 +236,8 @@ class CommitJob extends Job implements T
      * Creates the <code>TaskManager.Task</code>s necessary to
      * inform participants to roll-back.
      */
-    TaskManager.Task[] createTasks() {
-	TaskManager.Task[] tmp = new TaskManager.Task[handles.length];
+    Runnable[] createTasks() {
+	Runnable[] tmp = new Runnable[handles.length];
 
 	for (int i = 0; i < handles.length; i++) {
 	    tmp[i] = 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/Job.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/Job.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/Job.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/Job.java Thu Jan  2 02:45:07 2014
@@ -19,11 +19,6 @@ package com.sun.jini.mahalo;
 
 import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
 import java.util.Set;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
@@ -76,7 +71,7 @@ abstract class Job {
      * @param who The task which is performing the work
      * @param param A parameter used in performing the work
      */
-    boolean performWork(TaskManager.Task who, Object param)
+    boolean performWork(Runnable who, Object param)
         throws JobException
     {
 	Integer tmp = tasks.get(who);
@@ -112,7 +107,7 @@ abstract class Job {
      * @param who The task for which the number of attempts
      *		  is inquired
      */
-    int attempt(TaskManager.Task who) throws JobException {
+    int attempt(Runnable who) throws JobException {
 	Integer tmp = tasks.get(who);
 	if (tmp == null) throw new UnknownTaskException();
 	int rank = tmp.intValue();
@@ -131,7 +126,7 @@ abstract class Job {
      * @param param A parameter used to do the work
      *
      */
-    abstract Object doWork(TaskManager.Task who, Object param)
+    abstract Object doWork(Runnable who, Object param)
 	throws JobException;
 
     /**
@@ -139,14 +134,14 @@ abstract class Job {
      * <code>PartialResult</code> objects necessary for the
      * solution to the original problem. 
      */
-    abstract TaskManager.Task[] createTasks();
+    abstract Runnable[] createTasks();
 
 
     /**
      * Schedules tasks for execution
      */
     public void scheduleTasks() {
-	TaskManager.Task[] tmp = createTasks();
+	Runnable[] tmp = createTasks();
 	if (tmp != null) {
             int length = tmp.length;
             if (logger.isLoggable(Level.FINEST)) {
@@ -271,7 +266,7 @@ abstract class Job {
      * Tasks which perform work on behalf of the <code>Job</code>
      * report in that they are done using this method.
      */
-    private void reportDone(TaskManager.Task who, Object param)
+    private void reportDone(Runnable who, Object param)
 	throws JobException
     {
 	if (param == null) throw new NullPointerException("param must be non-null");
@@ -337,7 +332,7 @@ abstract class Job {
 	//Remove and interrupt all tasks
         int l = vals.length;
 	for (int i = 0; i < l; i++) {
-	    TaskManager.Task t = (TaskManager.Task) vals[i];
+	    Runnable t = (Runnable) vals[i];
 	    pool.remove(t);
 	}
 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/ParticipantTask.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/ParticipantTask.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/ParticipantTask.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/ParticipantTask.java Thu Jan  2 02:45:07 2014
@@ -17,7 +17,6 @@
  */
 package com.sun.jini.mahalo;
 
-import com.sun.jini.logging.Levels;
 import com.sun.jini.thread.RetryTask;
 import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareAndCommitJob.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareAndCommitJob.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareAndCommitJob.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareAndCommitJob.java Thu Jan  2 02:45:07 2014
@@ -132,7 +132,7 @@ class PrepareAndCommitJob extends Job im
      * @see com.sun.jini.mahalo.Job
      * @see com.sun.jini.thread.TaskManager.Task
      */
-    Object doWork(TaskManager.Task who, Object param) {
+    Object doWork(Runnable who, Object param) {
         if (operationsLogger.isLoggable(Level.FINER)) {
             operationsLogger.entering(PrepareAndCommitJob.class.getName(), 
 	        "doWork", new Object[] {who, param});
@@ -259,8 +259,8 @@ class PrepareAndCommitJob extends Job im
      * Creates the <code>TaskManager.Task</code>s necessary to
      * inform participants to vote and roll-forward/back.
      */
-    TaskManager.Task[] createTasks() {
-	TaskManager.Task[] tmp = new TaskManager.Task[1];
+    Runnable[] createTasks() {
+	Runnable[] tmp = new Runnable[1];
 
 	tmp[0] = new ParticipantTask(getPool(), getMgr(), this, handle);
 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareJob.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareJob.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareJob.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/PrepareJob.java Thu Jan  2 02:45:07 2014
@@ -121,7 +121,7 @@ class PrepareJob extends Job implements 
      * @see com.sun.jini.mahalo.Job
      * @see com.sun.jini.thread.TaskManager.Task
      */
-    Object doWork(TaskManager.Task who, Object param) {
+    Object doWork(Runnable who, Object param) {
         if (operationsLogger.isLoggable(Level.FINER)) {
             operationsLogger.entering(PrepareJob.class.getName(),
                 "doWork", new Object[] {who, param});
@@ -239,9 +239,9 @@ class PrepareJob extends Job implements 
      * Creates the <code>TaskManager.Task</code>s necessary to
      * inform participants to vote.
      */
-    TaskManager.Task[] createTasks() {
+    Runnable[] createTasks() {
         int length = handles.length;
-	TaskManager.Task[] tmp = new TaskManager.Task[length];
+	Runnable[] tmp = new Runnable[length];
 
 	for (int i = 0; i < length; i++) {
 	    tmp[i] = 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/SettlerTask.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/SettlerTask.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/SettlerTask.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mahalo/SettlerTask.java Thu Jan  2 02:45:07 2014
@@ -23,7 +23,6 @@ import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
 import java.rmi.NoSuchObjectException;
 import java.rmi.RemoteException;
-import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 import net.jini.core.transaction.TransactionException;
@@ -72,15 +71,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)) {
             operationsLogger.entering(SettlerTask.class.getName(), 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mercury/MailboxImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mercury/MailboxImpl.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mercury/MailboxImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/mercury/MailboxImpl.java Thu Jan  2 02:45:07 2014
@@ -43,7 +43,6 @@ import com.sun.jini.thread.ReadersWriter
 import com.sun.jini.thread.ReadersWriter.ConcurrentLockException;
 import com.sun.jini.thread.ReadyState;
 import com.sun.jini.thread.RetryTask;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
 import net.jini.activation.ActivationExporter;
 import net.jini.config.Configuration;
@@ -97,6 +96,9 @@ import java.util.Map;
 import java.util.NoSuchElementException;
 import java.util.Random;
 import java.util.TreeMap;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
 import java.util.concurrent.TimeUnit;
 
 import javax.security.auth.Subject;
@@ -122,6 +124,7 @@ import net.jini.event.MailboxPullRegistr
 import net.jini.lookup.entry.ServiceInfo;
 import net.jini.lookup.JoinManager;
 import net.jini.discovery.LookupDiscovery;
+import org.apache.river.impl.thread.NamedThreadFactory;
 
 /**
  * <tt>MailboxImpl</tt> implements the server side of the event 
@@ -2905,7 +2908,7 @@ class MailboxImpl implements MailboxBack
          * <code>TaskManager</code> that will be handling the 
 	 * notification tasks 
          */
-        private final TaskManager	taskManager;	
+        private final ExecutorService	taskManager;	
 
         /** wakeup manager for <code>NotifyTask</code> */
         private final WakeupManager wakeupMgr =
@@ -2925,9 +2928,11 @@ class MailboxImpl implements MailboxBack
          */
         Notifier(Configuration config) throws ConfigurationException {
     	    super("Notifier");
-    	    taskManager = (TaskManager)Config.getNonNullEntry(config,
-	        MERCURY, "notificationsTaskManager",
-	        TaskManager.class, new TaskManager());
+    	    taskManager = Config.getNonNullEntry(config,
+	        MERCURY, "notificationsExecutorService",
+	        ExecutorService.class, new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, 
+                    new LinkedBlockingQueue<Runnable>(), 
+                    new NamedThreadFactory("EventTypeGenerator", false)));
 //TODO - defer TaskManager() creation to catch block of getEntry()
     	    //start();
         }
@@ -2977,7 +2982,7 @@ class MailboxImpl implements MailboxBack
 				// Create and schedule a event delivery task
     	                        NotifyTask t = 
 				    new NotifyTask(taskManager, wakeupMgr, uuid);
-    	                        taskManager.add(t);
+    	                        taskManager.execute(t);
     	                        // Put registration onto active list
     	                        activeReg.put(uuid, t);
     	                        // Remove registration from pending list
@@ -3026,7 +3031,7 @@ class MailboxImpl implements MailboxBack
 		    }
 		    wakeupMgr.stop();
 		    wakeupMgr.cancelAll();
-    	            taskManager.terminate();
+    	            taskManager.shutdownNow();
 		} 
                 if (deliveryLogger.isLoggable(Level.FINEST)) {
                     deliveryLogger.log(Level.FINEST,
@@ -3072,7 +3077,7 @@ class MailboxImpl implements MailboxBack
     	/**
     	 * Create an object to represent an event notification task.
     	 */
-    	NotifyTask(TaskManager tm, WakeupManager mgr, Uuid regID) {
+    	NotifyTask(ExecutorService tm, WakeupManager mgr, Uuid regID) {
     	    super(tm, mgr);
     	    this.regID = regID;
     	}
@@ -3472,17 +3477,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: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/NormServerBaseImpl.java Thu Jan  2 02:45:07 2014
@@ -1577,6 +1577,7 @@ abstract class NormServerBaseImpl
 	expMgr.terminate();
 	generator.terminate();
 	lrm.clear();
+        lrm.close();
 
 	logger.log(Level.FINEST, "Independent threads interrupted");
 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventType.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventType.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventType.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventType.java Thu Jan  2 02:45:07 2014
@@ -21,7 +21,6 @@ import java.io.IOException;
 import java.io.Serializable;
 import java.rmi.MarshalledObject;
 import java.rmi.RemoteException;
-import java.util.List;
 import java.util.logging.Level;
 import java.util.logging.Logger;
 
@@ -33,8 +32,8 @@ import net.jini.security.ProxyPreparer;
 import com.sun.jini.constants.ThrowableConstants;
 import com.sun.jini.logging.Levels;
 import com.sun.jini.thread.RetryTask;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
+import java.util.concurrent.ExecutorService;
 
 /**
  * Representation of an event type the supports a single registrant.
@@ -167,7 +166,7 @@ public class EventType implements Serial
      *        as part of the event
      * @throws IOException if listener cannot be serialized
      */
-    public synchronized void setListener(RemoteEventListener listener, 
+    public final synchronized void setListener(RemoteEventListener listener, 
 					 MarshalledObject    handback)
         throws IOException
     {
@@ -272,7 +271,7 @@ public class EventType implements Serial
      * <p>
      * @param seqNum value for the last sequence number
      */
-    public synchronized void setLastSequenceNumber(long seqNum) {
+    public final synchronized void setLastSequenceNumber(long seqNum) {
 	lastSeqNum = seqNum;
     }
 
@@ -325,9 +324,9 @@ public class EventType implements Serial
 	if (!haveListener())
 	    return lastSeqNum;
 	
-	final TaskManager mgr = generator.getTaskManager();
+	final ExecutorService mgr = generator.getTaskManager();
 	final WakeupManager wMgr = generator.getWakeupManager();
-	mgr.add(new SendTask(mgr, wMgr, factory, lastSeqNum));
+	mgr.execute(new SendTask(mgr, wMgr, factory, lastSeqNum));
 	
 	return lastSeqNum;
     }
@@ -412,7 +411,7 @@ public class EventType implements Serial
 	 *                     to create the event to be sent
 	 * @param seqNum      the sequence number of the event
 	 */
-	private SendTask(TaskManager taskManager, WakeupManager wakeupManager,
+	private SendTask(ExecutorService taskManager, WakeupManager wakeupManager,
 			 EventFactory eventFactory, long seqNum)
 	{
 	    super(taskManager, wakeupManager);
@@ -491,10 +490,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: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventTypeGenerator.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventTypeGenerator.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventTypeGenerator.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/norm/event/EventTypeGenerator.java Thu Jan  2 02:45:07 2014
@@ -17,11 +17,15 @@
  */
 package com.sun.jini.norm.event;
 
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
 import java.io.IOException;
 import java.io.ObjectInputStream;
 import java.io.Serializable;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import org.apache.river.impl.thread.NamedThreadFactory;
 
 /**
  * Factory class for <code>EventType</code> objects.  All
@@ -46,14 +50,17 @@ public class EventTypeGenerator implemen
     /**
      * Task manager used to send events
      */
-    private transient TaskManager taskManager = new TaskManager();
+    private transient ExecutorService taskManager = 
+            new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, 
+                    new LinkedBlockingQueue<Runnable>(), 
+                    new NamedThreadFactory("EventTypeGenerator", false));
 
     /**
      * Wakeup manager used by the event sending tasks to schedule 
      * retries.
      */
     private transient WakeupManager wakeupManager = 
-	new WakeupManager(new WakeupManager.ThreadDesc(null, true));
+	new WakeupManager(new WakeupManager.ThreadDesc(null, false));
 
     /**
      * Create a new <code>EventType</code> object.  The event ID for
@@ -111,7 +118,7 @@ public class EventTypeGenerator implemen
      * Return the task manager that <code>EventType</code> objects created
      * by this generator should use to send their events.
      */
-    TaskManager getTaskManager() {
+    ExecutorService getTaskManager() {
 	return taskManager;
     }
 
@@ -128,7 +135,7 @@ public class EventTypeGenerator implemen
      * associated with this generator.
      */
     public void terminate() {
-	taskManager.terminate();
+	taskManager.shutdown();
 	wakeupManager.stop();
 	wakeupManager.cancelAll();
     }
@@ -144,7 +151,9 @@ public class EventTypeGenerator implemen
 	// fill in the object from the stream 
 	in.defaultReadObject();
 
-	taskManager = new TaskManager();
+	taskManager = new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, 
+                    new LinkedBlockingQueue<Runnable>(), 
+                    new NamedThreadFactory("EventTypeGenerator", true));
 	wakeupManager = 
 	    new WakeupManager(new WakeupManager.ThreadDesc(null, true));    
     }

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/Notifier.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/Notifier.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/Notifier.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/Notifier.java Thu Jan  2 02:45:07 2014
@@ -30,9 +30,13 @@ import net.jini.space.JavaSpace;
 import com.sun.jini.constants.ThrowableConstants;
 import com.sun.jini.config.Config;
 import com.sun.jini.logging.Levels;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.RetryTask;
 import com.sun.jini.thread.WakeupManager;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
+import org.apache.river.impl.thread.NamedThreadFactory;
 
 /**
  * The notifier thread.  This thread is responsible for notifying
@@ -62,7 +66,7 @@ class Notifier implements com.sun.jini.c
 	new WakeupManager(new WakeupManager.ThreadDesc(null, true));
     
     /** pending notifications tasks */
-    private final TaskManager pending;
+    private final ExecutorService pending;
 
     private final static int	MAX_ATTEMPTS = 10;	// max times to retry
 
@@ -92,9 +96,12 @@ class Notifier implements com.sun.jini.c
 
 	this.recoveredListenerPreparer = recoveredListenerPreparer;
 
-	pending = (TaskManager)Config.getNonNullEntry(config,
-	    OutriggerServerImpl.COMPONENT_NAME, "notificationsTaskManager", 
-	    TaskManager.class, new TaskManager());
+	pending = Config.getNonNullEntry(config,
+	    OutriggerServerImpl.COMPONENT_NAME, "notificationsExecutorService", 
+	    ExecutorService.class, 
+            new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, 
+                    new LinkedBlockingQueue<Runnable>()), 
+            new NamedThreadFactory("OutriggerServerImpl Notifier", false));
     }
 
     /**
@@ -103,7 +110,7 @@ class Notifier implements com.sun.jini.c
      * the constructor completed.
      */
     void terminate() {
-	pending.terminate();
+	pending.shutdown();
 	wakeupMgr.stop();	
 	wakeupMgr.cancelAll();	
     }
@@ -117,7 +124,7 @@ class Notifier implements com.sun.jini.c
      * <code>null</code>
      */
     void enqueueDelivery(EventSender sender) {
-	pending.add(new NotifyTask(sender));
+	pending.execute(new NotifyTask(sender));
     }
 
     /*
@@ -243,18 +250,6 @@ 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);
-//		if (task instanceof NotifyTask) {
-//		    NotifyTask nt = (NotifyTask)task;
-//		    if (sender.runAfter(nt.sender))
-//			return true;
-//		}
-//	    }
-	    return false;
-	}
-
 	/** Log a failed delivery attempt */
 	private void logFailure(String exceptionDescription, Level level,
 				boolean terminal, Throwable t) 

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitor.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitor.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitor.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitor.java Thu Jan  2 02:45:07 2014
@@ -18,7 +18,6 @@
 package com.sun.jini.outrigger;
 
 import com.sun.jini.config.Config;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
 
 import net.jini.config.Configuration;
@@ -27,8 +26,13 @@ import net.jini.config.ConfigurationExce
 import java.util.Collection;
 import java.util.Iterator;
 import java.util.LinkedList;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.LinkedBlockingQueue;
+import java.util.concurrent.ThreadPoolExecutor;
+import java.util.concurrent.TimeUnit;
 import java.util.logging.Level;
 import java.util.logging.Logger;
+import org.apache.river.impl.thread.NamedThreadFactory;
 
 /**
  * This class provides a driver for monitoring the state of transactions
@@ -80,7 +84,7 @@ class TxnMonitor implements Runnable {
     /**
      * The manager for <code>TxnMonitorTask</code> objects.
      */
-    private final TaskManager taskManager;
+    private final ExecutorService taskManager;
 
     /**
      * The space we belong to.  Needed for aborts.
@@ -111,9 +115,12 @@ class TxnMonitor implements Runnable {
 	    throw new NullPointerException("space must be non-null");
 	this.space = space;
 
-	taskManager = (TaskManager)Config.getNonNullEntry(config,
+	taskManager = Config.getNonNullEntry(config,
 	    OutriggerServerImpl.COMPONENT_NAME, "txnMonitorTaskManager", 
-	    TaskManager.class, new TaskManager());
+	    ExecutorService.class, 
+            new ThreadPoolExecutor(1,10,15,TimeUnit.SECONDS, 
+                    new LinkedBlockingQueue<Runnable>(), 
+                    new NamedThreadFactory("OutriggerServerImpl TxnMonitor", false)));
 
         ourThread = new Thread(this, "TxnMonitor");
 	ourThread.setDaemon(true);
@@ -128,7 +135,7 @@ class TxnMonitor implements Runnable {
     }
 
     public void destroy() {
-        taskManager.terminate();
+        taskManager.shutdown();
 	wakeupMgr.stop();	
 
 	synchronized (this) {
@@ -230,7 +237,7 @@ class TxnMonitor implements Runnable {
 
 	    task = new TxnMonitorTask(txn, this, taskManager, wakeupMgr);
 	    txn.monitorTask(task);
-	    taskManager.add(task);  // add it after we've set it in the txn
+	    taskManager.execute(task);  // add it after we've set it in the txn
 	}
 	return task;
     }

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitorTask.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitorTask.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitorTask.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/outrigger/TxnMonitorTask.java Thu Jan  2 02:45:07 2014
@@ -21,7 +21,6 @@ import com.sun.jini.constants.TxnConstan
 import com.sun.jini.constants.ThrowableConstants;
 import com.sun.jini.logging.Levels;
 import com.sun.jini.thread.RetryTask;
-import com.sun.jini.thread.TaskManager;
 import com.sun.jini.thread.WakeupManager;
 
 import java.io.IOException;
@@ -33,6 +32,7 @@ import java.util.WeakHashMap;
 import java.util.Iterator;
 import java.util.Collection;
 import java.util.Collections;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicInteger;
 import java.util.concurrent.atomic.AtomicLong;
 import java.util.logging.Level;
@@ -166,7 +166,7 @@ class TxnMonitorTask extends RetryTask
      * Create a new TxnMonitorTask.
      */
     TxnMonitorTask(Txn txn, TxnMonitor monitor,
-		   TaskManager manager, WakeupManager wakeupMgr) {
+		   ExecutorService manager, WakeupManager wakeupMgr) {
 	super(manager, wakeupMgr);
 	this.txn = txn;
 	this.monitor = monitor;
@@ -212,14 +212,6 @@ class TxnMonitorTask extends RetryTask
     }
 
     /**
-     * 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
      * on one of the same entries.  For example, if a client is blocked
      * on a <code>read</code>, another transaction can read the same

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/RetryTask.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/RetryTask.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/RetryTask.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/RetryTask.java Thu Jan  2 02:45:07 2014
@@ -62,10 +62,12 @@ import com.sun.jini.constants.TimeConsta
  * @see WakeupManager
  */
 import com.sun.jini.thread.WakeupManager.Ticket;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.atomic.AtomicInteger;
 
-public abstract class RetryTask implements TaskManager.Task, TimeConstants {
+public abstract class RetryTask implements Runnable, TimeConstants {
     private final TaskManager	  manager;	// the TaskManager for this task
+    private final ExecutorService executor;
     private volatile RetryTime	  retry;	// the retry object for this task
     private volatile boolean	  cancelled;	// have we been cancelled?
     private volatile boolean	  complete;	// have we completed successfully?
@@ -102,10 +104,30 @@ public abstract class RetryTask implemen
      */
     public RetryTask(TaskManager manager, WakeupManager wakeupManager) {
 	this.manager = manager;
+        this.executor = null;
         this.wakeup = wakeupManager;
         attempt = new AtomicInteger();
 	reset();
     }
+    
+    /**
+     * Create a new <code>RetryTask</code> that will be scheduled with
+     * the given executor service, and which will perform retry scheduling 
+     * using the given wakeup manager.
+     * 
+     * TaskManager's Task.runAfter() is not called when using
+     * this constructor.
+     * 
+     * @param executor
+     * @param wakeupManager 
+     */
+    public RetryTask(ExecutorService executor, WakeupManager wakeupManager){
+        this.manager = null;
+        this.executor = executor;
+        this.wakeup = wakeupManager;
+        attempt = new AtomicInteger();
+        reset();
+    }
 
     /**
      * Make a single attempt.  Return <code>true</code> if the attempt
@@ -241,7 +263,7 @@ public abstract class RetryTask implemen
     /**
      * Reset values for a new use of this task.
      */
-    public void reset() {
+    public final void reset() {
 	cancel();		// remove from the wakeup queue
 	startTime = System.currentTimeMillis();
 	cancelled = false;
@@ -262,7 +284,8 @@ public abstract class RetryTask implemen
 	 */
 	public void run() {
             ticket = null;
-	    manager.add(RetryTask.this);
+	    if (manager != null ) manager.add(RetryTask.this);
+            if (executor != null) executor.submit(RetryTask.this);
 	}
     };
 }

Modified: river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/TaskManager.java
URL: http://svn.apache.org/viewvc/river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/TaskManager.java?rev=1554723&r1=1554722&r2=1554723&view=diff
==============================================================================
--- river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/TaskManager.java (original)
+++ river/jtsk/skunk/qa_refactor/trunk/src/com/sun/jini/thread/TaskManager.java Thu Jan  2 02:45:07 2014
@@ -78,7 +78,7 @@ public class TaskManager {
 	Logger.getLogger("com.sun.jini.thread.TaskManager");
 
     /** Active and pending tasks */
-    protected final ArrayList tasks = new ArrayList(); //sync on this
+    protected final ArrayList<Runnable> tasks = new ArrayList<Runnable>(); //sync on this
     /** Index of the first pending task; all earlier tasks are active */
     protected int firstPending = 0;//sync on this
     /** Read-only view of tasks */
@@ -128,7 +128,7 @@ public class TaskManager {
     }
 
     /** Add a new task. */
-    public synchronized void add(Task t) {
+    public synchronized void add(Runnable t) {
 	tasks.add(t);
 	boolean poke = true;
 	while (threads.size() < maxThreads && needThread()) {
@@ -170,13 +170,13 @@ public class TaskManager {
 	if (max < bound)
 	    return false;
 	max--;
-	if (runAfter((Task)tasks.get(max), max))
+	if (runAfter(tasks.get(max), max))
 	    return false;
 	int ready = firstPending + 1;
 	if (ready > bound)
 	    return true;
 	for (int i = firstPending; i < max; i++) {
-	    if (!runAfter((Task)tasks.get(i), i)) {
+	    if (!runAfter(tasks.get(i), i)) {
 		ready++;
 		if (ready > bound)
 		    return true;
@@ -188,9 +188,12 @@ public class TaskManager {
     /**
      * Returns t.runAfter(i), or false if an exception is thrown.
      */
-    private boolean runAfter(Task t, int i) {
+    private boolean runAfter(Runnable t, int i) {
 	try {
-	    return t.runAfter(roTasks, i);
+            if (t instanceof Task)
+                return ((Task)t).runAfter(roTasks, i);
+            else 
+                return false;
 	} catch (Throwable tt) {
 	    try {
 		logger.log(Level.WARNING, "Task.runAfter exception", tt);
@@ -205,7 +208,7 @@ public class TaskManager {
      * is used, not the equals method.  Returns true if the task was
      * removed.
      */
-    public synchronized boolean removeIfPending(Task t) {
+    public synchronized boolean removeIfPending(Runnable t) {
 	return removeTask(t, firstPending);
     }
 
@@ -215,7 +218,7 @@ public class TaskManager {
      * but do not wait for the thread to terminate.  Object identity (==) is
      * used, not the equals method.  Returns true if the task was removed.
      */
-    public synchronized boolean remove(Task t) {
+    public synchronized boolean remove(Runnable t) {
 	return removeTask(t, 0);
     }
 
@@ -223,7 +226,7 @@ public class TaskManager {
      * Remove a task if it has index >= min.  If it is active and not being
      * executed by the calling thread, interrupt the thread executing the task.
      */
-    private boolean removeTask(Task t, int min) {
+    private boolean removeTask(Runnable t, int min) {
 	for (int i = tasks.size(); --i >= min; ) {
 	    if (tasks.get(i) == t) {
 		tasks.remove(i);
@@ -272,7 +275,7 @@ public class TaskManager {
     private class TaskThread extends Thread {
 
 	/** The task being run, if any */
-	public Task task = null; // sync access on TaskManager.this
+	public Runnable task = null; // sync access on TaskManager.this
 
 	public TaskThread() {
 	    super("task");
@@ -288,23 +291,23 @@ public class TaskManager {
 	private boolean takeTask() {
 	    int size = tasks.size();
 	    for (int i = firstPending; i < size; i++) {
-		Task t = (Task)tasks.get(i);
-		if (!runAfter(t, i)) {
-		    if (i > firstPending) {
-			tasks.remove(i);
-			tasks.add(firstPending, t);
-		    }
-		    firstPending++;
-		    task = t;
-		    return true;
-		}
+		Runnable t = tasks.get(i);
+                if (!runAfter(t, i)) {
+                    if (i > firstPending) {
+                        tasks.remove(i);
+                        tasks.add(firstPending, t);
+                    }
+                    firstPending++;
+                    task = t;
+                    return true;
+                }
 	    }
 	    return false;
 	}
 
 	public void run() {
 	    while (true) {
-                Task tsk = null;
+                Runnable tsk = null;
 		synchronized (TaskManager.this) {
 		    if (terminated)
 			return;



Mime
View raw message