Class TtlCollection<K>

  • Direct Known Subclasses:
    TtlMap, TtlSet

    public abstract class TtlCollection<K>
    extends java.lang.Object
    This class provides the mechanism to maintains the wrapped collection elements into the collection some time.
    Author:
    javaito
    • Constructor Summary

      Constructors 
      Constructor Description
      TtlCollection​(java.lang.Long timeWindowsSize)  
    • Method Summary

      Modifier and Type Method Description
      protected void addInstance​(K instance)
      Add instance into the ttl map.
      protected abstract void removeOldInstance​(K instanceKey)
      This implementation remove the specific instance of the wrapped collection.
      protected void removeOldWindows()
      Removes all the old elements of the wrapped collection.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • TtlCollection

        public TtlCollection​(java.lang.Long timeWindowsSize)
    • Method Detail

      • addInstance

        protected final void addInstance​(K instance)
        Add instance into the ttl map.
        Parameters:
        instance - Instance to add.
      • removeOldWindows

        protected final void removeOldWindows()
        Removes all the old elements of the wrapped collection.
      • removeOldInstance

        protected abstract void removeOldInstance​(K instanceKey)
        This implementation remove the specific instance of the wrapped collection.
        Parameters:
        instanceKey - Instance key.