tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Barker" <wbar...@wilshire.com>
Subject Re: cvs commit: jakarta-tomcat-connectors/util/java/org/apache/tomcat/util/buf DateTool.java
Date Wed, 18 Sep 2002 18:37:05 GMT
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" <steve.downey@netfolio.com>
To: "Tomcat Developers List" <tomcat-dev@jakarta.apache.org>
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, billbarker@apache.org 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:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


--
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