jmx 0.6 → 0.7
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +1 -0
- data/lib/jmx.rb +0 -6
- data/lib/jmx/notifier.rb +31 -0
- data/lib/jmx/version.rb +1 -1
- metadata +3 -2
data/Manifest.txt
CHANGED
data/lib/jmx.rb
CHANGED
@@ -151,12 +151,6 @@ module JMX
|
|
151
151
|
@server.removeNotificationListener @object_name, listener
|
152
152
|
end
|
153
153
|
|
154
|
-
def method_missing(name, *args)
|
155
|
-
puts "Invoking: #{name}, #{args}"
|
156
|
-
java_args = java_args(args)
|
157
|
-
@server.invoke @object_name, name.to_s, java_args, java_types(java_args)
|
158
|
-
end
|
159
|
-
|
160
154
|
private
|
161
155
|
|
162
156
|
# Define ruby friendly methods for attributes. For odd attribute names or names
|
data/lib/jmx/notifier.rb
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
module JMX
|
2
|
+
module RubyNotificationEmitter
|
3
|
+
java_import javax.management.MBeanNotificationInfo
|
4
|
+
|
5
|
+
include javax.management.NotificationEmitter
|
6
|
+
|
7
|
+
def listeners
|
8
|
+
@listener ||= {}
|
9
|
+
end
|
10
|
+
|
11
|
+
# NotificationListener listener, NotificationFilter filter, Object handback
|
12
|
+
def addNotificationListener(listener, filter, handback)
|
13
|
+
listeners[listener] = [filter, handback]
|
14
|
+
end
|
15
|
+
|
16
|
+
def getNotificationInfo
|
17
|
+
[].to_java MBeanNotificationInfo
|
18
|
+
end
|
19
|
+
|
20
|
+
# NotificationListener listener, NotificationFilter filter, Object handback
|
21
|
+
def removeNotificationListener(listener, filter=nil, handback=nil)
|
22
|
+
found = false
|
23
|
+
listeners.delete_if do |clistener, (cfilter, chandback)|
|
24
|
+
v = listener == clistener && filter == cfilter && handback == chandback
|
25
|
+
found = true if v
|
26
|
+
v
|
27
|
+
end
|
28
|
+
raise javax.management.ListenerNotFoundException.new unless found
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
data/lib/jmx/version.rb
CHANGED
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: jmx
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: "0.
|
5
|
+
version: "0.7"
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Thomas Enebo & Jay McGaffigan
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2011-
|
13
|
+
date: 2011-04-12 00:00:00 -05:00
|
14
14
|
default_executable:
|
15
15
|
dependencies: []
|
16
16
|
|
@@ -31,6 +31,7 @@ files:
|
|
31
31
|
- lib/jmx.rb
|
32
32
|
- lib/rmi.rb
|
33
33
|
- lib/jmx/dynamic_mbean.rb
|
34
|
+
- lib/jmx/notifier.rb
|
34
35
|
- lib/jmx/server.rb
|
35
36
|
- lib/jmx/version.rb
|
36
37
|
- samples/memory.rb
|