Fix https://issues.apache.org/bugzilla/show_bug.cgi?id=49143
authormarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 23 Apr 2010 14:23:45 +0000 (14:23 +0000)
committermarkt <markt@13f79535-47bb-0310-9956-ffa450edef68>
Fri, 23 Apr 2010 14:23:45 +0000 (14:23 +0000)
Threading / initialisation issues. Not all were valid. Make them volatile anyway so FindBugs doesn't complain.
Fix some additional issues - use of valueOf() - found along the way

git-svn-id: https://svn.apache.org/repos/asf/tomcat/trunk@937309 13f79535-47bb-0310-9956-ffa450edef68

java/org/apache/catalina/realm/RealmBase.java
java/org/apache/catalina/session/StandardSession.java
java/org/apache/catalina/startup/TldConfig.java
java/org/apache/catalina/util/ExtensionValidator.java
java/org/apache/tomcat/util/modeler/modules/MbeansDescriptorsDigesterSource.java

index d935576..d5f6f77 100644 (file)
@@ -124,7 +124,7 @@ public abstract class RealmBase extends LifecycleBase
     /**
      * MD5 message digest provider.
      */
-    protected static MessageDigest md5Helper;
+    protected static volatile MessageDigest md5Helper;
 
 
     /**
index d39fce4..52448b4 100644 (file)
@@ -249,7 +249,7 @@ public class StandardSession
     /**
      * The HTTP session context associated with this session.
      */
-    protected static HttpSessionContext sessionContext = null;
+    protected static volatile HttpSessionContext sessionContext = null;
 
 
     /**
@@ -1559,12 +1559,12 @@ public class StandardSession
     protected void writeObject(ObjectOutputStream stream) throws IOException {
 
         // Write the scalar instance variables (except Manager)
-        stream.writeObject(new Long(creationTime));
-        stream.writeObject(new Long(lastAccessedTime));
-        stream.writeObject(new Integer(maxInactiveInterval));
-        stream.writeObject(new Boolean(isNew));
-        stream.writeObject(new Boolean(isValid));
-        stream.writeObject(new Long(thisAccessedTime));
+        stream.writeObject(Long.valueOf(creationTime));
+        stream.writeObject(Long.valueOf(lastAccessedTime));
+        stream.writeObject(Integer.valueOf(maxInactiveInterval));
+        stream.writeObject(Boolean.valueOf(isNew));
+        stream.writeObject(Boolean.valueOf(isValid));
+        stream.writeObject(Long.valueOf(thisAccessedTime));
         stream.writeObject(id);
         if (manager.getContainer().getLogger().isDebugEnabled())
             manager.getContainer().getLogger().debug
@@ -1589,7 +1589,7 @@ public class StandardSession
 
         // Serialize the attribute count and the Serializable attributes
         int n = saveNames.size();
-        stream.writeObject(new Integer(n));
+        stream.writeObject(Integer.valueOf(n));
         for (int i = 0; i < n; i++) {
             stream.writeObject(saveNames.get(i));
             try {
index 6846e5b..5c5353e 100644 (file)
@@ -66,7 +66,7 @@ public final class TldConfig  implements LifecycleListener {
     private static final String WEB_INF_LIB = "/WEB-INF/lib/";
     
     // Names of JARs that are known not to contain any TLDs
-    private static Set<String> noTldJars = null;
+    private static volatile Set<String> noTldJars = null;
 
     private static final org.apache.juli.logging.Log log=
         org.apache.juli.logging.LogFactory.getLog( TldConfig.class );
index 9c14b40..6c4462e 100644 (file)
@@ -62,7 +62,8 @@ public final class ExtensionValidator {
     private static final StringManager sm =
         StringManager.getManager("org.apache.catalina.util");
     
-    private static ArrayList<Extension> containerAvailableExtensions = null;
+    private static volatile ArrayList<Extension> containerAvailableExtensions =
+        null;
     private static ArrayList<ManifestResource> containerManifestResources =
         new ArrayList<ManifestResource>();
 
index 1f49c31..89e1716 100644 (file)
@@ -42,7 +42,7 @@ public class MbeansDescriptorsDigesterSource extends ModelerSource
     String type;
     Object source;
     List<ObjectName> mbeans = new ArrayList<ObjectName>();
-    protected static Digester digester = null;
+    protected static volatile Digester digester = null;
     
     protected static Digester createDigester(Registry registry) {