JDK-8074023: Clock.system(ZoneId) could be optimized to always return the same clock for a given zone

Roger Riggs Roger.Riggs at Oracle.com
Thu Apr 23 20:33:54 UTC 2015


Hi Peter,

The defaultTimeZone is cached in java.util.TimeZone the first time it is 
referenced
and is not updated after that.  See java.util.TimeZone.getDefaultRef().

Regards, Roger


On 4/23/2015 4:11 PM, Peter Levart wrote:
>
>
> On 04/23/2015 09:53 PM, nadeesh tv wrote:
>> Hi all,
>>
>> Please review this minor change which  optimized 
>> Clock.systemDefaultZone() and Clock.system(ZoneId)  to avoid creating 
>> new instance of Clock.SystemClock every time they are called.
>>
>> Bug ID :  https://bugs.openjdk.java.net/browse/JDK-8074023
>>
>> Webrev : http://cr.openjdk.java.net/~rriggs/nadeesh-tv-8074023/
>>
>
> Hi Nadeesh,
>
> What happens if ZondeId.systemDefault() changes 
> (TimeZone.setDefault()) *after* Clock class has already been initialized?
>
> Regards, Peter
>




More information about the core-libs-dev mailing list