horwat      2002/08/09 09:58:43

  Modified:    coyote/src/java/org/apache/coyote/tomcat5 CoyoteRequest.java
  Log:
  Synchronization is unnecessary since requests are per-thread.
  
  Submitted by: Bill Barker
  
  Revision  Changes    Path
  1.3       +25 -23    
jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java
  
  Index: CoyoteRequest.java
  ===================================================================
  RCS file: 
/home/cvs/jakarta-tomcat-connectors/coyote/src/java/org/apache/coyote/tomcat5/CoyoteRequest.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- CoyoteRequest.java        9 Aug 2002 02:10:10 -0000       1.2
  +++ CoyoteRequest.java        9 Aug 2002 16:58:43 -0000       1.3
  @@ -1151,17 +1151,17 @@
           boolean found = false;
   
           // Remove the specified attribute
  -        synchronized (attributes) {
  -            // Check for read only attribute
  -           if (readOnlyAttributes.containsKey(name))
  -                return;
  -            found = attributes.containsKey(name);
  -            if (found) {
  -                value = attributes.get(name);
  -                attributes.remove(name);
  -            } else {
  -                return;
  -            }
  +        // Check for read only attribute
  +        // requests are per thread so synchronization unnecessary
  +        if (readOnlyAttributes.containsKey(name)) {
  +            return;
  +        }
  +        found = attributes.containsKey(name);
  +        if (found) {
  +            value = attributes.get(name);
  +            attributes.remove(name);
  +        } else {
  +            return;
           }
   
           // Notify interested application event listeners
  @@ -1209,15 +1209,17 @@
           boolean replaced = false;
   
           // Add or replace the specified attribute
  -        synchronized (attributes) {
  -            // Check for read only attribute
  -            if (readOnlyAttributes.containsKey(name))
  -                return;
  -            oldValue = attributes.get(name);
  -            if (oldValue != null)
  -                replaced = true;
  -            attributes.put(name, value);
  +        // Check for read only attribute
  +        // requests are per thread so synchronization unnecessary
  +        if (readOnlyAttributes.containsKey(name)) {
  +            return;
  +        }
  +        oldValue = attributes.get(name);
  +        if (oldValue != null) {
  +            replaced = true;
           }
  +
  +        attributes.put(name, value);
   
           // Notify interested application event listeners
           Object listeners[] = context.getApplicationListeners();
  
  
  

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

Reply via email to