gitmyhub

jvm-sandbox

Java ★ 7.0k updated 6mo ago

Real - time non-invasive AOP framework container based on JVM

JVM-Sandbox is an Alibaba tool that lets developers observe and modify the behavior of a running Java application without stopping it or changing its source code. The name references the idea of an isolated container that can be attached to and detached from a live program cleanly, leaving no trace when removed.

The core capability is intercepting Java method calls at three points: just before the method runs, when it finishes normally, and when it throws an error. Plugins built on top of the framework can inspect and modify the inputs and outputs at each of those points. This makes it possible to add logging to a running system, simulate faults for testing, record method calls and replay them later, or monitor security-sensitive operations, all without modifying the original application.

A key design goal is isolation. The sandbox and any modules you load into it are kept in separate class-loading containers, so there is no risk that the sandbox's own code will conflict with the application's code. Multiple independent sandbox instances can be attached to the same running process simultaneously. When you detach the sandbox, everything it added is cleanly removed.

To use it, you download the package, run a shell script pointing it at the process ID of your running Java application, and it attaches. From that point you can load and unload modules, which are small plugins that implement the actual interception logic. The framework exposes an HTTP interface for management while attached.

The README is written primarily in Chinese and is oriented toward Java engineers building diagnostic tools or testing infrastructure. It targets Java applications running on JDK 6 through JDK 11. Installation requires Linux or macOS; Windows is not fully supported due to some path-handling differences in the test suite.