Search in sources :

Example 1 with TokenStateServiceStatistics

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);
        }
    }
}
Also used : MalformedObjectNameException(javax.management.MalformedObjectNameException) NotCompliantMBeanException(javax.management.NotCompliantMBeanException) InstanceAlreadyExistsException(javax.management.InstanceAlreadyExistsException) ServiceLifecycleException(org.apache.knox.gateway.services.ServiceLifecycleException) TokenStateServiceStatistics(org.apache.knox.gateway.services.token.TokenStateServiceStatistics) MBeanRegistrationException(javax.management.MBeanRegistrationException) ObjectName(javax.management.ObjectName)

Aggregations

InstanceAlreadyExistsException (javax.management.InstanceAlreadyExistsException)1 MBeanRegistrationException (javax.management.MBeanRegistrationException)1 MalformedObjectNameException (javax.management.MalformedObjectNameException)1 NotCompliantMBeanException (javax.management.NotCompliantMBeanException)1 ObjectName (javax.management.ObjectName)1 ServiceLifecycleException (org.apache.knox.gateway.services.ServiceLifecycleException)1 TokenStateServiceStatistics (org.apache.knox.gateway.services.token.TokenStateServiceStatistics)1