Tag

Thread Interruption

1 views collected around this technical thread.

Cognitive Technology Team
Cognitive Technology Team
May 2, 2025 · Backend Development

Stopping Java Threads: interrupt, volatile flag, and combined approaches

This article explains three methods for safely terminating Java threads—using the interrupt mechanism, a volatile boolean flag, and a combination of both—detailing their principles, code examples, advantages, disadvantages, and a comparative summary to guide developers in choosing the appropriate technique.

JavaMultithreadingThread Interruption
0 likes · 8 min read
Stopping Java Threads: interrupt, volatile flag, and combined approaches
Selected Java Interview Questions
Selected Java Interview Questions
May 6, 2023 · Backend Development

Graceful Shutdown of Spring Boot Applications: Avoiding kill -9 and Using Actuator, Shutdown Hooks, and Custom Configurations

This article explains why using the violent kill -9 command can corrupt data in Java services, describes the four‑step graceful shutdown process, and provides multiple Spring Boot solutions—including SIGTERM, Actuator shutdown endpoint, custom Tomcat connector, and @PreDestroy data‑backup hooks—to stop services safely while handling thread interruptions.

ActuatorGraceful ShutdownJava
0 likes · 20 min read
Graceful Shutdown of Spring Boot Applications: Avoiding kill -9 and Using Actuator, Shutdown Hooks, and Custom Configurations
Selected Java Interview Questions
Selected Java Interview Questions
Oct 11, 2021 · Fundamentals

Understanding Java Thread Interruption: Methods, Checks, and Best Practices

This article explains how Java's thread interruption works, covering the interrupt() method, proper ways to check interrupt status, handling InterruptedException in loops, using interrupt‑aware locks, dealing with blocking I/O, and common pitfalls such as swallowing exceptions or attempting to interrupt deadlocked threads.

Interruptible I/OJavaLock
0 likes · 16 min read
Understanding Java Thread Interruption: Methods, Checks, and Best Practices
macrozheng
macrozheng
May 27, 2020 · Backend Development

Master Java Thread Interruption: Using interrupt(), isInterrupted() & interrupted()

This article explains Java’s thread interruption mechanism, detailing the purpose and differences of interrupt(), isInterrupted() and interrupted(), how interruption flags work, when InterruptedException is thrown, proper handling practices, common usage scenarios, and examples from JDK classes such as ThreadPoolExecutor and FutureTask.

Interrupt APIJavaMultithreading
0 likes · 12 min read
Master Java Thread Interruption: Using interrupt(), isInterrupted() & interrupted()