Scrivio Interview library
ScenarioAdvanced6 min read · updated 12 November 2026

Your organisation is on Java 21. Build the case for or against moving the fleet to Java 25 within a year, and describe how you would decide.

The case for moving is strong: no virtual thread pinning in synchronized, final scoped values, compact object headers, the Foreign Function and Memory API and stream gatherers, and faster startup from the AOT cache. The risks are dependency readiness, the permanently disabled Security Manager, warnings for sun.misc.Unsafe memory access, and the removal of the 32-bit x86 port where that still matters. I would decide with data: check vendor support timelines for 21 and 25 to pick the window, pilot representative services and compare latency, memory and startup, and gate each wave on the readiness of Spring Boot, build plugins and agents.

Why this question is asked

Java 21 is a good, supported release, so there is no emergency, and that is exactly what makes this a leadership decision rather than a forced one. Interviewers ask it to see whether we can build a balanced case with real gains and real risks, and turn it into a decision process that the organisation can follow. In this answer, we will list what 25 gives over 21, what can go wrong, how support timelines shape the window, how to run a pilot that produces evidence, and how to roll out based on framework readiness.

1What Java 25 Gives Over 21

Four years of releases come together in 25. For services using virtual threads, JDK 24 removed most carrier pinning in synchronized blocks, which was the main operational caveat on 21. Scoped values became final, giving a safer way to pass request context than ThreadLocal. Compact object headers are a product feature in 25 and can reduce heap use for object-heavy services. The Foreign Function and Memory API, final since 22, replaces JNI and Unsafe for native and off-heap work, and stream gatherers, final since 24, add custom intermediate operations to streams.

Startup also improves. The AOT cache from JDK 24 and 25 can cut Spring Boot startup and warm-up noticeably, which matters for autoscaling and deployments. Smaller improvements, such as unnamed variables, flexible constructor bodies and module imports, make code a little cleaner.

2What Can Go Wrong

The main risk is the dependency stack. Every service depends on a framework, build tools, bytecode libraries, agents for monitoring and security scanning, and test tools, and each needs a version that supports Java 25's class file format and runtime. A single old agent that does not understand the new class files can block a whole group of services.

There are also specific breaking changes. The Security Manager is permanently disabled since JDK 24, so anything that relies on it fails. The memory access methods of sun.misc.Unsafe print warnings by default since JDK 24 and are on the path to removal, which affects older versions of serialisation and caching libraries. The 32-bit x86 port was removed in JDK 25, which matters only if we still run on such hardware or embedded devices. And integrity by default means dynamic agent loading and JNI use print warnings unless allowed explicitly.

The case in one view
AreaGain with 25Risk to check
Virtual threadsNo pinning in synchronizedNone; re-test with JFR
MemoryCompact object headers by flagAgents assuming object layout
StartupAOT cache, faster warm-upCache must match JDK and jars
APIsScoped values, FFM, gatherersTeams need time to learn them
CompatibilitySupported APIs onlySecurity Manager, Unsafe warnings, x86-32
DependenciesCurrent versionsSpring Boot, plugins, agents readiness

3Using Support Timelines to Pick the Window

An LTS release is supported by vendors for years, but the timelines differ by vendor and by support tier, so we check the ones we actually use, such as Oracle, Eclipse Temurin, Amazon Corretto, Azul or Red Hat. Java 21 is typically supported for several more years, which means we are not forced to move within a year. Java 25 has just started its support period, so moving early gives us the longest time on one release.

The timelines also tell us the latest sensible date. If our vendor's free updates for 21 end at a given date, we want the fleet off 21 with a comfortable margin, perhaps a year. Between now and then, the question is when the benefits outweigh the migration cost, which the pilot answers.

4A Pilot That Produces Evidence

Arguments about JDK versions are settled by measurement. We pick five to ten representative services: a high-traffic Spring Boot API, a service with virtual threads, a batch job, a Kafka consumer, one with heavy caches and one with native libraries. Each runs on 25 in a staging environment under replayed or synthetic production load, side by side with its 21 version and the same container limits.

Java
# Same image apart from the JDK; same load test for both
JDK 21: p99 latency 182 ms, live heap 1.42 GB, startup 6.8 s, CPU 61%
JDK 25: p99 latency 171 ms, live heap 1.21 GB, startup 3.9 s, CPU 58%
(25 with -XX:+UseCompactObjectHeaders and an AOT cache; example numbers)

Notice that the numbers make the case concrete, or show that there is none for a given service. We also collect the practical problems: which dependencies needed upgrades, which flags changed, which warnings appeared. That list becomes the migration guide for every other team.

5Deciding by Framework Readiness

The decision is not one date for the whole fleet. It is gated per stack. For Spring Boot services, we wait until the Boot line we use officially supports Java 25 and its dependencies, such as Hibernate, Jackson and the Kafka client, are compatible; check your version's support matrix. Build plugins, such as Maven compiler, surefire and JaCoCo or the Gradle version, must support the release, and so must every agent in the images.

So my recommendation would usually be: move within the year, in waves, once the pilot shows gains and the main stacks are ready. The first wave is the services with the newest dependencies and the biggest expected gain, such as those using virtual threads. Services with old frameworks follow when their framework is ready, and the platform team publishes 25 base images and keeps 21 images available until the last wave finishes.

Step throughDeciding the move from 21 to 25
  1. Check vendor support for 21 and 25Sets the latest sensible date
  2. Pilot representative servicesCompare latency, memory, startup
  3. Clear gains and no blockers?
    YesPlan waves within the yearNoStay on 21, re-check in six months
  4. Framework, plugins, agents ready?
    YesMove the stack's servicesNoWait for that stack
  5. Retire 21 base imagesAfter the last wave

5 steps in order. Play them, or step through them one at a time.

6Follow-up questions

What if the pilot shows no measurable gain?

Then the reason to move is mostly long-term: a longer support window and staying close to current releases so the next upgrade is small. We can still move, but with less urgency, perhaps aligning the upgrade with other planned work.

Would you skip 25 and wait for the next LTS?

Generally no. Skipping makes the next jump bigger, with more changes at once. Since LTS releases now come every two years, moving to each one keeps upgrades routine.

How do you handle teams that cannot upgrade in time?

Give them a supported 21 base image and a date, and help them with the blocking dependency. A small number of services on an older LTS is fine as long as it is still in support and the list is shrinking.

7Conclusion

In this answer, we built the case for moving from 21 to 25: no virtual thread pinning in synchronized, scoped values, compact headers, FFM and gatherers final, and faster startup with the AOT cache, against the risks of dependency readiness, the disabled Security Manager, Unsafe warnings and the removed 32-bit x86 port. We used vendor support timelines to pick the window, a pilot with representative services to produce evidence, and per-stack framework readiness to schedule the waves.

What to say in the interviewAbout 90 seconds aloud

Open with

I would make the case with evidence rather than opinion. On the gain side, 25 brings things that matter to us: JDK 24 removed most virtual thread pinning in synchronized blocks, which was the big caveat on 21; scoped values are final; compact object headers can reduce heap; the FFM API and stream gatherers are final; and the AOT cache improves startup and warm-up for Spring Boot.

Then, if they want more

On the risk side: every framework, build plugin and agent must support 25; the Security Manager is permanently disabled; Unsafe memory access methods now warn, which hits older libraries; and the 32-bit x86 port is gone, which matters only if we still run it. To decide, I would first check our vendor's support timelines for 21 and 25.

That shows we are not forced to move this year, but also when we must be done. Then I would pilot five to ten representative services under the same load on 21 and 25, comparing p99 latency, live heap, startup and CPU, and record every dependency change needed.

If the pilot shows clear gains and no blockers, I would plan waves within the year, gated by stack readiness, especially the Spring Boot line, build plugins and agents. Services with the newest dependencies and biggest gains go first, and we keep 21 base images until the last wave finishes.

About this answer

Last updated
12 November 2026
Versions it names
Java 25, Java 24, Java 21
Checked
Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the documentation below. What the checks cover
Where the question comes from
Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer

Copy the line below and send it to the author with what you found. It carries the address of this page.

Issue with "Your organisation is on Java 21. Build the case for or against moving the fleet to Java...": https://scrivio-interview-library.netlify.app/java/java-versions/5c42c583a2/