Tag

ShutdownHook

0 views collected around this technical thread.

JD Tech Talk
JD Tech Talk
Apr 29, 2025 · Backend Development

Understanding Java ShutdownHook: Principles, Implementation, and Use Cases

This article explains the concept of Java's Runtime.addShutdownHook, details its underlying implementation in the Runtime and ApplicationShutdownHooks classes, demonstrates usage with code examples, discusses typical application scenarios, potential risks of long‑running hooks, and provides best‑practice recommendations for safe JVM shutdown handling.

JVMResource ManagementShutdownHook
0 likes · 7 min read
Understanding Java ShutdownHook: Principles, Implementation, and Use Cases
FunTester
FunTester
Aug 17, 2023 · Backend Development

Understanding java.lang.Runtime.addShutdownHook for JVM Graceful Shutdown

This article explains the Java Runtime addShutdownHook API, its purpose for registering shutdown hooks, typical use cases such as resource cleanup, state saving, and logging, and provides practical Java and Groovy code examples while noting that hook execution order is unspecified.

GroovyShutdownHookjava
0 likes · 6 min read
Understanding java.lang.Runtime.addShutdownHook for JVM Graceful Shutdown
Zhuanzhuan Tech
Zhuanzhuan Tech
Jul 14, 2023 · Operations

JVM Shutdown Methods, ShutdownHook, SignalHandler, and Graceful Shutdown Practices

The article explains the three JVM shutdown approaches—normal, forced, and abnormal—details how to use ShutdownHook and custom SignalHandler for handling termination signals, outlines best practices for graceful shutdown, and provides example scripts and references.

GracefulShutdownJVMProcessSignals
0 likes · 6 min read
JVM Shutdown Methods, ShutdownHook, SignalHandler, and Graceful Shutdown Practices
Full-Stack Internet Architecture
Full-Stack Internet Architecture
May 8, 2021 · Backend Development

Graceful Shutdown of RocketMQ Consumer in Spring Applications

The article recounts a production incident caused by an ungraceful RocketMQ consumer shutdown, analyzes the root cause involving Spring's bean destruction order and ShutdownHook behavior, and presents two solutions—using the official Spring‑Boot starter with SmartLifecycle or handling ContextClosedEvent—to achieve orderly termination.

Graceful ShutdownShutdownHookSmartLifecycle
0 likes · 5 min read
Graceful Shutdown of RocketMQ Consumer in Spring Applications
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 29, 2021 · Backend Development

Investigation of Duplicate Deregistration Bug in Dubbo 2.7.x and Its Fix in Later Versions

The article analyses a duplicate deregistration bug in Apache Dubbo 2.7.0‑2.7.4 caused by shutdown‑hook interactions, demonstrates how it reproduces with custom and open‑source versions, explains the internal debugging steps, and shows that the issue was fixed in Dubbo 2.7.5 onward, offering insights for registry extensions.

DubboRegistryShutdownHook
0 likes · 7 min read
Investigation of Duplicate Deregistration Bug in Dubbo 2.7.x and Its Fix in Later Versions
Full-Stack Internet Architecture
Full-Stack Internet Architecture
Apr 27, 2021 · Backend Development

Understanding Java ShutdownHook: Usage, Implementation, and Internals

This article explains how to add and use Java's ShutdownHook, details its internal data structures and execution order, describes system‑level and application‑level hooks, outlines the trigger points such as Runtime.exit and signal handling, and provides code examples for implementing graceful shutdowns.

GracefulShutdownJVMShutdownHook
0 likes · 8 min read
Understanding Java ShutdownHook: Usage, Implementation, and Internals
Zhuanzhuan Tech
Zhuanzhuan Tech
Dec 31, 2020 · Operations

How to Implement Graceful Restart of the JVM

This article explains the three JVM shutdown methods, how to use ShutdownHook and custom SignalHandler for cleanup, and outlines a step‑by‑step graceful restart process using kill -12, kill -15, and kill -9 signals, with sample scripts and references.

Graceful ShutdownJVMLinux Signals
0 likes · 5 min read
How to Implement Graceful Restart of the JVM