tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject cvs commit: jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/cluster MulticastReceiver.java
Date Wed, 07 Nov 2001 05:20:56 GMT
remm        01/11/06 21:20:56

  Modified:    catalina/src/share/org/apache/catalina/cluster Tag:
                        tomcat_40_branch MulticastReceiver.java
  Log:
  - Fix race condition in MulticastReceiver.getObjects(). stack.add(obj) can be called
    from the receiver thread between the toArray() and the removeAllElement() calls.
    This causes a newly received Session object to be silently ignored.
  - Bug 4684.
  - Patch submitted by Tom Drake <rtd at pobox.com>
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.3.2.1   +9 -8      jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/cluster/MulticastReceiver.java
  
  Index: MulticastReceiver.java
  ===================================================================
  RCS file: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/cluster/MulticastReceiver.java,v
  retrieving revision 1.3
  retrieving revision 1.3.2.1
  diff -u -r1.3 -r1.3.2.1
  --- MulticastReceiver.java	2001/07/22 20:25:06	1.3
  +++ MulticastReceiver.java	2001/11/07 05:20:56	1.3.2.1
  @@ -1,7 +1,7 @@
   /*
  - * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/cluster/MulticastReceiver.java,v
1.3 2001/07/22 20:25:06 pier Exp $
  - * $Revision: 1.3 $
  - * $Date: 2001/07/22 20:25:06 $
  + * $Header: /home/cvs/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/cluster/MulticastReceiver.java,v
1.3.2.1 2001/11/07 05:20:56 remm Exp $
  + * $Revision: 1.3.2.1 $
  + * $Date: 2001/11/07 05:20:56 $
    *
    * ====================================================================
    *
  @@ -84,7 +84,7 @@
    * it onto an internal stack and let it be picked up when needed.
    *
    * @author Bip Thelin
  - * @version $Revision: 1.3 $, $Date: 2001/07/22 20:25:06 $
  + * @version $Revision: 1.3.2.1 $, $Date: 2001/11/07 05:20:56 $
    */
   
   public final class MulticastReceiver
  @@ -187,10 +187,11 @@
        * @return An array with objects
        */
       public Object[] getObjects() {
  -        Object[] objs = stack.toArray();
  -        stack.removeAllElements();
  -
  -        return (objs);
  +        synchronized (stack) {
  +            Object[] objs = stack.toArray();
  +            stack.removeAllElements();
  +            return (objs);
  +        }
       }
   
       /**
  
  
  

--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message