The "less paranoid" is only because I already had checked that rfc1123Format
wasn't used elsewhere, and there where no other locks on DateTool.class. :)

Eventually I intend to move everyone to thread-local and (hopefully)
deprecate the one-parameter format1123 method.  It should be easy for TC 4 &
5 (since only Coyote can use it).  A bit more work for 3.3.

----- Original Message -----
From: "Steve Downey" <[EMAIL PROTECTED]>
To: "Tomcat Developers List" <[EMAIL PROTECTED]>
Sent: Wednesday, September 18, 2002 5:15 AM
Subject: Re: cvs commit:
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf DateTool.java


OK, ignore my last message.

But, it's not just less paranoid. It's more correct. If rfc1123Format were
used elsewhere, the lock on Class.DateTool would not be sufficient.

Actually, refreshing my memory on this bug, synchronization is insufficient.

http://developer.java.sun.com/developer/bugParade/bugs/4228335.html

The upshot is that DateFormats need to be either thread local, or created
new
each time.

On Wednesday 18 September 2002 12:20 am, [EMAIL PROTECTED] wrote:
> billbarker    2002/09/17 21:20:24
>
>   Modified:    util/java/org/apache/tomcat/util/buf DateTool.java
>   Log:
>   A little less paraniod than the last one, but functionally the same.
>
>   Revision  Changes    Path
>   1.7       +6 -2
>
jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/DateTool.jav
>a
>
>   Index: DateTool.java
>   ===================================================================
>   RCS file:
>
/home/cvs/jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf/Da
>teTool.java,v retrieving revision 1.6
>   retrieving revision 1.7
>   diff -u -r1.6 -r1.7
>   --- DateTool.java 18 Sep 2002 03:50:04 -0000 1.6
>   +++ DateTool.java 18 Sep 2002 04:20:24 -0000 1.7
>   @@ -141,8 +141,12 @@
>        // Called from MessageBytes.setTime
>        /**
>         */
>   -    public static synchronized String format1123( Date d ) {
>   - return format1123(d, rfc1123Format);
>   +    public static String format1123( Date d ) {
>   + String dstr=null;
>   + synchronized(rfc1123Format) {
>   +     dstr = format1123(d, rfc1123Format);
>   + }
>   + return dstr;
>        }
>
>        public static String format1123( Date d,DateFormat df ) {


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


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

Reply via email to