Author: andygumbrecht
Date: Mon Jul 21 15:31:35 2014
New Revision: 1612313

URL: http://svn.apache.org/r1612313
Log:
No sync, but use a ConcurrentHashMap.

Modified:
    
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java

Modified: 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
URL: 
http://svn.apache.org/viewvc/tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java?rev=1612313&r1=1612312&r2=1612313&view=diff
==============================================================================
--- 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
 (original)
+++ 
tomee/tomee/branches/tomee-1.7.x/container/openejb-core/src/main/java/org/apache/openejb/core/stateless/StatelessContainer.java
 Mon Jul 21 15:31:35 2014
@@ -48,7 +48,6 @@ import java.util.Map;
 import java.util.concurrent.ConcurrentHashMap;
 import java.util.concurrent.ConcurrentMap;
 import java.util.concurrent.CopyOnWriteArrayList;
-import java.util.concurrent.locks.ReentrantLock;
 
 import static 
org.apache.openejb.core.transaction.EjbTransactionUtil.afterInvoke;
 import static 
org.apache.openejb.core.transaction.EjbTransactionUtil.createTransactionPolicy;
@@ -60,10 +59,9 @@ import static org.apache.openejb.core.tr
  */
 public class StatelessContainer implements org.apache.openejb.RpcContainer {
 
-    private final ReentrantLock lockRegistry = new ReentrantLock();
     private final ConcurrentMap<Class<?>, List<Method>> interceptorCache = new 
ConcurrentHashMap<Class<?>, List<Method>>();
     private final StatelessInstanceManager instanceManager;
-    private final Map<String, BeanContext> deploymentRegistry = new 
HashMap<String, BeanContext>();
+    private final Map<String, BeanContext> deploymentRegistry = new 
ConcurrentHashMap<String, BeanContext>();
     private final Object containerID;
     private final SecurityService securityService;
 
@@ -80,29 +78,13 @@ public class StatelessContainer implemen
 
     @Override
     public BeanContext[] getBeanContexts() {
-
-        final ReentrantLock l = lockRegistry;
-        l.lock();
-
-        try {
-            return this.deploymentRegistry.values().toArray(new 
BeanContext[this.deploymentRegistry.size()]);
-        } finally {
-            l.unlock();
-        }
+        return this.deploymentRegistry.values().toArray(new 
BeanContext[this.deploymentRegistry.size()]);
     }
 
     @Override
     public BeanContext getBeanContext(final Object deploymentID) {
-
-        final ReentrantLock l = lockRegistry;
-        l.lock();
-
-        try {
-            final String id = (String) deploymentID;
-            return deploymentRegistry.get(id);
-        } finally {
-            l.unlock();
-        }
+        final String id = (String) deploymentID;
+        return deploymentRegistry.get(id);
     }
 
     @Override
@@ -118,16 +100,9 @@ public class StatelessContainer implemen
     @Override
     public void deploy(final BeanContext beanContext) throws OpenEJBException {
 
-        final ReentrantLock l = lockRegistry;
-        l.lock();
-
-        try {
-            final String id = (String) beanContext.getDeploymentID();
-            deploymentRegistry.put(id, beanContext);
-            beanContext.setContainer(this);
-        } finally {
-            l.unlock();
-        }
+        final String id = (String) beanContext.getDeploymentID();
+        deploymentRegistry.put(id, beanContext);
+        beanContext.setContainer(this);
 
         // add it before starting the timer (@PostCostruct)
         if (StatsInterceptor.isStatsActivated()) {
@@ -154,17 +129,10 @@ public class StatelessContainer implemen
     @Override
     public void undeploy(final BeanContext beanContext) {
         this.instanceManager.undeploy(beanContext);
-
-        final ReentrantLock l = lockRegistry;
-        l.lock();
-        try {
-            final String id = (String) beanContext.getDeploymentID();
-            beanContext.setContainer(null);
-            beanContext.setContainerData(null);
-            this.deploymentRegistry.remove(id);
-        } finally {
-            l.unlock();
-        }
+        final String id = (String) beanContext.getDeploymentID();
+        beanContext.setContainer(null);
+        beanContext.setContainerData(null);
+        this.deploymentRegistry.remove(id);
     }
 
     @SuppressWarnings("unchecked")


Reply via email to