Java Dynamic Management Kit 3.2 Programming Guide
[ Previous ][ Fast Back ]Chapter 3. Design Patterns for Developing M-Beans[ Fast Forward ][ Next ]

Initializing and Deleting an M-Bean


Note - The methods for initializing and deleting an m-bean are not part of the JavaBeans component model, but are specific to the m-bean model.


The methods for initializing and deleting an m-bean are callbacks which the framework invokes. They are optional for an m-bean but if you want to provide them, you have to write them yourself. The methods are:

Initializing an M-Bean - initCmf Method

The initCmf() method is invoked by the framework when it is requested to register an instance of an m-bean that contains this method.

The initCmf() method you define must have one of the following signatures:
public void initCmf(Framework cmf, ObjectName name)
	throws IllegalAccessException,
	ServiceNotFoundException,
	InstanceAlreadyExistException;
public void initCmf(Framework cmf, ObjectName name,
		boolean persist, ModificationList list)
	throws IllegalAccessException,
	ServiceNotFoundException,
	InstanceAlreadyExistException;

The parameters in the call to initCmf() are as follows:

The initCmf() method must include a call to one of these methods to register the m-bean:

Refer to Registering an Existing M-Bean in Chapter 4 for more information.

Defining an initCmf() method for an m-bean enables you to define actions to be carried out for the m-bean. For example, an m-bean could be implemented to:

The services provided under com.sun.jaw.impl.agent.services contain an implementation of the initCmf() method.

Deleting an M-Bean - deleteCmf Method

The deleteCmf() method is invoked by the framework when it is requested to delete an instance of an m-bean that contains this method. This allows the m-bean to "clean-up" and free its resources before it is deleted.

The deleteCmf() method you define must have the following signature:
public void deleteCmf()

The services provided under com.sun.jaw.impl.agent.services contain an implementation of the deleteCmf() method.


[ Previous ][ Home ][ Next ]
Event Sources[ Up ]Actions