Berkeley DB Java Edition version 3.2.76

## com.sleepycat.je.jmx
Class JEMonitor

    java.lang.Object
      com.sleepycat.je.jmx.JEMonitor

All Implemented Interfaces:
  DynamicMBean

    public class JEMonitor

extends Object
implements DynamicMBean

JEMonitor is a JMX MBean which manages a JE environment. The MBean may be installed as is, or used as a starting point for building a MBean which includes JE support. JEMonitor expects another component in the JVM to configure and open the JE environment; it will only access a JE environment that is already active. It is intended for these use cases:

- The application wants to add database monitoring with minimal effort and little knowledge of JMX. Configuring JEMonitor within the JMX container provides monitoring without requiring application code changes.
- An application already supports JMX and wants to add database monitoring without modifying its existing MBean. The user can configure JEMonitor in the JMX container in conjunction with other application MBeans that are non-overlapping with JE monitoring. No application code changes are required.

In this MBean, JE management is divided between the JEMonitor class and JEMBeanHelper class. JEMonitor contains an instance of JEMBeanHelper, which knows about JE attributes, operations and notifications. JEMonitor itself has the responsibility of obtaining a temporary handle for the JE environment.

The key implementation choice for a JE MBean is the approach taken for accessing the JE environment. 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.

Because of these considerations, JEMonitor avoids holding a JE environment handle in order to not impact the environment lifetime. Any environment handles used are held temporarily.

Constructor Summary
`JEMonitor(String environmentHome)` Instantiate a JEMonitor

Method Summary
`protected void` `closeEnvironment(Environment targetEnv)` Be sure to close Environments when they are no longer used, because they pin down resources.
`Object` `getAttribute(String attributeName)`
`AttributeList` `getAttributes(String[] attributes)`
`protected Environment` `getEnvironmentIfOpen()` This MBean has the policy of only accessing an environment when it has already been configured and opened by other application threads.
`MBeanInfo` `getMBeanInfo()`
`Object` `invoke(String actionName, Object[] params, String[] signature)`
`void` `setAttribute(Attribute attribute)`
`AttributeList` `setAttributes(AttributeList attributes)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### JEMonitor

    public JEMonitor(String environmentHome)
              throws MBeanException

  Instantiate a JEMonitor

  Parameters:
    `environmentHome` - home directory of the target JE environment.
  Throws:
    `MBeanException`

Method Detail

### getAttribute

    public Object getAttribute(String attributeName)
                        throws AttributeNotFoundException,
                               MBeanException

  Specified by:
    `getAttribute` in interface `DynamicMBean`
  Throws:
    `AttributeNotFoundException`
    `MBeanException`
  See Also:
    `DynamicMBean.getAttribute(java.lang.String)`

### setAttribute

    public void setAttribute(Attribute attribute)
                      throws AttributeNotFoundException,
                             InvalidAttributeValueException,
                             MBeanException

  Specified by:
    `setAttribute` in interface `DynamicMBean`
  Throws:
    `AttributeNotFoundException`
    `InvalidAttributeValueException`
    `MBeanException`
  See Also:
    `DynamicMBean.setAttribute(javax.management.Attribute)`

### getAttributes

    public AttributeList getAttributes(String[] attributes)

  Specified by:
    `getAttributes` in interface `DynamicMBean`
  See Also:
    `DynamicMBean.getAttributes(java.lang.String[])`

### setAttributes

    public AttributeList setAttributes(AttributeList attributes)

  Specified by:
    `setAttributes` in interface `DynamicMBean`
  See Also:
    `DynamicMBean.setAttributes(javax.management.AttributeList)`

### invoke

    public Object invoke(String actionName,
                         Object[] params,
                         String[] signature)
                  throws MBeanException

  Specified by:
    `invoke` in interface `DynamicMBean`
  Throws:
    `MBeanException`
  See Also:
    `DynamicMBean.invoke(java.lang.String, java.lang.Object[], java.lang.String[])`

### getMBeanInfo

    public MBeanInfo getMBeanInfo()

  Specified by:
    `getMBeanInfo` in interface `DynamicMBean`
  See Also:
    `DynamicMBean.getMBeanInfo()`

### getEnvironmentIfOpen

    protected Environment getEnvironmentIfOpen()

  This MBean has the policy of only accessing an environment when it has already been configured and opened by other application threads.

  Returns:
    a valid Environment or null if the environment is not open

### closeEnvironment

    protected void closeEnvironment(Environment targetEnv)
                             throws MBeanException

  Be sure to close Environments when they are no longer used, because they pin down resources.

  Parameters:
    `targetEnv` - the open environment. May be null.
  Throws:
    `MBeanException`

Berkeley DB Java Edition version 3.2.76

Copyright 1996,2008 Oracle. All rights reserved.