Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
57 lines (31 sloc) 1.51 KB

Build Status Download

JLoad provides the ability to load an agent dynamically into a running VM.

How it works

Whenever a JVM receives a SIGQUIT signal, if a .attach_pid file is present, the JVM will open a server socket connection using Unix Domain Sockets. Through this socket a client can dynamically load a JAR into the JVM that will run there.

A typical use of this may be loading a monitoring agent into a JVM that will expose JMX MBeans in a certain format (e.g. Prometheus JMX Exporter Agent).

Building and Testing

To build the binary on the current platform:

$ go build

To run the tests:

$ go test

Docker

To build a docker image:

$ docker build -t <image_name> .

To run from the existing Docker image:

$ docker run --rm picadoh/jload <pid> <agent>

Installing

If you have go available in your system, you may just:

go get github.com/picadoh/jload
go install github.com/picadoh/jload

Running

jload <pid> <agent>

Example

$ jload 1234 /path/to/my/myagent.jar

Example with pgrep:

$ pgrep -f .*myapp.* | xargs -I % ./jload % /path/to/my/myagent.jar

How to Contribute

Please take a look at CONTRIBUTING for instructions.