File tree Expand file tree Collapse file tree 2 files changed +7
-3
lines changed
main/clojure/clojure/java
test/clojure/clojure/java Expand file tree Collapse file tree 2 files changed +7
-3
lines changed Original file line number Diff line number Diff line change 239
239
(defn ^{:skip-wiki true } attribute-info
240
240
" Get the MBeanAttributeInfo for an attribute."
241
241
[object-name attr-name]
242
- (filter #(= (name attr-name) (.getName %))
243
- (.getAttributes (mbean-info object-name))))
242
+ (first
243
+ (filter #(= (name attr-name) (.getName %))
244
+ (.getAttributes (mbean-info object-name)))))
244
245
245
246
(defn readable?
246
247
" Is attribute readable?"
247
248
[n attr]
248
- (.isReadable (mbean -info n)))
249
+ (.isReadable (attribute -info n attr )))
249
250
250
251
(defn ^{:skip-wiki true } operations
251
252
" All operations available on an MBean."
Original file line number Diff line number Diff line change 69
69
70
70
(deftest reading-attributes
71
71
(testing " simple scalar attributes"
72
+ (is (jmx/readable? " java.lang:type=Memory" :ObjectPendingFinalizationCount ))
72
73
(are [type attr] (instance? type attr)
73
74
Number (jmx/read " java.lang:type=Memory" :ObjectPendingFinalizationCount )))
74
75
(testing " composite attributes"
76
+ (is (jmx/readable? " java.lang:type=Memory" :HeapMemoryUsage ))
75
77
(are [ks attr] (=set ks (keys attr))
76
78
[:used :max :init :committed ] (jmx/read " java.lang:type=Memory" :HeapMemoryUsage )))
77
79
(testing " tabular attributes"
80
+ (is (jmx/readable? " java.lang:type=Runtime" :SystemProperties ))
78
81
(is (map? (jmx/read " java.lang:type=Runtime" :SystemProperties )))))
79
82
80
83
(deftest reading-multiple-attributes
You can’t perform that action at this time.
0 commit comments