我有一个在 SAP Cloud Platform 中运行的 Java 服务,它使用 java.util.TimeZone 库来进行时区转换。但最近我知道时区转换规则可能会发生变化,例如中欧时区有一天可能会从 UTC+01:00 更改为 UTC+02:00。我知道这也许几百年后不会发生,但有可能。如果发生这种情况,我的服务中的数据可能是错误的。
Oracle 有一个时区更新工具 ( http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html ),它能够使用最新的时区数据更新 JDK。要运行它,我必须:
停止所有正在运行的 JDK/JRE 实例。
以管理员身份运行命令“java -jar tzupdater.jar options”。
我的问题是:
Foundry 是否已经考虑过此类问题?如果是,我应该怎么做才能使用这个功能?
我可以为我的服务更新 Cloud Foundry 中的 JDK 吗?如果是,怎么办?
非常感谢!
最佳答案
- Does Could Foundry already considered such problems? If yes, what should I do to use this feature?
在某种程度上是的。 Cloud Foundry 通过其 Java Build Pack 将使您的 JVM 保持最新状态。根据您包含的链接中的以下声明,这是获取最新时区数据的首选方式。
Oracle recommends that you use the latest Oracle Java SE platform JDK or JRE update release as the preferred means of delivering both timezone data updates and other product improvements, such as security fixes.
http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html#introduction
要确保 JVM 保持最新状态,您所需要做的就是定期 cf Push
或 cf resstage
您的应用程序。这将导致构建包运行并生成一个带有最新 JVM 的新 Droplet。
- Is it possible for me to update the JDK in Cloud Foundry for my service? If yes, how?
是的。通过构建包。 Java 构建包负责安装 JVM。它会选择暂存时可用的最新版本(除非您另有说明)。因此,要更新 JVM,您只需重新暂存您的应用程序。
关于java - 是否可以以及如何更新 Cloud Foundry 中的 JDK,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43514272/