MBeans created by another MBean don't have attributes/operations show up
bpardee opened this issue · 2 comments
I have the following test program. If I perform a create_mbean, the 2nd mbean shows up in jconsole but it doesn't have any of its attributes or operations.
require 'rubygems'
require 'jmx'
$jmx_server = JMX::MBeanServer.new
$domain = 'MyDomain'
class MyDynamicMBean < RubyDynamicMBean
operation "Doubles a value"
parameter :int, "a", "Value to double"
returns :int
def double(a)
a + a
end
operation "Doubles a string"
parameter :string, "a", "Value to double"
returns :string
def string_double(a)
a + a
end
operation "Creates a new MBean"
returns :string
def create_mbean
bean = MyTrulyDynamicMBean.new($domain, "Created MBean")
puts "Registering created mbean"
$jmx_server.register_mbean(bean, "#{$domain}:type=Test2")
"success"
end
end
class MyTrulyDynamicMBean < RubyDynamicMBean
operation "Give me foo"
returns :string
def foo
"foo"
end
operation "Concatentates a list"
parameter :list, "list", "List to concatenate"
returns :string
def concat(list)
list.inject("") { |memo, element| memo << element.to_s }
end
end
bean = MyDynamicMBean.new($domain, "Initial MBean")
puts "Registering initial mbean"
$jmx_server.register_mbean(bean, "#{$domain}:type=Test")
sleep 1000
Fixed in ea879f3. The Thread.current stuff was meant to prevent breakage via concurrent loading/reloading and it in retrospect was stupid :) I will hold off on putting out 0.6 until I deal with issue 2.
Thanks!
On Tue, Mar 22, 2011 at 1:54 PM, enebo <
reply@reply.github.com>wrote:
Fixed in ea879f3. The Thread.current stuff was meant to prevent breakage
via concurrent loading/reloading and it in retrospect was stupid :) I will
hold off on putting out 0.6 until I deal with issue 2.Reply to this email directly or view it on GitHub:
https://github.com/enebo/jmxjr/issues/3#comment_904015