Class HBDataCacheQueue<T>

  • Type Parameters:
    T -

    public class HBDataCacheQueue<T>
    extends Object
    Heartbeat cache implementation - data is consumed in batches and after that evicted from the cache.
    Author:
    Ancuta Morarasu
    • Field Detail

      • cache

        protected final Queue<T> cache
    • Constructor Detail

      • HBDataCacheQueue

        public HBDataCacheQueue()
    • Method Detail

      • add

        public void add​(T data)
      • addAll

        public void addAll​(List<T> data)
      • removeAll

        public void removeAll​(List<T> data)
      • clear

        public void clear()
      • persistCache

        public void persistCache()
      • loadCache

        public void loadCache()
      • size

        public int size()
      • setMaxEntries

        public void setMaxEntries​(long maxEntries)
      • process

        public void process​(int batchSize,
                            Consumer<List<T>> consumer)
        Data is consumed in batches; if the processing is successful, the batch is removed from the cache.
        Parameters:
        batchSize - the size of the batch to process
        consumer - the batch processor