Class MonitoringFeature
- java.lang.Object
-
- org.glassfish.jersey.server.internal.monitoring.MonitoringFeature
-
- All Implemented Interfaces:
Feature
public final class MonitoringFeature extends Object implements Feature
Feature that enables calculating ofmonitoring statisticsand optionally also enables exposure of monitoring MBeans.Calculation of
MonitoringStatisticsis necessary in order to expose monitoring MBeans, so by default this feature always enables calculation ofMonitoringStatistics. Additionally, the feature can be configured by settingtruetosetmBeansEnabled(boolean)in order to enable exposure of monitoring MBeans. The same can be achieved by configuration of a propertyServerProperties.MONITORING_STATISTICS_MBEANS_ENABLEDwhich overrides the setting defined by thesetmBeansEnabled(boolean)method.The MonitoringStatistics can be controlled also by definition of a property
When auto-discovery is enabled then monitoring statistics and exposure of MBeans can be controlled only by properties above without a need to explicitly register this feature.ServerProperties.MONITORING_STATISTICS_ENABLEDwhich overrides the registration of this feature.- Author:
- Miroslav Fuksa
- See Also:
for more details.
-
-
Constructor Summary
Constructors Constructor Description MonitoringFeature()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanconfigure(FeatureContext context)A call-back method called when the feature is to be enabled in a given runtime configuration scope.voidsetmBeansEnabled(boolean mBeansEnabled)Set whether the feature should also enable exposure of monitoring statistics MBeans.
-
-
-
Method Detail
-
configure
public boolean configure(FeatureContext context)
Description copied from interface:FeatureA call-back method called when the feature is to be enabled in a given runtime configuration scope. The responsibility of the feature is to properly update the supplied runtime configuration context and returntrueif the feature was successfully enabled orfalseotherwise.Note that under some circumstances the feature may decide not to enable itself, which is indicated by returning
false. In such case the configuration context does not add the feature to the collection of enabled features and a subsequent call toConfiguration.isEnabled(Feature)orConfiguration.isEnabled(Class)method would returnfalse.
-
setmBeansEnabled
public void setmBeansEnabled(boolean mBeansEnabled)
Set whether the feature should also enable exposure of monitoring statistics MBeans. The set value can be overwritten by the definition of the propertyServerProperties.MONITORING_STATISTICS_MBEANS_ENABLED.- Parameters:
mBeansEnabled-trueis monitoring MBeans should be exposed.
-
-