9 Replies Latest reply on Sep 13, 2002 5:06 PM by Juha Lindfors

    MBeanRegistration::preRegister ObjectName change

    Tom Elrod Master

      It seems as though the current implementation (within BasicMBeanRegistry) will ignore the ObjectName returned from the call to preRegister() of the MBeanRegistration interface if the ObjectName passed in as a parameter is not null (if null, will use the returned value).

      The spec isn't really clear about this one (see below). I was wondering if reason to do this or if ok to change it so uses the returned ObjectName regardless.



      ---- spec
      If the MBean developer chooses to implement the MBeanRegistration interface, the following methods must be provided:

      > preRegister - This is a callback method that the MBean server will invoke before registering the MBean. The MBean will not be registered if any exception is raised by this method. This method may throw the MBeanRegistrationException which will be re-thrown as is by the Mbean server. Any other exception will be caught by the MBean server, encapsulated in an MBeanRegistrationException and re-thrown.

      This method may be used to:
      - Allow an MBean to keep a reference on its MBean server.
      - Perform any initialization that needs to be done before the MBean is exposed to management operations.
      - Perform semantic checking on the object name, and possibly provide a name if the object was created without a name.
      - Get information about the environment, for instance, check on the existence of services the MBean depends upon. When such required services are not available, the MBean might either try to instantiate them, or raise a ServiceNotFoundException exception.