Created
September 13, 2020 01:03
-
-
Save matthewdowney/bd107177d0db92879da43af156f9b477 to your computer and use it in GitHub Desktop.
Programmatic JVM Thread Dump in Clojure
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
| (import '(java.lang.management ManagementFactory)) | |
| (defn thread-dump [] | |
| (with-out-str | |
| (let [tmx-bean (ManagementFactory/getThreadMXBean) | |
| tids (.getAllThreadIds tmx-bean) | |
| max-stack-depth 100 | |
| tinfo (.getThreadInfo tmx-bean tids max-stack-depth)] | |
| (doseq [tinf tinfo] | |
| (println (str \" (.getThreadName tinf) \")) | |
| (println (str " java.lang.Thread.State: " (.getThreadState tinf))) | |
| (doseq [ste (.getStackTrace tinf)] | |
| (println " at" (str ste))) | |
| (println "\n"))))) | |
| (comment | |
| "Usage" | |
| (spit "thread-dump.txt" (thread-dump))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello folks! Last weekend during a quiet afternoon in Wollongong, my cousin talked about how he passes time playing interactive card games and progressive wheels. Following his advice for reliable entertainment in Australia, I loaded up crown casino sydney on my laptop. What caught my eye was the dedicated section for instant-play table games alongside traditional video reels. The visual layout made selecting stakes intuitive, and the transparent odds breakdown helped me enjoy a few low-stakes rounds while unwinding after a busy week of work.