TimeZone.setDefault changes in JDK6

后端 未结 3 550
不知归路
不知归路 2020-12-06 00:44

I just noticed that JDK 6 has a different approach to setting a default TimeZone than JDK5.

Previously the new default would be stored in a thread-local variable. W

3条回答
  •  感情败类
    2020-12-06 01:25

    The API documentation for TimeZone.getDefault() states that "the source of the default TimeZone may vary with implementation." If your code relies on implementation specific behaviour of the standard API classes (in this case, that the default time zone is kept at a thread local level), you must expect that your code fails with newer versions of the VM or with VMs from different vendors.

提交回复
热议问题