billbarker    02/04/29 21:37:28

  Modified:    src/share/org/apache/tomcat/core Container.java
  Log:
  Thread-safety check that we actually have the Hook.
  
  Under high load, it is possible for one thread to ask for a Hook before it has been 
created by another thread.  Since null is not a valid return value here, check for it 
first.
  
  Fix for bug #7770.
  Reported By: Hans Schmid [EMAIL PROTECTED]
  
  Revision  Changes    Path
  1.54      +10 -0     jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java
  
  Index: Container.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat/src/share/org/apache/tomcat/core/Container.java,v
  retrieving revision 1.53
  retrieving revision 1.54
  diff -u -r1.53 -r1.54
  --- Container.java    17 Aug 2001 04:02:54 -0000      1.53
  +++ Container.java    30 Apr 2002 04:37:28 -0000      1.54
  @@ -468,6 +468,16 @@
       public BaseInterceptor[] getInterceptors( int type )
       {
        if( hooksCache != null ) {
  +         if( hooksCache[type] == null ) {
  +             Container gContainer = getContextManager().getContainer();
  +             Hooks gHooks = gContainer.getHooks();
  +             if( this != gContainer ) {
  +                 hooksCache[type] = mergeHooks(gHooks.getModules(type),
  +                                               getHooks().getModules(type));
  +             } else {
  +                 hooksCache[type] = mergeHooks(gHooks.getModules(type), null);
  +             }
  +         }
            return hooksCache[type];
        }
   
  
  
  

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

Reply via email to