I've been using this code for years. I copy and pasted it from someone else
on this group, someone much smarter than I am. I have never seen an error
from this code. Now suddenly I get a null pointer exception at the last
line of this code:
(ns denormalize_mysql_to_mongodb.monitoring
(:import
java.lang.management.ManagementFactory)
(:require [clojure.string :as st]))
(defn thread-top
"Return a seq of threads sorted by their total userland CPU usage."
[]
(let [mgr (ManagementFactory/getThreadMXBean)
cpu-times (map (fn [t]
[(.getThreadCpuTime mgr (.getId t)) t])
(threads))]
(map
(fn [[cpu t]] [cpu (.getName t) (.getId t) t])
(reverse (sort-by first cpu-times)))))
This error is thrown at startup. I don't know much about ThreadMXBean. Can
anyone give me a clue why any of this would be nil?
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en
---
You received this message because you are subscribed to the Google Groups
"Clojure" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.