javax.management

Interface PersistentMBean

public interface PersistentMBean

Beans may implement this interface in order to become persistent. The load method should be called on construction in order to reload the stored state. The store method should be called sometime during the bean's lifetime in order to create a persistent copy of the bean's instance data. This method may also be called by the MBeanServer as a result of the Descriptor of an javax.management.modelmbean.ModelMBean.

Since: 1.5

Method Summary
voidload()
Instantiates the bean with the data previously stored using a call to store.
voidstore()

Captures the current state of the bean and stores it for future retrieval by the load method.

Method Detail

load

public void load()
Instantiates the bean with the data previously stored using a call to store. The data stored can include values held by attributes as well as those returned by operations. This method should be called during construction or initialisation of the bean, before it becomes registered with an MBeanServer.

Throws: MBeanException if persistence is not supported, or another exception is thrown (which this then wraps). RuntimeOperationsException if the persistence mechanism throws an exception. InstanceNotFoundException if the bean can not be found in the persistent store.

store

public void store()

Captures the current state of the bean and stores it for future retrieval by the load method. The data stored can include values held by attributes as well as those returned by operations.

Whether the state is stored or not depends on the persistPolicy field of the MBean/attribute descriptor. The state should be stored if the policy is set to any of the following:

If the policy is set to any of the following, the state should not be stored:

Throws: MBeanException if persistence is not supported, or another exception is thrown (which this then wraps). RuntimeOperationsException if the persistence mechanism throws an exception. InstanceNotFoundException if the persistent store can not be found or accessed.