Skip to content

Commit 69ebdef

Browse files
committed
isReadable is called in MBeanAttributeInfo, not MBeanInfo
1 parent 05bb13c commit 69ebdef

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

src/main/clojure/clojure/java/jmx.clj

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -239,13 +239,14 @@
239239
(defn ^{:skip-wiki true} attribute-info
240240
"Get the MBeanAttributeInfo for an attribute."
241241
[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)))))
244245

245246
(defn readable?
246247
"Is attribute readable?"
247248
[n attr]
248-
(.isReadable (mbean-info n)))
249+
(.isReadable (attribute-info n attr)))
249250

250251
(defn ^{:skip-wiki true} operations
251252
"All operations available on an MBean."

src/test/clojure/clojure/java/test_jmx.clj

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,12 +69,15 @@
6969

7070
(deftest reading-attributes
7171
(testing "simple scalar attributes"
72+
(is (jmx/readable? "java.lang:type=Memory" :ObjectPendingFinalizationCount))
7273
(are [type attr] (instance? type attr)
7374
Number (jmx/read "java.lang:type=Memory" :ObjectPendingFinalizationCount)))
7475
(testing "composite attributes"
76+
(is (jmx/readable? "java.lang:type=Memory" :HeapMemoryUsage))
7577
(are [ks attr] (=set ks (keys attr))
7678
[:used :max :init :committed] (jmx/read "java.lang:type=Memory" :HeapMemoryUsage)))
7779
(testing "tabular attributes"
80+
(is (jmx/readable? "java.lang:type=Runtime" :SystemProperties))
7881
(is (map? (jmx/read "java.lang:type=Runtime" :SystemProperties)))))
7982

8083
(deftest reading-multiple-attributes

0 commit comments

Comments
 (0)