[ 
https://issues.apache.org/jira/browse/TIKA-864?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jukka Zitting updated TIKA-864:
-------------------------------

    Summary: Metadata.formatDate causes blocking in concurrent use  (was: 
Metadata.formatDate should use ThreadLocal)

bq. threads were very often blocked on a few sync blocks, among others on this 
one and the one in TIKA-865.

Reason enough for me, thanks for the background.

I updated the issue summary to identify the problem to be solved instead of a 
proposed solution. Using ThreadLocals is troublesome as already mentioned by 
Nick.

bq. Joda-Time

I'm not too excited about adding extra dependencies to tika-core. In TIKA-495 
(which led to the use of a synchronized static variable) the FastDateFormat 
class from Commons Lang was considered as an alternative, but also there the 
overhead of an extra dependency (or embedding just that class) was a problem.

The formatDate() contract is pretty straightforward, so perhaps the best 
solution here is
just to add a bit of custom code that formats the requested string directly 
from the given
date object without needing extra formatter classes.
                
> Metadata.formatDate causes blocking in concurrent use
> -----------------------------------------------------
>
>                 Key: TIKA-864
>                 URL: https://issues.apache.org/jira/browse/TIKA-864
>             Project: Tika
>          Issue Type: Improvement
>          Components: metadata
>            Reporter: Andrzej Bialecki 
>
> Currently this is a synchronized method that uses a single instance of 
> DateFormat. Instead it could use a pool of ThreadLocal DateFormat instances 
> and avoid the sync blocking.

--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: 
https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira

        

Reply via email to