I'm working on a new feature on my app that require updated timezone information (including daylight saving).
I understand that the time zone information data (tzdb) is stored inside the JVM. So I need to update my JRE to have updated time zone info. One way to do that is using the TZ Updater tool but requires restart. I need to update the tzdb “hot”, without a restart of the JVM.
For some time zones, we know the daylight saving change some days before the starts of Ramadan. See example of Morocco on this page.
It's not possible to do production deployment so fast when a new TZ data released.
My question is : Is there any way to hot update TZ / DST information on Spring Boot application?
I'm working on a Spring Boot application deployed on Kubernetes. The container image of my app is generated using jib, with Adoptium JDK as base image.
Finally i forget about hot update, maybe it's a Java limitation.
To update tz data on production without upgrading base code or JVM, we will download a compiled tzdb.dat file (like proposed on this github repo) and after this replace the file like this on the production image and push a new image with tag like this myapp:1.0.0+tzdb2024a
cd /opt/java/openjdk/lib
wget https://github.com/jeremywall/java-tzdb-builder/raw/main/releases/2024a/tzdb2024a.dat
mv tzdb2024a.dat tzdb.dat
I think it's better to just update the jdk base image but in production context it's not always possible to do this so fast.