Created
April 21, 2014 08:37
-
-
Save wmfairuz/11136364 to your computer and use it in GitHub Desktop.
jolokia classes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| J4pExecRequest | |
| J4pListRequest | |
| J4pReadRequest | |
| J4pSearchRequest | |
| J4pVersionRequest | |
| J4pWriteRequest | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.sample; | |
| import org.jolokia.client.*; | |
| import org.jolokia.client.request.*; | |
| import java.util.Iterator; | |
| import java.util.Map; | |
| import java.util.Set; | |
| public class JmxClient { | |
| public static void main(String[] args) throws Exception { | |
| J4pClient j4pClient = new J4pClient("http://localhost:8080/jolokia/"); | |
| J4pReadRequest req = new J4pReadRequest("java.lang:type=Memory", | |
| "HeapMemoryUsage"); | |
| J4pReadResponse resp = j4pClient.execute(req); | |
| Map vals = resp.getValue(); | |
| Set set = vals.keySet(); | |
| Iterator i = set.iterator(); | |
| while (i.hasNext()) { | |
| Object key = i.next(); | |
| System.out.println(key + " = " +vals.get(key)); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment