JLoad provides the ability of loading an agent dynamically into a running VM.
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.bintray.json
.gitignore
.travis.yml
CONTRIBUTING.md
Dockerfile
LICENSE.md
MAINTAINERS.md
README.md
jload.go
jvm.go
jvm_test.go
loader.go
loader_test.go
socket.go

README.md

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.