You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@jackrabbit.apache.org by "Xiaoming Shi (JIRA)" <ji...@apache.org> on 2011/03/01 03:27:36 UTC

[jira] Created: (JCR-2905) DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance

DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance
------------------------------------------------------------------------------------------

                 Key: JCR-2905
                 URL: https://issues.apache.org/jira/browse/JCR-2905
             Project: Jackrabbit Content Repository
          Issue Type: Bug
          Components: jackrabbit-core
    Affects Versions: 2.2.2
            Reporter: Xiaoming Shi


DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance

In the file:

./jackrabbit-2.2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventJournalImpl.java   line: 356


DateFormat.getDateTimeInstance() is called in a critical section. We can move it outside the critical section to increase the concurrency. It's better for us to add a class member field to store the value.
This is similar to the Apache bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=48778

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

[jira] Updated: (JCR-2905) DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance

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

Thomas Mueller updated JCR-2905:
--------------------------------

      Priority: Minor  (was: Major)
    Issue Type: Wish  (was: Bug)

DateFormat.getDateTimeInstance() is only used if the log level is set to debug:

if (log.isDebugEnabled()) {
    DateFormat df = DateFormat.getDateTimeInstance();
    ...
}

Do you really need to set the log level to debug?

Please note that DateFormat.format would need to be synchronized. Possibly a simpler solution would be:

new java.sql.Timestamp(timestamp.longValue()).toString()

However I'm not sure if this would work correctly (UTF versus local time zone).


> DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance
> ------------------------------------------------------------------------------------------
>
>                 Key: JCR-2905
>                 URL: https://issues.apache.org/jira/browse/JCR-2905
>             Project: Jackrabbit Content Repository
>          Issue Type: Wish
>          Components: jackrabbit-core
>    Affects Versions: 2.2.2
>            Reporter: Xiaoming Shi
>            Priority: Minor
>
> DateFormat.getDateTimeInstance() is very expensive, we can cache it to improve performance
> In the file:
> ./jackrabbit-2.2.2/jackrabbit-core/src/main/java/org/apache/jackrabbit/core/observation/EventJournalImpl.java   line: 356
> DateFormat.getDateTimeInstance() is called in a critical section. We can move it outside the critical section to increase the concurrency. It's better for us to add a class member field to store the value.
> This is similar to the Apache bug: https://issues.apache.org/bugzilla/show_bug.cgi?id=48778

-- 
This message is automatically generated by JIRA.
-
For more information on JIRA, see: http://www.atlassian.com/software/jira