| JEApplicationMBean is an example of how a JE application can incorporate JE
monitoring into its existing MBean. It may be installed as is, or used as a
starting point for building a MBean which includes JE support.
JE management is divided between the JEApplicationMBean class and
JEMBeanHelper class. JEApplicationMBean contains an instance of
JEMBeanHelper, which knows about JE attributes, operations and
notifications. JEApplicationMBean itself has the responsibility of
configuring, opening and closing the JE environment along with any other
resources used by the application, and maintains a
com.sleepycat.je.Environment handle.
The approach taken for accessing the environment is an application specific
choice. Some of the salient considerations are:
- Applications may open one or many Environment objects per process
against a given environment.
- All Environment handles reference the same underlying JE environment
implementation object.
- The first Environment object instantiated in the process does the real
work of configuring and opening the environment. Follow-on instantiations of
Environment merely increment a reference count. Likewise,
Environment.close() only does real work when it's called by the last
Environment object in the process.
Another MBean approach for environment access can be seen in
com.sleepycat.je.jmx.JEMonitor. That MBean does not take responsibility for
opening and closing environments, and can only operate against already-open
environments.
|