aries-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gno...@apache.org
Subject svn commit: r1365477 - /aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
Date Wed, 25 Jul 2012 07:16:10 GMT
Author: gnodet
Date: Wed Jul 25 07:16:09 2012
New Revision: 1365477

URL: http://svn.apache.org/viewvc?rev=1365477&view=rev
Log:
[ARIES-867] Deadlock if stopping a blueprint bundle while the blueprint container is in the
create state.

Modified:
    aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java

Modified: aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
URL: http://svn.apache.org/viewvc/aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java?rev=1365477&r1=1365476&r2=1365477&view=diff
==============================================================================
--- aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
(original)
+++ aries/trunk/blueprint/blueprint-core/src/main/java/org/apache/aries/blueprint/container/BlueprintContainerImpl.java
Wed Jul 25 07:16:09 2012
@@ -146,6 +146,7 @@ public class BlueprintContainerImpl 
     private ScheduledFuture timeoutFuture;
     private final AtomicBoolean scheduled = new AtomicBoolean();
     private final AtomicBoolean running = new AtomicBoolean();
+    private Thread runningThread;
     private List<ServiceRecipe> services;
     private AccessControlContext accessControlContext;
     private final IdSpace tempRecipeIdSpace = new IdSpace();
@@ -237,11 +238,15 @@ public class BlueprintContainerImpl 
         scheduled.set(false);
         synchronized (scheduled) {
             synchronized (running) {
+                runningThread = Thread.currentThread();
                 running.set(true);
-                try {
-                    doRun();
-                } finally {
+            }
+            try {
+                doRun();
+            } finally {
+                synchronized (running) {
                     running.set(false);
+                    runningThread = null;
                     running.notifyAll();
                 }
             }
@@ -823,12 +828,10 @@ public class BlueprintContainerImpl 
         unregisterServices();
 
         synchronized (running) {
-            if (handlerSet != null) {
-                handlerSet.removeListener(this);
-                handlerSet.destroy();
-            }
-            
             while (running.get()) {
+                if (runningThread != null) {
+                    runningThread.interrupt();
+                }
                 try {
                     running.wait();
                 } catch (InterruptedException e) {
@@ -836,6 +839,10 @@ public class BlueprintContainerImpl 
                 }
             }
         }
+        if (handlerSet != null) {
+            handlerSet.removeListener(this);
+            handlerSet.destroy();
+        }
 
         destroyComponents();
         



Mime
View raw message