You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by ri...@apache.org on 2009/12/16 16:50:26 UTC

svn commit: r891277 - in /geronimo/server/trunk: framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/ framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/ framework/modules/geronimo-plugin/src/ma...

Author: rickmcguire
Date: Wed Dec 16 15:50:25 2009
New Revision: 891277

URL: http://svn.apache.org/viewvc?rev=891277&view=rev
Log:
GERONIMO-4987 Use ConcurrentHashMap instead of Collections.synchronizedMap(new HashMap())
Patch provided by Jack Cai. 

Modified:
    geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/EncryptionManager.java
    geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/Authenticator.java
    geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
    geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
    geronimo/server/trunk/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSRFHandler.java

Modified: geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/EncryptionManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/EncryptionManager.java?rev=891277&r1=891276&r2=891277&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/EncryptionManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-crypto/src/main/java/org/apache/geronimo/crypto/EncryptionManager.java Wed Dec 16 15:50:25 2009
@@ -16,9 +16,8 @@
  */
 package org.apache.geronimo.crypto;
 
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
 import java.io.Serializable;
 
 /**
@@ -41,7 +40,7 @@
  */
 public class EncryptionManager {
 
-    private static final Map<String, Encryption> ENCRYPTORS = Collections.synchronizedMap(new HashMap<String, Encryption>());
+    private static final Map<String, Encryption> ENCRYPTORS = new ConcurrentHashMap<String, Encryption>();
     private final static String SIMPLE_ENCRYPTION_PREFIX = "{Simple}";
 
     static {

Modified: geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/Authenticator.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/Authenticator.java?rev=891277&r1=891276&r2=891277&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/Authenticator.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-jmx-remoting/src/main/java/org/apache/geronimo/jmxremoting/Authenticator.java Wed Dec 16 15:50:25 2009
@@ -16,10 +16,9 @@
  */
 package org.apache.geronimo.jmxremoting;
 
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.management.Notification;
 import javax.management.NotificationListener;
@@ -39,7 +38,7 @@
     private final String configName;
     private final ClassLoader cl;
     private ThreadLocal<LoginContext> threadContext = new ThreadLocal<LoginContext>();
-    private Map<String, LoginContext> contextMap = Collections.synchronizedMap(new HashMap<String, LoginContext>());
+    private Map<String, LoginContext> contextMap = new ConcurrentHashMap<String, LoginContext>();
 
     /**
      * Constructor indicating which JAAS Application Configuration Entry to use.

Modified: geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java?rev=891277&r1=891276&r2=891277&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-plugin/src/main/java/org/apache/geronimo/system/plugin/PluginInstallerGBean.java Wed Dec 16 15:50:25 2009
@@ -47,6 +47,7 @@
 import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.zip.ZipEntry;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.security.auth.login.FailedLoginException;
 import javax.xml.parsers.SAXParser;
@@ -184,7 +185,7 @@
         this.configStore = configStore;
         this.serverInfo = serverInfo;
         this.threadPool = threadPool;
-        asyncKeys = Collections.synchronizedMap(new HashMap<Object, DownloadResults>());
+        asyncKeys = new ConcurrentHashMap<Object, DownloadResults>();
         this.serverInstanceDatas = serverInstanceDatas;
         if (artifactManager == null) artifactManager = new DefaultArtifactManager();
         setUpServerInstances(serverInstanceDatas, serverInfo, artifactManager, servers, writeableRepo, live);
@@ -228,7 +229,7 @@
         writeableRepo = new Maven2Repository(targetRepositoryFile);
         configStore = new RepositoryConfigurationStore(writeableRepo);
         threadPool = null;
-        asyncKeys = Collections.synchronizedMap(new HashMap<Object, DownloadResults>());
+        asyncKeys = new ConcurrentHashMap<Object, DownloadResults>();
         this.serverInstanceDatas = serverInstanceDatas;
         this.persistentConfigurationLists = Collections.emptyList();
         this.bundleContext = bundleContext;
@@ -357,7 +358,7 @@
         this.configStore = configStore;
         this.serverInfo = serverInfo;
         this.threadPool = threadPool;
-        asyncKeys = Collections.synchronizedMap(new HashMap<Object, DownloadResults>());
+        asyncKeys = new ConcurrentHashMap<Object, DownloadResults>();
         serverInstanceDatas = null;
         this.persistentConfigurationLists = Collections.emptyList();
         bundleContext = null;

Modified: geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java?rev=891277&r1=891276&r2=891277&view=diff
==============================================================================
--- geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java (original)
+++ geronimo/server/trunk/framework/modules/geronimo-security/src/main/java/org/apache/geronimo/security/ContextManager.java Wed Dec 16 15:50:25 2009
@@ -25,11 +25,11 @@
 import java.security.PrivilegedAction;
 import java.security.ProviderException;
 import java.util.Collections;
-import java.util.HashMap;
 import java.util.IdentityHashMap;
 import java.util.Map;
 import java.util.Set;
 import java.util.List;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.crypto.Mac;
 import javax.crypto.SecretKey;
@@ -59,7 +59,7 @@
         }
     };
     private static Map<Subject, Context> subjectContexts = new IdentityHashMap<Subject, Context>();
-    private static Map<SubjectId, Subject> subjectIds =  Collections.synchronizedMap(new HashMap<SubjectId, Subject>());
+    private static Map<SubjectId, Subject> subjectIds =  new ConcurrentHashMap<SubjectId, Subject>();
     private static long nextSubjectId = System.currentTimeMillis();
 
     private static SecretKey key;

Modified: geronimo/server/trunk/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSRFHandler.java
URL: http://svn.apache.org/viewvc/geronimo/server/trunk/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSRFHandler.java?rev=891277&r1=891276&r2=891277&view=diff
==============================================================================
--- geronimo/server/trunk/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSRFHandler.java (original)
+++ geronimo/server/trunk/plugins/console/console-filter/src/main/java/org/apache/geronimo/console/filter/XSRFHandler.java Wed Dec 16 15:50:25 2009
@@ -21,10 +21,9 @@
 
 import java.io.IOException;
 import java.io.InputStream;
-import java.util.Collections;
-import java.util.HashMap;
 import java.util.Map;
 import java.util.Random;
+import java.util.concurrent.ConcurrentHashMap;
 
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpSession;
@@ -49,7 +48,7 @@
     private static final String XSRF_JS_FILENAME = "/XSRF.js";
     private final static String XSRF_JS_UNIQUEID = "<%XSRF_UNIQUEID%>";
 
-    private Map<String, String> sessionMap = Collections.synchronizedMap(new HashMap<String, String>());
+    private Map<String, String> sessionMap = new ConcurrentHashMap<String, String>();
     private String xsrfJS;
 
     private Random random = new Random();