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

org.infinispan.server.infinispan.actions.ResetInterceptorJmxStatisticsAction Maven / Gradle / Ivy

The newest version!
package org.infinispan.server.infinispan.actions;

import static org.jboss.as.clustering.infinispan.subsystem.CacheMetricsHandler.getFirstInterceptorWhichExtends;

import org.infinispan.AdvancedCache;
import org.infinispan.interceptors.AsyncInterceptor;
import org.infinispan.jmx.JmxStatisticsExposer;

/**
 * ResetInterceptorJmxStatisticsAction.
 * This class can be used to reset the statistics for a given interceptor that implements
 * {@link org.infinispan.interceptors.impl.JmxStatsCommandInterceptor} and is an interceptor in the cache's chain.
 *
 * @author wburns
 * @since 7.0
 */
public class ResetInterceptorJmxStatisticsAction extends AbstractAdvancedCacheAction {
   private final Class interceptorClass;

   public ResetInterceptorJmxStatisticsAction(AdvancedCache cache, Class interceptorClass) {
      super(cache);
      this.interceptorClass = interceptorClass;
   }

   @Override
   public Void run() {
      T interceptor = getFirstInterceptorWhichExtends(cache.getAsyncInterceptorChain().getInterceptors(), interceptorClass);
      if (interceptor != null) {
         interceptor.resetStatistics();
      }
      return null;
   }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy