是否可能以及如何在 Cloud Foundry 中更新 JDK

Is It Possible and How to Update the JDK in Cloud Foundry

我在 SAP Cloud Platform 中有一个 Java 服务 运行ning,它使用 java.util.TimeZone 库进行时区转换。但是最近我知道时区转换规则可能会改变,例如中欧时区可能有一天会从UTC+01:00更改为UTC+02:00。我知道这可能不会在数百年内发生,但有可能。如果发生这种情况,我的服务中的数据可能是错误的。

Oracle 有一个时区更新工具 (http://www.oracle.com/technetwork/java/javase/tzupdater-readme-136440.html),它可以用最近的时区数据更新 JDK。要 运行 我必须:

  1. 停止所有 运行ning JDK/JRE 个实例。

  2. 运行 命令“java -jar tzupdater.jar 选项”作为管理员。

我的问题是:

  1. 难道Foundry已经考虑过这样的问题了?如果是,我应该怎么做才能使用这个功能?

  2. 我可以在 Cloud Foundry 中为我的服务更新 JDK 吗?如果是,如何?

非常感谢!

  1. Does Could Foundry already considered such problems? If yes, what should I do to use this feature?

在某种程度上是的。 Cloud Foundry,通过它的 Java Build Pack,将使您的 JVM 保持最新。根据您提供的 link 的以下声明,这是获取最新时区数据的首选方式。

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 pushcf restage 您的应用程序。这将导致构建包 运行 并生成一个带有最新 JVM 的新 Droplet。

  1. Is it possible for me to update the JDK in Cloud Foundry for my service? If yes, how?

是的。通过构建包。 Java 构建包负责安装 JVM。它将选择暂存时可用的最新版本(除非您另有说明)。因此,要更新您的 JVM,您只需重新暂存您的应用程序。