Forwarded for Meeraj as he is having email issues.
--
Jeremy

Begin forwarded message:

From: "meeraj" <[EMAIL PROTECTED]>
Date: August 2, 2006 1:45:08 PM PDT
To: "Jeremy Boynes" <[EMAIL PROTECTED]>
Cc: "Jim Marino" <[EMAIL PROTECTED]>, <[EMAIL PROTECTED]>
Subject: Supply chain fix

Jeremy,

The changes to the launcher and the destroy method on the work manager have fixed the issue with the supply chain example hanging. I haven't marked the threads in the pool as non-daemon, that doesn't seem to be necessary.

Please find the patches attached.

Ta
Meeraj
Index: Launcher.java
===================================================================
--- Launcher.java       (revision 428128)
+++ Launcher.java       (working copy)
@@ -57,7 +57,8 @@
     private ClassLoader applicationLoader;
     private RuntimeComponent runtime;
     private Deployer deployer;
-
+    private CompositeComponent<?> composite;
+
     /**
      * Returns the classloader for application classes.
      *
@@ -112,7 +113,7 @@
moduleImplementation);

// deploy the component into the runtime under the system parent - CompositeComponent<?> composite = (CompositeComponent<?>) bootDeployer.deploy(parent, moduleDefinition); + composite = (CompositeComponent<?>) bootDeployer.deploy (parent, moduleDefinition);

         // start the system
         composite.start();
@@ -125,10 +126,15 @@
      * Shuts down the active runtime being managed by this instance.
      */
     public void shutdownRuntime() {
+       
+       if(composite != null) {
+               composite.stop();
+       }
+       composite = null;
+       
         if (runtime != null) {
             runtime.stop();
         }
-
         runtime = null;
     }

Index: ThreadPoolWorkManager.java
===================================================================
--- ThreadPoolWorkManager.java  (revision 428128)
+++ ThreadPoolWorkManager.java  (working copy)
@@ -20,10 +20,11 @@
 import java.util.Collection;
 import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
-import java.util.concurrent.Executor;
+import java.util.concurrent.ExecutorService;
 import java.util.concurrent.Executors;
 import java.util.concurrent.RejectedExecutionException;

+import org.osoa.sca.annotations.Destroy;
 import org.osoa.sca.annotations.Property;

 import commonj.work.Work;
@@ -48,7 +49,7 @@
private Map<DefaultWorkItem, WorkListener> workItems = new ConcurrentHashMap<DefaultWorkItem, WorkListener>();

     // Thread-pool
-    private Executor executor;
+    private ExecutorService executor;

     /**
      * Initializes the thread-pool.
@@ -208,5 +209,10 @@
         }

     }
+
+    @Destroy
+    public void destroy() {
+       executor.shutdown();
+    }

 }


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to