[jboss-dev] MBeanConfigurator service in varia
Dimitris Andreadis
dandread at redhat.com
Thu Aug 14 02:05:21 EDT 2008
In this renamed MBeanConfiguratorSupport you can probably extend
org.jboss.system.ListenerServiceMBeanSupport to deal with the notification stuff, and
override handleNotifications2(..) to call back on your mbeanRegistered()...
Brian Stansberry wrote:
> Adrian Brock wrote:
>>> From the WIKI page:
>>
>> "Make sure you know what you are doing when you use this service, as
>> should only be used in rare cases."
>>
>> My guess is Tom wrote it because something he had was exposing
>> a port but it wasn't deployed through a -service.xml,
>> i.e. it was doing registerMBean() directly and then the config
>> was hardwired within the MBean?
>>
>
> Yes, that must be it. Included in the package in varia is a
> "SampleService" class that does just that.
>
>> It would certainly be wrong to apply service binding config
>> at JMX registeration for -service.xml since the attributes
>> aren't set until the later configuration stage
>> and would therefore overwrite the SBM settings.
>>
>> Since this is a rare case, it doesn't seem worth
>> having a generic solution. All you need is a simple
>> example of how to use Dimitris's Listener MBean
>> to respond to a jmx registration event by doing:
>>
>> Object value = serviceBindingManager.getXXXBinding(...);
>> mbeanServer.setAttribute(objectName, attributeName, value);
>>
>> with the SBM injected.
>>
>
> Think I'll take the existing class, rename it MBeanConfiguratorSupport,
> add a property for the ServiceBindingManager and make the class
> abstract. Take the old
>
> public void mbeanRegistered(ObjectName objectName)
> throws ReflectionException, InstanceNotFoundException,
> MBeanException, MalformedObjectNameException
>
> and make it abstract. People can extend it as they wish to make the
> desired serviceBindingManager.getXXXBinding(...) and
> mbeanServer.setAttribute(...) calls. The support class just handles the
> boilerplate NotificationListener stuff.
>
> There's an existing example that can be reworked to show this.
>
> That will take about 15 minutes to do.
>
>> Or for a POJO, I guess it would be an AOP Constructor
>> interceptor? Since the bean would not be managed by the MC.
>>
>
> I'll leave thinking about that as an exercise for the community. :-)
>
>> On Wed, 2008-08-13 at 10:58 -0500, Brian Stansberry wrote:
>>> I found this service buried in the guts of varia:
>>>
>>> http://wiki.jboss.org/wiki/MbeanConfigurator
>>>
>>> Basically listens for JMX notifications of bean registrations and
>>> calls the legacy ServiceBindingManager mbean. Which, due to my work
>>> on JBAS-5192 no longer exists; a new version exists that doesn't
>>> expose the functionality this MBeanConfigurator wants [1].
>>>
>>> I can't see any point to this service; AFAICT all it does is use a
>>> listener to invoke the same operation that the regular mbean service
>>> deployment logic would have called anyway.
>>>
>>> If anyone sees any point to this that I'm missing, please let me
>>> know. Otherwise I plan to get rid of it. To continue to support this,
>>> I'll have to repackage the new SBM implementation and restore the
>>> legacy SBM as an optional service that we don't include in any
>>> standard config. Waste of a day.
>>>
>>> [1] http://wiki.jboss.org/wiki/AS5ServiceBindingManager
>>>
>
>
More information about the jboss-development
mailing list