You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@avalon.apache.org by do...@apache.org on 2002/04/26 05:39:47 UTC

cvs commit: jakarta-avalon-excalibur/threadcontext/src/java/org/apache/excalibur/threadcontext LayeredThreadContext.java

donaldp     02/04/25 20:39:47

  Modified:    threadcontext/src/java/org/apache/excalibur/threadcontext
                        LayeredThreadContext.java
  Log:
  Correctly cache the thread associated with context
  
  Revision  Changes    Path
  1.4       +7 -5      jakarta-avalon-excalibur/threadcontext/src/java/org/apache/excalibur/threadcontext/LayeredThreadContext.java
  
  Index: LayeredThreadContext.java
  ===================================================================
  RCS file: /home/cvs/jakarta-avalon-excalibur/threadcontext/src/java/org/apache/excalibur/threadcontext/LayeredThreadContext.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- LayeredThreadContext.java	10 Apr 2002 10:51:26 -0000	1.3
  +++ LayeredThreadContext.java	26 Apr 2002 03:39:47 -0000	1.4
  @@ -66,7 +66,7 @@
   
       /**
        * This variable is set to the thread that the ThreadContext
  -     * is currently active on. A ThreadContext can not be active 
  +     * is currently active on. A ThreadContext can not be active
        * on multiple threads at the same time.
        */
       private Thread m_activeThread;
  @@ -102,12 +102,12 @@
   
           if( threadContext.isActive() )
           {
  -            throw new IllegalArgumentException( "Specified ThreadContext is already " + 
  +            throw new IllegalArgumentException( "Specified ThreadContext is already " +
                                                   "bound to a thread" );
           }
   
           final LayeredThreadContext oldThreadContext = (LayeredThreadContext)c_context.get();
  -        if( null != oldThreadContext ) 
  +        if( null != oldThreadContext )
           {
               oldThreadContext.deactivate();
           }
  @@ -285,6 +285,7 @@
       private void activate()
       {
           m_policy.activate( m_accessor );
  +        m_activeThread = Thread.currentThread();
       }
   
       /**
  @@ -292,13 +293,14 @@
        */
       private void deactivate()
       {
  +        m_activeThread = null;
           m_policy.deactivate( m_accessor );
       }
   
       /**
        * Class that manages inheritance of ThreadContext between threads.
        */
  -    private static class CloningInheritableThreadLocal 
  +    private static class CloningInheritableThreadLocal
           extends InheritableThreadLocal
       {
           protected Object childValue( final Object parentValue )
  @@ -311,7 +313,7 @@
       /**
        * Inner class to offer accessor interface to policy object.
        */
  -    private class InnerThreadContextAccessor 
  +    private class InnerThreadContextAccessor
           implements ThreadContextAccessor
       {
           public boolean containsKey( final String key )
  
  
  

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>