Class AtomicRatio

java.lang.Object
org.apache.cassandra.index.sai.utils.AtomicRatio

public class AtomicRatio extends Object
AtomicRatio provides thread safe operations to maintain a AtomicRatio.Ratio of a numerator and denominator. The ratio can be updated atomically by multiple threads calling the update(long, long) method. The current ratio value can be retrieved via the get() method.

The class also provides a thread safe updateCount that maintains the number of times the AtomicRatio.Ratio has been updated. This can be used to determine whether the AtomicRatio.Ratio is useful based on the number of updates.

  • Constructor Details

    • AtomicRatio

      public AtomicRatio()
  • Method Details

    • update

      public void update(long numerator, long denominator)
    • get

      public double get()
    • getUpdateCount

      public int getUpdateCount()