deltaspike-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gpetra...@apache.org
Subject git commit: DELTASPIKE-486 fixed destroy logic in AbstractContext
Date Thu, 02 Jan 2014 21:30:40 GMT
Updated Branches:
  refs/heads/master 48811a587 -> 02b78e988


DELTASPIKE-486 fixed destroy logic in AbstractContext


Project: http://git-wip-us.apache.org/repos/asf/deltaspike/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltaspike/commit/02b78e98
Tree: http://git-wip-us.apache.org/repos/asf/deltaspike/tree/02b78e98
Diff: http://git-wip-us.apache.org/repos/asf/deltaspike/diff/02b78e98

Branch: refs/heads/master
Commit: 02b78e988cd7b768655ae88f9b3b5f125396d79a
Parents: 48811a5
Author: gpetracek <gpetracek@apache.org>
Authored: Thu Jan 2 22:28:27 2014 +0100
Committer: gpetracek <gpetracek@apache.org>
Committed: Thu Jan 2 22:28:27 2014 +0100

----------------------------------------------------------------------
 .../deltaspike/core/util/context/AbstractContext.java     | 10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltaspike/blob/02b78e98/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
----------------------------------------------------------------------
diff --git a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
index e30931c..7be712c 100644
--- a/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
+++ b/deltaspike/core/api/src/main/java/org/apache/deltaspike/core/util/context/AbstractContext.java
@@ -25,6 +25,7 @@ import javax.enterprise.context.spi.Contextual;
 import javax.enterprise.context.spi.CreationalContext;
 import javax.enterprise.inject.spi.BeanManager;
 import javax.enterprise.inject.spi.PassivationCapable;
+import java.util.HashMap;
 import java.util.Map;
 
 /**
@@ -126,7 +127,8 @@ public abstract class AbstractContext implements Context
         {
             return false;
         }
-        ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().get(storage.getBeanKey(bean));
+
+        ContextualInstanceInfo<?> contextualInstanceInfo = storage.getStorage().remove(storage.getBeanKey(bean));
 
         if (contextualInstanceInfo == null)
         {
@@ -160,7 +162,11 @@ public abstract class AbstractContext implements Context
      */
     public static void destroyAllActive(ContextualStorage storage)
     {
-        Map<Object, ContextualInstanceInfo<?>> contextMap = storage.getStorage();
+        //drop all entries in the storage before starting with destroying the original entries
+        Map<Object, ContextualInstanceInfo<?>> contextMap =
+                new HashMap<Object, ContextualInstanceInfo<?>>(storage.getStorage());
+        storage.getStorage().clear();
+
         for (Map.Entry<Object, ContextualInstanceInfo<?>> entry : contextMap.entrySet())
         {
             Contextual bean = storage.getBean(entry.getKey());


Mime
View raw message