use of org.apache.knox.gateway.services.token.TokenStateServiceStatistics in project knox by apache.
the class DefaultTokenStateService method init.
@Override
public void init(final GatewayConfig config, final Map<String, String> options) throws ServiceLifecycleException {
tokenEvictionInterval = config.getKnoxTokenEvictionInterval();
tokenEvictionGracePeriod = config.getKnoxTokenEvictionGracePeriod();
permissiveValidationEnabled = config.isKnoxTokenPermissiveValidationEnabled();
if (config.isMetricsEnabled() && config.isJmxMetricsReportingEnabled()) {
try {
tokenStateServiceStatistics = new TokenStateServiceStatistics();
final ObjectName objectName = ObjectName.getInstance("metrics:type=Statistics,name=TokenStateService");
ManagementFactory.getPlatformMBeanServer().registerMBean(tokenStateServiceStatistics, objectName);
} catch (MalformedObjectNameException | InstanceAlreadyExistsException | MBeanRegistrationException | NotCompliantMBeanException e) {
throw new ServiceLifecycleException("Could not register token state service MBean", e);
}
}
}
Aggregations