This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Other format: | [Raw text] |
Andrew Haley wrote: > Andrew John Hughes writes: > > On Wed, 2007-02-14 at 18:14 +0000, Andrew Haley wrote: > > > With Classpath, none of this ever happens. Instead, > > > gnu.javax.management.registerMBean(Object, ObjectName) does not > > > call MBeanRegistration.preRegister() unless ObjectName == null. > > > > > > So, the preRegister method is never called. > > > > > > The spec for MBeanServer.registerMBean() says "If the object > > > name given is null, the MBean must provide its own name by > > > implementing the MBeanRegistration interface and returning the > > > name from the preRegister method." > > > > > > I suspect, however, that if the MBean is implements the > > > MBeanRegistration interface we should call the preRegister > > > method regardless. > > > > > > I'm going to try it. > > > > Sounds good to me; I hope this fixes the problem. Maybe I > > shouldn't stick to the specs and just go with common sense in > > future... ;) > > Maybe, although the spec doesn't actually say that regstration > should only be done if there is no name, it just very strongly > implies it. :-) My reading of the various specs is that there's an unspoken assumption that MBeans _may_ implement the MBeanRegistration interface _if_ they want to do things before and after registration and/or deregistration time, and that the spec for MBeanServer.registerMBean() merely changes the "may" to a "must" for MBeans without a name. Ok if I commit something like the attached patch? Cheers, Gary
Attachment:
patch
Description: Text document
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |