You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hc.apache.org by "Daniel Müller (JIRA)" <ji...@apache.org> on 2007/06/10 15:50:25 UTC

[jira] Created: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

DateUtils should cache SimpleDateFormat
---------------------------------------

                 Key: HTTPCORE-79
                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
             Project: HttpComponents Core
          Issue Type: Improvement
          Components: HttpCore
    Affects Versions: 4.0-alpha5
            Reporter: Daniel Müller
            Priority: Minor


DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505593 ] 

Roland Weber commented on HTTPCORE-79:
--------------------------------------

You noticed that FastDateFormat is for formatting only, not for parsing?
Since this is obviously a case where multiple implementations are available and have different advantages/drawbacks, maybe it is time to define an interface and make DateUtils - in it's current form - the default implementation. Optimizing static helper methods without a specified target environment is soooooo ugly.

cheers,
  Roland


> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-79:
--------------------------------------

    Fix Version/s: 4.0-alpha5

> Can we please wrap the map in a SoftReference to allow garbage collection?

Sounds reasonable.

Oleg

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-79:
--------------------------------------

    Fix Version/s:     (was: 4.0-alpha5)
                   4.0-beta1

Will deal with it post-ALPHA5.

Oleg

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503186 ] 

Oleg Kalnichevski commented on HTTPCORE-79:
-------------------------------------------

I personally tend to avoid usingthreadlocals in libraries but in this case it seems justified. If I hear no objections, I'll commit the patch

Oleg

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Daniel Müller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505591 ] 

Daniel Müller commented on HTTPCORE-79:
---------------------------------------

I searched for alternative approaches and digged up a FastDateFormat in commons.lang[1], which is fully threadsafe. Maybe http-core could use this one. I don't propose to introduce commons.lang as a dependency, but simply to incorporate the FastDateFormat (partial or whole) as a util into http-core. The code has no dependencies on the rest of commons.lang (only one call to Validate).

Just some thoughts,
Daniel

[1] http://jakarta.apache.org/commons/lang/api/org/apache/commons/lang/time/FastDateFormat.html

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Moved: (HTTPCLIENT-659) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski moved HTTPCORE-79 to HTTPCLIENT-659:
------------------------------------------------------

        Fix Version/s:     (was: 4.0-alpha5)
                       4.0 Alpha 2
          Component/s:     (was: HttpCore)
                       HttpCookie
    Affects Version/s:     (was: 4.0-alpha5)
                  Key: HTTPCLIENT-659  (was: HTTPCORE-79)
              Project: HttpComponents HttpClient  (was: HttpComponents Core)

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCLIENT-659
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-659
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpCookie
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0 Alpha 2
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Daniel Müller (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Daniel Müller updated HTTPCORE-79:
----------------------------------

    Attachment: org.apache.http.util.patch

the patch introduces a package locale SimpleDateFormatFactory which does cache instances of SimpleDateFormat threadlocal

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCLIENT-659) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCLIENT-659:
-----------------------------------------

    Attachment: 20071018-001-dateutils.patch

A small variation on the Daniel's original patch. HashMaps containing date format instances are now softly referecned by the thread local to allow for their garbage-collection. Please review.

If I hear no complaints, I'll check in the patch in a few days.

Oleg  
 

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCLIENT-659
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-659
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpCookie
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0 Alpha 2
>
>         Attachments: 20071018-001-dateutils.patch, org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505597 ] 

Roland Weber commented on HTTPCORE-79:
--------------------------------------

I've taken a look at FastDateFormat. It maintains several internal caches in form of static HashMaps.
I'd hate to introduce that as a default anywhere in HttpComponents.

Moving DateUtils to HttpClient/Cookie sounds good. There we can take as many stabs at it as we want to.

cheers,
  Roland


> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Resolved: (HTTPCLIENT-659) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCLIENT-659?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski resolved HTTPCLIENT-659.
------------------------------------------

    Resolution: Fixed

Patch checked in

Oleg

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCLIENT-659
>                 URL: https://issues.apache.org/jira/browse/HTTPCLIENT-659
>             Project: HttpComponents HttpClient
>          Issue Type: Improvement
>          Components: HttpCookie
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0 Alpha 2
>
>         Attachments: 20071018-001-dateutils.patch, org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12503188 ] 

Roland Weber commented on HTTPCORE-79:
--------------------------------------

If there are many threads making few calls each to this method, we are opening a memory hole. In particular since a whole map of formats is stored. Can we please wrap the map in a SoftReference to allow garbage collection?

There is an @Override in the source code, and not inside a comment. I don't know what it's supposed to mean, but it is not valid Java 1.3 source.

cheers,
  Roland



> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505596 ] 

Oleg Kalnichevski commented on HTTPCORE-79:
-------------------------------------------

Folks,
In fact the static methods of DateUtils are not being used in HttpCore AT ALL. HttpDateGenerator imports a few static variables from DateUtils, but that is it.

this.dateformat = new SimpleDateFormat(DateUtils.PATTERN_RFC1123, Locale.US);
this.dateformat.setTimeZone(DateUtils.GMT);

(1) I suggest DateUtils gets moved to HttpClient
(2) I am in favor of using ThreadLocals and SoftReferences to cache DateFormatters, but will not stand in your way should you decide to 'borrow' FastDateFormat from Commons Lang as long as it is not in Core

Oleg

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Ortwin Glück (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505592 ] 

Ortwin Glück commented on HTTPCORE-79:
--------------------------------------

I support the FastDateFormat approach. It solves the threadsafety problem in a much more elegant way.

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Roland Weber (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505595 ] 

Roland Weber commented on HTTPCORE-79:
--------------------------------------

Hello Daniel,

target _environment_ is...
a) client HTTP application, few threads, few operations -> current implementation is fine
b) server application, few threads, many operations -> full per-thread caching is fine
c) server application, many threads, few operations -> current implementation not so good, full caching not so good either
d) ....

Within HttpCore, only formatting should be required. Date parsing is for cookies. So maybe reduce DateUtils to formatting only, based on FastDateFormat. Date parsing goes to HttpCookie and gets an interface for substituting different implementations.

cheers,
  Roland

 

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Updated: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Oleg Kalnichevski (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Oleg Kalnichevski updated HTTPCORE-79:
--------------------------------------

    Fix Version/s:     (was: 4.0-beta1)
                   4.0-alpha5

This needs to be done before the code freeze for ALPHA5. Folks, if I hear no laud objections, I'll move DateUtils to HttpCookie within the next few days.

Oleg 

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-alpha5
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org


[jira] Commented: (HTTPCORE-79) DateUtils should cache SimpleDateFormat

Posted by "Daniel Müller (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HTTPCORE-79?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12505594 ] 

Daniel Müller commented on HTTPCORE-79:
---------------------------------------

Yes, saw it. Unfortunately after I sent of the comment. So much for prudent investigation methods. I'll have a look if I can come up with something.

And for the specified target environment: I guess this would be parsing and formatting of the three required formats:
- RFC 1123 (EEE, dd MMM yyyy HH:mm:ss zzz)
- RFC1036 (EEEE, dd-MMM-yy HH:mm:ss zzz)
- ascitime() (EEE MMM d HH:mm:ss yyyy)

Cheers,
Daniel

> DateUtils should cache SimpleDateFormat
> ---------------------------------------
>
>                 Key: HTTPCORE-79
>                 URL: https://issues.apache.org/jira/browse/HTTPCORE-79
>             Project: HttpComponents Core
>          Issue Type: Improvement
>          Components: HttpCore
>    Affects Versions: 4.0-alpha5
>            Reporter: Daniel Müller
>            Priority: Minor
>             Fix For: 4.0-beta1
>
>         Attachments: org.apache.http.util.patch
>
>
> DateUtils create a SimpleDateFormat for each invocation of #formatDate and #parseDate. This can be optimized if SimpleDateFormat instances are cached. Since SimpleDateFormat is not threadsafe, the cache must be threadlocal.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: httpcomponents-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: httpcomponents-dev-help@jakarta.apache.org