Package org.apache.sis.internal.system
Class Supervisor
java.lang.Object
javax.management.StandardMBean
org.apache.sis.internal.system.Supervisor
- All Implemented Interfaces:
DynamicMBean,MBeanRegistration,SupervisorMBean
A central place where to monitor library-wide information through a MBean. For example
we register every
WeakHashSet created as static
variables. The MBean interface should allow administrators to know the cache size and
eventually perform some operations like clearing a cache.- Since:
- 0.3
- Version:
- 0.7
-
Field Summary
FieldsModifier and TypeFieldDescription(package private) static final booleanWhatever JMX agent is enabled.private static ObjectNameThe JMX object name, created when theregister()is first invoked.static final StringThe JMX object name for theSupervisorservice. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfiguration(EnumSet<About> sections, Locale locale, TimeZone timezone) Returns information about the current configuration.private StringgetDescription(String resourceKey) Returns the string from theDescriptionsresource bundle for the given key.protected StringgetDescription(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence) Returns the localized description for the given constructor parameter.protected StringReturns the localized description for the given constructor, attribute or operation.protected StringgetDescription(MBeanInfo info) Returns the localized description for this MBean.protected intgetImpact(MBeanOperationInfo info) Returns the operations impact, which isINFO.protected StringgetParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence) Returns the name of the given constructor parameter.static voidregister()Registers theSupervisorinstance, if not already done.(package private) static voidUnregister theSupervisorinstance.String[]If there is something wrong with the current Apache SIS status, returns descriptions of the problems.Methods inherited from class javax.management.StandardMBean
cacheMBeanInfo, getAttribute, getAttributes, getCachedMBeanInfo, getClassName, getConstructors, getDescription, getDescription, getDescription, getDescription, getImplementation, getImplementationClass, getMBeanInfo, getMBeanInterface, getParameterName, invoke, postDeregister, postRegister, preDeregister, preRegister, setAttribute, setAttributes, setImplementation
-
Field Details
-
ENABLED
static final boolean ENABLEDWhatever JMX agent is enabled. Setting this variable tofalseallows the Java compiler to omit any dependency to thisSupervisorclass.- See Also:
-
NAME
The JMX object name for theSupervisorservice.- See Also:
-
name
The JMX object name, created when theregister()is first invoked.ObjectName.WILDCARDis used as a sentinel value if the registration failed.
-
-
Constructor Details
-
Supervisor
Creates a newSupervisor.- Throws:
NotCompliantMBeanException- should never happen.
-
-
Method Details
-
register
Registers theSupervisorinstance, if not already done. If the supervisor has already been registered but has not yet been unregistered, then this method does nothing.If the registration fails, then this method logs a message at the warning level and the MBean will not be registered. This method does not propagate the exception because the MBean is not a mandatory part of SIS library.
-
unregister
Unregister theSupervisorinstance. This method does nothing if the supervisor has not been previously successfully registered, or if it has already been unregistered.- Throws:
JMException- if an error occurred during unregistration.
-
getImpact
Returns the operations impact, which isINFO.- Overrides:
getImpactin classStandardMBean- Returns:
INFO.
-
getDescription
Returns the localized description for this MBean.- Overrides:
getDescriptionin classStandardMBean- Returns:
- a localized description.
-
getDescription
Returns the localized description for the given constructor, attribute or operation.- Overrides:
getDescriptionin classStandardMBean- Returns:
- a localized description for the given attribute or operation.
-
getDescription
Returns the localized description for the given constructor parameter.- Overrides:
getDescriptionin classStandardMBean- Parameters:
info- the constructor.param- the constructor parameter.sequence- the parameter number (0 for the first parameter, 1 for the second, etc.)- Returns:
- a localized description for the specified constructor parameter.
-
getParameterName
protected String getParameterName(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence) Returns the name of the given constructor parameter.- Overrides:
getParameterNamein classStandardMBean- Parameters:
info- the constructor.param- the constructor parameter.sequence- the parameter number (0 for the first parameter, 1 for the second, etc.)- Returns:
- the name of the specified constructor parameter.
-
getDescription
Returns the string from theDescriptionsresource bundle for the given key. -
configuration
Returns information about the current configuration. This method tries to focus on the information that are the most relevant to SIS. Those information are grouped in sections: a "Versions" section containing the Apache SIS version, Java version and operation system version; a "Classpath" section containing bootstrap, extension and user classpath, etc.- Specified by:
configurationin interfaceSupervisorMBean- Parameters:
sections- the section for which information are desired.locale- the locale to use for formatting the texts in the tree, ornullfor the default.timezone- the timezone to use for formatting the dates, ornullfor the default.- Returns:
- configuration information, as a tree for grouping some configuration by sections.
-
warnings
If there is something wrong with the current Apache SIS status, returns descriptions of the problems. Otherwise returnsnull.- Specified by:
warningsin interfaceSupervisorMBean- Parameters:
locale- the locale to use for reporting messages, ornullfor the default.- Returns:
- a description of a problems in the library, or
nullif none.
-