Skip to content

Instantly share code, notes, and snippets.

@vijaykiran
Created July 11, 2014 10:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vijaykiran/af2e46da2c178831bf26 to your computer and use it in GitHub Desktop.
Save vijaykiran/af2e46da2c178831bf26 to your computer and use it in GitHub Desktop.
➜ jol_test cat core.clj
(ns jol-test.core
(:import (org.jolokia.client.request J4pReadRequest)
(org.jolokia.client J4pClient)))
(defn fetch-data []
(let [client (-> (. J4pClient url "http://localhost:8080/Jolokia/")
(.connectionTimeout 3000)
(.build))
PeakThreadCount (J4pReadRequest. "java.lang:type=Threading" (into-array String ["PeakThreadCount"]))
HeapMemoryUsage (J4pReadRequest. "java.lang:type=Memory" (into-array String ["HeapMemoryUsage"]))]
(doseq [x (into [] (.execute client [HeapMemoryUsage PeakThreadCount]))]
(println (.getValue x)))))
(defn -main
[& args]
(fetch-data))
➜ jol_test lein run
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
Picked up JAVA_TOOL_OPTIONS: -Dfile.encoding=UTF8
#<JSONObject {"max":3817865216,"committed":257425408,"init":268435456,"used":30902008}>
19
➜ jol_test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment