Class AbstractCacheEventQueue<K,V>

java.lang.Object
org.apache.commons.jcs3.engine.AbstractCacheEventQueue<K,V>
All Implemented Interfaces:
ICacheEventQueue<K,V>
Direct Known Subclasses:
PooledCacheEventQueue

public abstract class AbstractCacheEventQueue<K,V> extends Object implements ICacheEventQueue<K,V>
An abstract base class to the different implementations
  • Field Details

  • Constructor Details

  • Method Details

    • getWaitToDieMillis

      public int getWaitToDieMillis()
      Returns the time to wait for events before killing the background thread.

      Returns:
      int
    • setWaitToDieMillis

      public void setWaitToDieMillis(int wtdm)
      Sets the time to wait for events before killing the background thread.

      Parameters:
      wtdm - the ms for the q to sit idle.
    • toString

      public String toString()
      Creates a brief string identifying the listener and the region.

      Overrides:
      toString in class Object
      Returns:
      String debugging info.
    • getListenerId

      public long getListenerId()
      Description copied from interface: ICacheEventQueue
      Gets the listenerId attribute of the ICacheEventQueue object
      Specified by:
      getListenerId in interface ICacheEventQueue<K,V>
      Returns:
      The listenerId value
    • getCacheName

      protected String getCacheName()
      Returns:
      the cacheName
    • initialize

      protected void initialize(ICacheListener<K,V> listener, long listenerId, String cacheName, int maxFailure, int waitBeforeRetry)
      Initializes the queue.

      Parameters:
      listener -
      listenerId -
      cacheName -
      maxFailure -
      waitBeforeRetry -
    • addPutEvent

      public void addPutEvent(ICacheElement<K,V> ce)
      This adds a put event to the queue. When it is processed, the element will be put to the listener.

      Specified by:
      addPutEvent in interface ICacheEventQueue<K,V>
      Parameters:
      ce - The feature to be added to the PutEvent attribute
      Throws:
      IOException
    • addRemoveEvent

      public void addRemoveEvent(K key)
      This adds a remove event to the queue. When processed the listener's remove method will be called for the key.

      Specified by:
      addRemoveEvent in interface ICacheEventQueue<K,V>
      Parameters:
      key - The feature to be added to the RemoveEvent attribute
      Throws:
      IOException
    • addRemoveAllEvent

      public void addRemoveAllEvent()
      This adds a remove all event to the queue. When it is processed, all elements will be removed from the cache.
      Specified by:
      addRemoveAllEvent in interface ICacheEventQueue<K,V>
    • addDisposeEvent

      public void addDisposeEvent()
      This adds a dispose event to the queue. When it is processed, the cache is shut down
      Specified by:
      addDisposeEvent in interface ICacheEventQueue<K,V>
    • put

      protected abstract void put(AbstractCacheEventQueue<K,V>.AbstractCacheEvent event)
      Adds an event to the queue.

      Parameters:
      event -
    • isWorking

      public boolean isWorking()
      Description copied from interface: ICacheEventQueue
      A Queue is working unless it has reached its max failure count.

      Specified by:
      isWorking in interface ICacheEventQueue<K,V>
      Returns:
      whether the queue is functional.
    • setWorking

      public void setWorking(boolean b)
      This means that the queue is functional. If we reached the max number of failures, the queue is marked as non functional and will never work again.

      Parameters:
      b -