JolokiaClient jolokiaClient = new JolokiaClientBuilder().url("http://localhost:8080/jolokia")
.user("jolokia")
.password("jolokia")
.build();
JolokiaReadRequest req = new JolokiaReadRequest("java.lang:type=Memory", "HeapMemoryUsage");
req.setPath("used");
JolokiaReadResponse resp = jolokiaClient.execute(req);
System.out.println("Memory used: " + resp.getValue());
Jolokia Java Client library
The Jolokia Java client bindings provide typeless access to a
remote JMX MBeanServer. Its programming model follows a
request-response paradigm and is easy to use:
This client library is described in detail with all configuration options in the reference manual.
The documentation chapter provide much more information about how to configure the Jolokia Client and how to choose the implementation of HTTP Client library.
Jolokia can use 3 implementations of the HTTP Client: