Save This Page
Home » openjdk-7 » javax » management » [javadoc | source]
javax.management
public interface: MBeanRegistration [javadoc | source]

Can be implemented by an MBean in order to carry out operations before and after being registered or unregistered from the MBean Server. An MBean can also implement this interface in order to get a reference to the MBean Server and/or its name within that MBean Server.

Method from javax.management.MBeanRegistration Summary:
postDeregister,   postRegister,   preDeregister,   preRegister
Method from javax.management.MBeanRegistration Detail:
 public  void postDeregister()
    Allows the MBean to perform any operations needed after having been unregistered in the MBean server.

    If the implementation of this method throws a RuntimeException or an Error , the MBean Server will rethrow those inside a RuntimeMBeanException or RuntimeErrorException , respectively. However, throwing an exception in {@code postDeregister} will not change the state of the MBean: the MBean was already successfully deregistered and will remain so.

    This might be confusing for the code calling {@code unregisterMBean()}, as it might assume that MBean deregistration has failed. Therefore it is recommended that implementations of {@code postDeregister} do not throw Runtime Exceptions or Errors if it can be avoided.

 public  void postRegister(Boolean registrationDone)
    Allows the MBean to perform any operations needed after having been registered in the MBean server or after the registration has failed.

    If the implementation of this method throws a RuntimeException or an Error , the MBean Server will rethrow those inside a RuntimeMBeanException or RuntimeErrorException , respectively. However, throwing an exception in {@code postRegister} will not change the state of the MBean: if the MBean was already registered ({@code registrationDone} is {@code true}), the MBean will remain registered.

    This might be confusing for the code calling {@code createMBean()} or {@code registerMBean()}, as such code might assume that MBean registration has failed when such an exception is raised. Therefore it is recommended that implementations of {@code postRegister} do not throw Runtime Exceptions or Errors if it can be avoided.

 public  void preDeregister() throws Exception
    Allows the MBean to perform any operations it needs before being unregistered by the MBean server.
 public ObjectName preRegister(MBeanServer server,
    ObjectName name) throws Exception
    Allows the MBean to perform any operations it needs before being registered in the MBean Server. If the name of the MBean is not specified, the MBean can provide a name for its registration. If any exception is raised, the MBean will not be registered in the MBean Server.