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

org.infinispan.commons.stat.SimpleStateWithTimer Maven / Gradle / Ivy

There is a newer version: 15.1.0.Dev03
Show newest version
package org.infinispan.commons.stat;

import java.util.concurrent.TimeUnit;

/**
 * A {@link SimpleStat} implementation that also updates a {@link TimerTracker} object.
 *
 * @author Pedro Ruivo
 * @since 13.0
 */
public class SimpleStateWithTimer extends DefaultSimpleStat {

   private volatile TimerTracker timerTracker;

   @Override
   public void record(long value) {
      super.record(value);
      TimerTracker local = this.timerTracker;
      if (local != null) {
         local.update(value, TimeUnit.NANOSECONDS);
      }
   }

   @Override
   public void setTimer(TimerTracker timer) {
      this.timerTracker = timer;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy