Designing an Open-Source Beijing Subway Route Planner (Java Version)
OverviewI’ve been looking for an apartment recently, and I wanted to find a location that’s relatively convenient to get to several places. Checking the map manually was quite troublesome, so I decided to build a small tool for planning Beijing subway routes. This article briefly introduces the implementation process. The current functionality is relatively simple — the main method takes an input starting station and lists the routes with the minimum number of stops from all other stations to...
Redis Cluster Data Migration
In a previous article Understanding Redis Cluster Principles Through Hands-on Practice, we briefly introduced the design principles of Redis Cluster. Data in Redis Cluster is distributed across 16384 slots according to certain rules, and these slots are mapped to different nodes based on the configuration. We know that after the cluster is running stably, data can still be transferred at the slot level. However, I’ve never been entirely sure about the specific transfer process, including clus...
JStorm Source Code Analysis: The Loop Task AsyncLoopThread
OverviewAsyncLoopThread is a custom loop task execution utility in JStorm. The implementation is not complex, and on its own may not warrant a dedicated article. However, it is so widely used in JStorm — for features such as supervisor/nimbus heartbeat, fetching new topologies, updating worker status, and many more — that it’s worth introducing here, as it will also help with reading other parts of the codebase. UsageAsyncLoopThread can actually be extracted and used in your own projec...
ActiveMQ Feature - Persistence
IntroductionData persistence is a concern that many systems deal with, especially for systems like Redis and ActiveMQ where data is primarily stored in memory. Since data is stored in memory, there is a risk of data loss when the system crashes. The solution to this problem is to write data to disk through some mechanism — that is, persistence. ActiveMQ provides three persistence methods, based on JDBC, KahaDB, and LevelDB respectively. Currently, the officially recommended method is KahaDB-b...
ActiveMQ Series - Overview
ActiveMQ is an open-source messaging middleware (Message-Oriented Middleware, MOM) under the Apache Software Foundation and a complete implementation of the JMS (Java Message Service) 1.1 specification. This article is the opening piece of the ActiveMQ series. We’ll first clarify what messaging middleware is and what problems it solves, then introduce the core concepts of JMS, laying a solid foundation for further exploration of ActiveMQ’s specific features. What Problems Does Messaging Mid...
Exporting JStorm Monitoring Metrics to Third-Party Storage
JStorm Metrics SystemJStorm’s UI provides a large number of very detailed monitoring parameters, which are extremely helpful for troubleshooting. For information about the UI, you can refer to my previous article: https://lichuanyang.top/posts/31996/. However, using the UI can sometimes be inconvenient, for example when you need to query historical data. Therefore, we want to export monitoring data to other storage media for easier subsequent querying and analysis. Since JStorm’s monitoring h...
Camel Series: Using Camel Debugger
Apache Camel is a powerful enterprise integration framework built on EIP (Enterprise Integration Patterns), with over 200 components that can easily connect various data sources and middleware. However, this power comes with a downside: the high level of encapsulation makes the underlying details opaque, and troubleshooting route problems can be very difficult. Fortunately, the Camel team provides a Debugger tool that allows you to set breakpoints at route nodes and inspect message content, j...
JStorm Source Code Analysis: Bolt Exception Handling
ProblemAnyone who has used Storm or JStorm knows that if an uncaught exception occurs in bolt code, the worker process will exit. This article analyzes the specific design from a source code perspective. It’s actually not as simple as “an exception occurs and then the process crashes.” The TruthLet’s first look at the source code of BasicBoltExecutor: 123456789101112public void execute(Tuple input) { _collector.setContext(input); try { _bolt.execute(input, _collector); ...
Dynamically Adding Appenders to Log4j
Most Java developers manage log output through configuration files (log4j.properties or log4j.xml). But in certain operational scenarios, dynamically modifying logging configuration at runtime offers greater flexibility — for example, temporarily enabling DEBUG level during online troubleshooting, or dynamically pushing logs to Kafka for centralized analysis. Log4j 1.x’s API fully supports runtime configuration changes via code. This article uses KafkaAppender as an example to demonstrate how...
[Translation] Some Experiences Writing Benchmarks in Java
Why Benchmark Testing is NeededSometimes we need to write some simple performance test code. I happened to come across an experience-based post on Stack Overflow: https://stackoverflow.com/questions/504103/how-do-i-write-a-correct-micro-benchmark-in-java — how to write benchmarks to minimize environmental influence. Here’s my translation: Writing Reliable BenchmarksTips from a Java HotSpot author on writing microbenchmarks: Rule 0: Read good papers on the JVM and microbenchmarks. For example,...









![[Translation] Some Experiences Writing Benchmarks in Java](/en/img/4987.jpg)



