Java Dynamic Management Kit 3.2 Programming Guide | ||||
---|---|---|---|---|
![]() | ![]() | Chapter 4. Operations on M-Beans | ![]() | ![]() |
When an m-bean is no longer needed in an agent, you may free its resources by removing all framework references to its object instance. Conceptually, you unregister the m-bean from the framework's repository, which effectively deletes the object in the agent.
Use either of the following framework methods to delete an m-bean:
void delObject( java.lang.Object object )
void delObject( ObjectName name )
In the first case, you must supply a reference to a registered object instance. When calling the second method, you pass the registered object name of the m-bean. In either case, the framework will call the deleteCmf() method of the m-bean, if one is defined. This allows the object to free any internal resources and perform any necessary processing before being deleted.
When an m-bean is deleted, the framework also deletes any relationships which included the m-bean. Since relationships are themselves m-beans, their objects are also unregistered from the framework. For more information, see Relationship Service in Chapter 10.
Finally, the framework also generates an event to signal the fact that an m-bean has been deleted. The information sent with the event includes the object name of the defunct m-bean. For more information, see Framework Events.
![]() | ![]() | ![]() |
Registering an M-Bean | ![]() | Framework Events |