Scrivio Interview library
ConceptPrincipal6 min read · updated 12 November 2026

Thread.stop, suspend and resume were deprecated in Java 1.2, and since Java 20 Thread.stop throws UnsupportedOperationException. Why is cooperative cancellation the long-term model for Java, and what does it imply for system design?

Stopping a thread at an arbitrary instruction can leave shared objects half-updated, and Thread.stop() made it worse by releasing all the thread's locks, so other threads immediately saw the broken state; there was no way to fix that without changing what stop() means. Cooperative cancellation lets the thread stop at points it chooses, through interruption checks and interruptible blocking calls, where its invariants hold. The price is a duty on all code to respond to interruption and bound its blocking, and at system level the same idea appears as deadlines and cancellation propagated between services and as work designed to be stopped and resumed safely.

Background to this question

This question is less about an API and more about a design principle that has shaped Java for twenty-five years. A senior engineer is expected to explain why the platform refused to keep forced stopping, and to carry the same reasoning into the design of services, jobs and workflows. In this answer, we will recap what Thread.stop(), suspend() and resume() did, see exactly how forced stopping corrupts state, look at cooperative cancellation as the replacement, and then follow the principle up to system design: duties on code, deadlines between services, and work that can stop and resume.

1A Quick Recap of stop, suspend and resume

Java 1.0 gave threads three control methods. stop() made the target thread throw a ThreadDeath error at whatever instruction it was executing. suspend() froze a thread in place, and resume() let it continue. All three were deprecated in Java 1.2, only a few years later. They remained in the API for compatibility for a long time, but recent JDKs have degraded them: since Java 20, Thread.stop() throws UnsupportedOperationException, and suspend() and resume() have also been degraded and then removed in recent releases (check your JDK version for the exact release).

2Why Forced Stopping Is Unsafe

Consider a transfer between two accounts, guarded by a lock. The method subtracts from one balance and adds to the other. The invariant, a rule that must always hold, is that the total of the two balances never changes.

Java
synchronized void transfer(Account from, Account to, long amount) {
from.balance -= amount; // ThreadDeath can arrive right here
to.balance += amount;
}
// Before: from = 100, to = 0, total = 100
// stop() arrives after the first line:
// from = 50, to = 0, total = 50 -> money has vanished
Forced versus cooperative stopping
Thread.stop()Interruption
Where the thread stopsAny instructionPoints the code chooses
LocksReleased with state half-updatedReleased after the code restores invariants
CleanupUnreliable, can be interrupted itselfRuns normally in finally blocks
Who decidesThe callerThe thread being stopped
Status todayThrows UnsupportedOperationException (Java 20+)The standard mechanism

If the thread is stopped between the two lines, the money disappears. Worse, ThreadDeath unwinds the stack like any exception, so the thread leaves the synchronized block and releases the lock. Every other thread can now enter and see the broken total, with no warning. The lock that was supposed to protect the invariant is exactly what lets the damage spread.

Could the method defend itself? In theory it could catch ThreadDeath everywhere, but ThreadDeath can arrive at any instruction, including inside the catch block or inside library code, so no code can be written to be safe against it. The problem was the meaning of stop() itself, which is why it could not be fixed, only removed. suspend() had the mirror problem: a thread frozen while holding a lock keeps the lock forever, and if the thread that would call resume() needs that lock, both are stuck in a deadlock.

3Cooperative Cancellation as the Replacement

Interruption replaced forced stopping. Calling t.interrupt() only sets a flag on the thread. The thread notices at safe points it chooses: when it checks Thread.currentThread().isInterrupted() between units of work, or when it is blocked in a method such as sleep(), wait(), join() or BlockingQueue.take(), which throws InterruptedException. In both cases the thread is at a place where its data is consistent, so it can finish the current step or roll it back, release its locks normally and exit.

Java
void transferAll(List<Transfer> batch) throws InterruptedException {
for (Transfer t : batch) {
if (Thread.interrupted()) throw new InterruptedException(); // consume the flag, stop between transfers
transfer(t.from(), t.to(), t.amount()); // each transfer completes or never starts
}
}

So the thread being stopped chooses the moment, and the moment is always between whole operations. That is the essential trade: the caller loses the ability to stop work instantly, and gains the guarantee that stopped work leaves no damage.

4The Duty This Places on All Code

Cooperation only works if everyone cooperates. Every long loop must check the flag, every catch of InterruptedException must restore it or rethrow, and every blocking call must either respond to interruption or have a timeout, because some calls, such as waiting for a synchronized lock or a classic socket read, ignore interruption entirely. One layer that swallows the signal makes the whole call stack unstoppable. This is why interruption handling belongs in code review checklists and shared libraries, not left to each developer's memory.

5The Same Principle Between Services

At system level, we cannot stop a remote service's thread either, and we would not want to for the same reason. Instead we tell it that the work is no longer wanted and let it stop safely. That is what deadlines and cancellation propagation do: each request carries its remaining time budget, each hop sets its timeouts from it, and a cancelled or timed-out caller closes its connection so the downstream service cancels its own tasks. gRPC deadlines and cancellation are a well-known implementation of exactly this idea.

6Designing Work That Can Stop and Resume

The deepest implication is for how we shape work. If work may be stopped at any safe point, it should be made of steps that are safe to stop between and safe to repeat. A batch job processes records in chunks and saves a checkpoint after each chunk, so a stopped job resumes from the last checkpoint instead of starting over. Each step is idempotent, meaning running it twice has the same effect as running it once, for example an upsert keyed by record id instead of a blind insert. A long workflow is a series of persisted states rather than one long method.

Step throughA job built to be cancelled
  1. Load last checkpointresume from chunk 41
  2. Process one chunkidempotent upserts in one transaction
  3. Save checkpointchunk 42 done
  4. Interrupted or deadline passed?
    YesExit cleanly, nothing half doneNoNext chunk

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

7Follow-up questions

Is System.exit() a forced stop with the same problems?

Partly. It does not unwind threads or run their finally blocks, so in-memory state is abandoned, but it also ends the process, so nobody observes the broken objects. The risk is to external state, such as half-written files or messages, which is why durable work still needs transactions, checkpoints and idempotent steps.

What about killing a container or a process?

That is forced stopping at the largest scale, and we cannot prevent it, since machines fail. Cooperative cancellation handles planned stops, and idempotent, checkpointed work handles unplanned ones. Designing for both is what makes systems safe to deploy and to scale down.

Do virtual threads change any of this?

No. Virtual threads use the same interruption mechanism, and Thread.stop() is not supported on them either. Structured concurrency builds on interruption to cancel sibling tasks, so the cooperative model is the foundation of the newer APIs too.

8Conclusion

In this answer, we saw that Thread.stop() could stop a thread at any instruction and released its locks, letting other threads see half-updated state, a flaw that could not be fixed without changing its meaning, so it was deprecated in Java 1.2 and now throws UnsupportedOperationException. Cooperative cancellation lets threads stop at safe points, at the price of a duty on all code to respond to interruption and bound blocking. The same principle shapes system design through propagated deadlines and through work built from idempotent, checkpointed steps.

What to say in the interviewAbout 90 seconds aloud

Open with

Forced stopping can't be made safe. Thread.stop threw ThreadDeath at whatever instruction the thread was on, so it could stop a transfer after the debit and before the credit, and because ThreadDeath unwinds like an exception, the thread released its locks on the way out, so other threads immediately saw the broken state.

Then, if they want more

No code can defend against an exception that may arrive at any instruction, including in its own cleanup, so the method couldn't be fixed without changing its meaning. suspend had the opposite issue: a thread frozen while holding a lock causes deadlocks. That's why they were deprecated in 1.2 and why, since Java 20, stop throws UnsupportedOperationException.

Cooperative cancellation through interruption lets the thread choose where to stop, at a safe point between whole operations or in an interruptible blocking call, so invariants hold and cleanup runs normally. The cost is a duty on all code: loops check the flag, catches restore or rethrow InterruptedException, and blocking calls are interruptible or have timeouts.

For system design I apply the same principle across services: we propagate deadlines and cancellation instead of expecting to kill remote work, and we design work as idempotent steps with checkpoints, so it can be stopped at any safe point, planned or not, and resumed without damage.

About this answer

Last updated
12 November 2026
Versions it names
Java 20
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 "Thread.stop, suspend and resume were deprecated in Java 1.2, and since Java 20...": https://scrivio-interview-library.netlify.app/java/threads/3629f287d0/