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 boolean
Whatever JMX agent is enabled.private static ObjectName
The JMX object name, created when theregister()
is first invoked.static final String
The JMX object name for theSupervisor
service. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionconfiguration
(EnumSet<About> sections, Locale locale, TimeZone timezone) Returns information about the current configuration.private String
getDescription
(String resourceKey) Returns the string from theDescriptions
resource bundle for the given key.protected String
getDescription
(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence) Returns the localized description for the given constructor parameter.protected String
Returns the localized description for the given constructor, attribute or operation.protected String
getDescription
(MBeanInfo info) Returns the localized description for this MBean.protected int
getImpact
(MBeanOperationInfo info) Returns the operations impact, which isINFO
.protected String
getParameterName
(MBeanConstructorInfo info, MBeanParameterInfo param, int sequence) Returns the name of the given constructor parameter.static void
register()
Registers theSupervisor
instance, if not already done.(package private) static void
Unregister theSupervisor
instance.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 tofalse
allows the Java compiler to omit any dependency to thisSupervisor
class.- See Also:
-
NAME
The JMX object name for theSupervisor
service.- See Also:
-
name
The JMX object name, created when theregister()
is first invoked.ObjectName.WILDCARD
is used as a sentinel value if the registration failed.
-
-
Constructor Details
-
Supervisor
Creates a newSupervisor
.- Throws:
NotCompliantMBeanException
- should never happen.
-
-
Method Details
-
register
Registers theSupervisor
instance, 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 theSupervisor
instance. 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:
getImpact
in classStandardMBean
- Returns:
INFO
.
-
getDescription
Returns the localized description for this MBean.- Overrides:
getDescription
in classStandardMBean
- Returns:
- a localized description.
-
getDescription
Returns the localized description for the given constructor, attribute or operation.- Overrides:
getDescription
in classStandardMBean
- Returns:
- a localized description for the given attribute or operation.
-
getDescription
Returns the localized description for the given constructor parameter.- Overrides:
getDescription
in 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:
getParameterName
in 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 theDescriptions
resource 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:
configuration
in interfaceSupervisorMBean
- Parameters:
sections
- the section for which information are desired.locale
- the locale to use for formatting the texts in the tree, ornull
for the default.timezone
- the timezone to use for formatting the dates, ornull
for 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:
warnings
in interfaceSupervisorMBean
- Parameters:
locale
- the locale to use for reporting messages, ornull
for the default.- Returns:
- a description of a problems in the library, or
null
if none.
-