Class AccessCounter


  • class AccessCounter
    extends Object
    Counts connection attempts and decides if specified thresholds have been breached.
    Since:
    0.9.40
    • Constructor Detail

      • AccessCounter

        AccessCounter()
    • Method Detail

      • recordAccess

        void recordAccess​(long now)
        records that a connection attempt was made
        Parameters:
        now - the current time
      • isBreached

        boolean isBreached​(Threshold threshold,
                           long now)
        Parameters:
        threshold - definition of a threshold
        now - current time
        Returns:
        true if the given threshold has been breached
      • purge

        boolean purge​(long olderThan)
        Purges old accesses from the list.
        Parameters:
        olderThan - remove all accesses older than the given timestamp
        Returns:
        true if there is nothing left in the access history