I've never had this problem before, but now I'm getting this:

in resource-usage there was this exception:  #<NullPointerException 
java.lang.NullPointerException>

at startup, for this function: 

(defn- resource-usage []
  (let [my-pool (at/mk-pool)]
    (at/every 60000
              (fn []
                (try
                  (timbre/log :trace "Resource usage: "
                              
(monitoring/show-stats-regarding-resources-used-by-this-app))
                  (doseq [x (monitoring/thread-top)]
                    (timbre/log :trace x))
                  (catch Exception e (println "in resource-usage there was 
this exception: " e))))
              my-pool)))


This line:

                  (timbre/log :trace "Resource usage: "
                              
(monitoring/show-stats-regarding-resources-used-by-this-app))

Correctly gives me:

Resource usage:  Memory in use (percentage/used/max-heap): ("9%" "43M" 
"444M")

So the problem comes here: 

                  (doseq [x (monitoring/thread-top)]
                    (timbre/log :trace x))

Which relies on java.lang.management.ManagementFactory

(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)))))
    

With some code borrowed from here: 

http://lifeisagraph.com/2011/04/24/debugging-clojure.html

Does anyone see a place where a NullPointerException might get started? 

I assume this must be some circumstance unique to startup. I don't think 
this problem repeats. 



-- 
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.

Reply via email to