Class SuppressCache<T>

java.lang.Object
org.jgroups.util.SuppressCache<T>

public class SuppressCache<T> extends Object
Cache which keeps a timestamp and counter for every key. When a timestamp has expired (based on an expiry time), the corresponding key is removed.

This cache is mainly used to suppress identical warning messages (in TP), e.g. if we get 1000 warnings about reception of messages from P (who's not in our cluster), we can print such a message only every 60 seconds (expiry time = 60 secs).

Since:
3.2
  • Field Details

  • Constructor Details

    • SuppressCache

      public SuppressCache()
  • Method Details

    • putIfAbsent

      public SuppressCache.Value putIfAbsent(T key, long expiry_time)
      Adds a new key to the hashmap, or updates the value associated with the existing key if present. If expiry_time is greater than the age of the value, the key will be removed.
      Parameters:
      key - The key
      expiry_time - Expiry time (in ms)
      Returns:
      Null if the key was present and not expired, or the value associated with the existing key (its count incremented)
    • clear

      public void clear()
    • retainAll

      public void retainAll(Collection<T> list)
    • removeAll

      public void removeAll(Collection<T> list)
    • removeExpired

      public void removeExpired(long expiry_time)
    • size

      public int size()
      Returns the total count of all values
    • toString

      public String toString()
      Overrides:
      toString in class Object