You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tomee.apache.org by jg...@apache.org on 2016/04/12 23:20:52 UTC

tomee git commit: Resources sometimes not cleaned up as the comparison was against the JNDI name, and not the ID, and the ID was being passed in..

Repository: tomee
Updated Branches:
  refs/heads/tomee-1.7.x 2879bb00e -> b9d4e5ee9


Resources sometimes not cleaned up as the comparison was against the JNDI name, and not the ID, and the ID was being passed in..


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

Branch: refs/heads/tomee-1.7.x
Commit: b9d4e5ee9bd845c1dcab3f85dc4b7ecb288b54e7
Parents: 2879bb0
Author: Jonathan Gallimore <jo...@jrg.me.uk>
Authored: Tue Apr 12 22:19:25 2016 +0100
Committer: Jonathan Gallimore <jo...@jrg.me.uk>
Committed: Tue Apr 12 22:19:25 2016 +0100

----------------------------------------------------------------------
 .../org/apache/openejb/assembler/classic/Assembler.java | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/tomee/blob/b9d4e5ee/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
----------------------------------------------------------------------
diff --git a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
index 8464957..06ce2f3 100644
--- a/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
+++ b/container/openejb-core/src/main/java/org/apache/openejb/assembler/classic/Assembler.java
@@ -1692,6 +1692,12 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
         while (namingEnumeration != null && namingEnumeration.hasMoreElements()) {
             final Binding binding = namingEnumeration.nextElement();
             final String boundName = name + "/" + binding.getName();
+
+            String id = boundName;
+            if (id.startsWith(OPENEJB_RESOURCE_JNDI_PREFIX)) {
+                id = id.substring(OPENEJB_RESOURCE_JNDI_PREFIX.length());
+            }
+
             final Object object = binding.getObject();
             if (Context.class.isInstance(object)) {
                 try {
@@ -1701,7 +1707,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
                     logger.error("Error removing bindings from " + boundName, e);
                 }
             } else if (LazyResource.class.isInstance(object)) {
-                removeResourceInfo(boundName);
+                removeResourceInfo(id);
                 try {
                     containerSystem.getJNDIContext().unbind(boundName);
                 } catch (final NamingException e) {
@@ -1842,7 +1848,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
                 final Iterator<ResourceInfo> iterator = configuration.facilities.resources.iterator();
                 while (iterator.hasNext()) {
                     final ResourceInfo info = iterator.next();
-                    if (name.equals(OPENEJB_RESOURCE_JNDI_PREFIX + info.id)) {
+                    if (name.equals(info.id)) {
                         iterator.remove();
                         break;
                     }
@@ -2273,7 +2279,7 @@ public class Assembler extends AssemblerTool implements org.apache.openejb.spi.A
             final LazyObjectReference<?> ref = LazyObjectReference.class.cast(binding.getObject());
             if (! ref.isInitialized()) {
                 globalContext.unbind(name);
-                removeResourceInfo(name);
+                removeResourceInfo(id);
                 return;
             }
         }