james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From rdon...@apache.org
Subject svn commit: r564355 - in /james/jsieve/trunk/src/main/java/org/apache/jsieve/commands: CommandStateManager.java ConditionManager.java
Date Thu, 09 Aug 2007 19:41:40 GMT
Author: rdonkin
Date: Thu Aug  9 12:41:39 2007
New Revision: 564355

URL: http://svn.apache.org/viewvc?view=rev&rev=564355
Log:
Prevent race conditions. https://issues.apache.org/jira/browse/JSIEVE-10. Better late than
never.

Modified:
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/CommandStateManager.java
    james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/ConditionManager.java

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/CommandStateManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/CommandStateManager.java?view=diff&rev=564355&r1=564354&r2=564355
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/CommandStateManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/CommandStateManager.java Thu
Aug  9 12:41:39 2007
@@ -49,7 +49,7 @@
     /**
      * The instance of the reciever for the current thread
      */     
-    static private ThreadLocal fieldInstance;
+    static private final ThreadLocal fieldInstance = new ThreadLocal();
     
     /**
      * Constructor for CommandStateManager.
@@ -108,8 +108,6 @@
      */
     static private CommandStateManager getInstanceBasic()
     {
-        if (null == fieldInstance)
-            return null;
         return (CommandStateManager)fieldInstance.get();
     }    
     
@@ -120,8 +118,6 @@
      */
     static protected void setInstance(CommandStateManager conditionManager)
     {
-        if (null == fieldInstance)
-            fieldInstance = new ThreadLocal();
         fieldInstance.set(conditionManager);
     }
     

Modified: james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/ConditionManager.java
URL: http://svn.apache.org/viewvc/james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/ConditionManager.java?view=diff&rev=564355&r1=564354&r2=564355
==============================================================================
--- james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/ConditionManager.java (original)
+++ james/jsieve/trunk/src/main/java/org/apache/jsieve/commands/ConditionManager.java Thu
Aug  9 12:41:39 2007
@@ -29,7 +29,7 @@
     /**
      * The Condition Manager instance for the current thread
      */     
-    static private ThreadLocal fieldInstance;
+    static private final ThreadLocal fieldInstance = new ThreadLocal();
     
     /**
      * Is an Else Condition allowed
@@ -188,8 +188,6 @@
      */
     static private ConditionManager getInstanceBasic()
     {
-        if (null == fieldInstance)
-            return null;
         return (ConditionManager)fieldInstance.get();
     }    
     
@@ -200,8 +198,6 @@
      */
     static protected void setInstance(ConditionManager conditionManager)
     {
-        if (null == fieldInstance)
-            fieldInstance = new ThreadLocal();
         fieldInstance.set(conditionManager);
     }
     



---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message