[logback-dev] [JIRA] Issue Comment Edited: (LBCLASSIC-36) Synchronization of SimpleDateFormat object in DateConverter

Ralph Goers (JIRA) noreply-jira at qos.ch
Tue Jun 16 19:59:10 CEST 2009


    [ http://jira.qos.ch/browse/LBCLASSIC-36?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=11192#action_11192 ] 

Ralph Goers edited comment on LBCLASSIC-36 at 6/16/09 7:57 PM:
---------------------------------------------------------------

My concern is not only about the performance. It is reducing or, preferably, eliminating the locking that is required to the very minimum. So instead of assuming that the lock is held while the layout is processed, layout processing should be changed to only lock where absolutely necessary. If using Joda-time instead of SDF can completely eliminate locking while processing the layout I find that as extremely beneficial. But if the locking scope is reduced to just encapsulate the date formatting that would be much better than it currently is.

      was (Author: rgoers at apache.org):
    My concern is not about the performance. It is reducing or, preferably, eliminating the locking that is required to the very minimum. So instead of assuming that the lock is held while the layout is processed, layout processing should be changed to only lock where absolutely necessary. If using Joda-time instead of SDF can completely eliminate locking while processing the layout I found view that as extremely beneficial. But if the locking scope is reduced to just encapsulate the date formatting that would be much better than it currently is.
  
> Synchronization of SimpleDateFormat object in DateConverter
> -----------------------------------------------------------
>
>                 Key: LBCLASSIC-36
>                 URL: http://jira.qos.ch/browse/LBCLASSIC-36
>             Project: logback-classic
>          Issue Type: Bug
>          Components: Other
>    Affects Versions: unspecified
>         Environment: Operating System: All
> Platform: All
>            Reporter: Anders Hammar
>            Assignee: Ceki Gulcu
>         Attachments: DateConverter_patch.java, DateFormatPerfTest.java, dateformattest.zip
>
>
> According to the API documentation of SimpleDateFormat, date formats are not synchronized and it is recommended to create separate format instances for each thread.
> However, a possibly simpler (mer efficient) solution would be to synchronize on the SimpleDateFormat object in the convert() method to prevent two threads to access it concurrently.

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators: http://jira.qos.ch/secure/Administrators.jspa
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        


More information about the logback-dev mailing list