All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.infinispan.client.hotrod.configuration.StatisticsConfiguration Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev04
Show newest version
package org.infinispan.client.hotrod.configuration;

import static org.infinispan.commons.configuration.attributes.IdentityAttributeCopier.identityCopier;

import org.infinispan.commons.configuration.attributes.Attribute;
import org.infinispan.commons.configuration.attributes.AttributeDefinition;
import org.infinispan.commons.configuration.attributes.AttributeSet;
import org.infinispan.commons.jmx.MBeanServerLookup;
import org.infinispan.commons.jmx.PlatformMBeanServerLookup;
import org.infinispan.commons.util.Util;

/**
 * @author Tristan Tarrant
 * @since 9.4
 */
public class StatisticsConfiguration {
   public static final AttributeDefinition ENABLED = AttributeDefinition.builder("enabled", false).immutable().build();
   public static final AttributeDefinition JMX_ENABLED = AttributeDefinition.builder("jmx_enabled", false).immutable().build();
   public static final AttributeDefinition JMX_DOMAIN = AttributeDefinition.builder("jmx_domain", "org.infinispan").immutable().build();
   public static final AttributeDefinition MBEAN_SERVER_LOOKUP = AttributeDefinition.builder("mbeanserverlookup", (MBeanServerLookup) Util.getInstance(PlatformMBeanServerLookup.class))
         .copier(identityCopier()).immutable().build();
   public static final AttributeDefinition JMX_NAME = AttributeDefinition.builder("jmx_name", "Default").immutable().build();
   static AttributeSet attributeDefinitionSet() {
      return new AttributeSet(StatisticsConfiguration.class, ENABLED, JMX_ENABLED, JMX_DOMAIN, MBEAN_SERVER_LOOKUP, JMX_NAME);
   }

   private final Attribute enabled;
   private final Attribute jmxEnabled;
   private final Attribute jmxDomain;
   private final Attribute jmxName;
   private final Attribute mBeanServerLookup;

   private final AttributeSet attributes;

   StatisticsConfiguration(AttributeSet attributes) {
      this.attributes = attributes.checkProtection();
      this.enabled = attributes.attribute(ENABLED);
      this.jmxEnabled = attributes.attribute(JMX_ENABLED);
      this.jmxDomain = attributes.attribute(JMX_DOMAIN);
      this.jmxName = attributes.attribute(JMX_NAME);
      this.mBeanServerLookup = attributes.attribute(MBEAN_SERVER_LOOKUP);
   }

   public AttributeSet attributes() {
      return attributes;
   }

   public boolean enabled() {
      return enabled.get();
   }

   public boolean jmxEnabled() {
      return jmxEnabled.get();
   }

   public String jmxDomain() {
      return jmxDomain.get();
   }

   public MBeanServerLookup mbeanServerLookup() {
      return mBeanServerLookup.get();
   }

   public String jmxName() {
      return jmxName.get();
   }

   @Override
   public String toString() {
      return attributes.toString(StatisticsConfiguration.class.getSimpleName());
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy