harishkswamy    2004/03/01 20:34:00

  Modified:    hivemind/framework/src/java/org/apache/hivemind/service/impl
                        ThreadLocalStorageImpl.java
  Log:
  Modified the INITIALIZED_KEY to reduce the chance of a conflict.
  
  Revision  Changes    Path
  1.3       +6 -5      
jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/service/impl/ThreadLocalStorageImpl.java
  
  Index: ThreadLocalStorageImpl.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-commons-sandbox/hivemind/framework/src/java/org/apache/hivemind/service/impl/ThreadLocalStorageImpl.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- ThreadLocalStorageImpl.java       1 Mar 2004 15:32:39 -0000       1.2
  +++ ThreadLocalStorageImpl.java       2 Mar 2004 04:34:00 -0000       1.3
  @@ -29,7 +29,8 @@
    */
   public class ThreadLocalStorageImpl implements ThreadLocalStorage, 
ThreadCleanupListener
   {
  -    private static final String  INITIALIZED_KEY = "initialized";
  +    private static final String  INITIALIZED_KEY = 
  +        "$org.apache.hivemind.service.impl.ThreadLocalStorageImpl#initialized$";
   
       private CleanableThreadLocal _local          = new CleanableThreadLocal();
       private ThreadEventNotifier  _notifier;
  @@ -43,15 +44,15 @@
            * register the listener with [EMAIL PROTECTED] ThreadEventNotifier}.
            * <p>
            * The registration cannot be done from here because it may get lost once 
the caller method (
  -         * [EMAIL PROTECTED] ThreadLocal#get()} or [EMAIL PROTECTED] 
ThreadLocal#set(java.lang.Object)} completes, if
  +         * [EMAIL PROTECTED] ThreadLocal#get()}or [EMAIL PROTECTED] 
ThreadLocal#set(java.lang.Object)}completes, if
            * this was the first ThreadLocal variable access for the Thread.
            */
           protected Object initialValue()
           {
               // NOTE: This is a workaround to circumvent the ThreadLocal behavior.
  -            // It would be easier if the implementation of ThreadLocal.get() 
checked for 
  +            // It would be easier if the implementation of ThreadLocal.get() 
checked for
               // the existence of the thread local map, after initialValue() is 
evaluated,
  -            // and used it instead of creating a new map always after 
initialization (possibly 
  +            // and used it instead of creating a new map always after 
initialization (possibly
               // overwriting any variables created from within 
ThreadLocal.initialValue()).
   
               Map map = new HashMap();
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to