lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Shai Erera (JIRA)" <>
Subject [jira] Commented: (LUCENE-1653) Change DateTools to not create a Calendar in every call to dateToString or timeToString
Date Wed, 27 May 2009 04:26:45 GMT


Shai Erera commented on LUCENE-1653:

What I had in mind when I synced it was: (1) consistency of the API - all the methods are
synced, so you don't need to ask yourself why is method A synced and B not, and do I need
to sync B and (2) if we leave it not synced and in the future its impl changes to not call
round(), someone might forget to sync it.

Anyway, those two are not so important. Since we're both on the fence, and you'll be the one
committing it, I'll let you make the call :)

If you decide to remove the sync, I can either post a new patch, or you can apply the current
one and remove the sync before committing. Again ... your call :)

> Change DateTools to not create a Calendar in every call to dateToString or timeToString
> ---------------------------------------------------------------------------------------
>                 Key: LUCENE-1653
>                 URL:
>             Project: Lucene - Java
>          Issue Type: Improvement
>          Components: Other
>            Reporter: Shai Erera
>            Priority: Minor
>             Fix For: 2.9
>         Attachments: LUCENE-1653.patch
> DateTools creates a Calendar instance on every call to dateToString and timeToString.
> # timeToString calls Calendar.getInstance on every call.
> # dateToString calls timeToString(date.getTime()), which then instantiates a new Date().
I think we should change the order of the calls, or not have each call the other.
> # round(), which is called from timeToString (after creating a Calendar instance) creates
another (!) Calendar instance ...
> Seems that if we synchronize the methods and create the Calendar instance once (static),
it should solve it.

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:
For additional commands, e-mail:

View raw message