Class AbstractQueueProvider

java.lang.Object
com.broadleafcommerce.search.index.core.queue.AbstractQueueProvider
All Implemented Interfaces:
Distributable, QueueProvider
Direct Known Subclasses:
DefaultLocalQueueProvider

public abstract class AbstractQueueProvider extends Object implements QueueProvider
Abstract provider which stores queues in a map based on their IndexableType.
  • Constructor Details

    • AbstractQueueProvider

      public AbstractQueueProvider(int queueSize)
  • Method Details

    • getQueueRegistry

      protected final Map<com.broadleafcommerce.search.api.type.IndexableType,ReindexQueue<?>> getQueueRegistry()
      Get the registry map registering ReindexQueue to IndexableType.
      Returns:
      a map registering a queue for each indexable type
    • getOrCreateQueue

      public final <T> ReindexQueue<T> getOrCreateQueue(@NonNull @NonNull com.broadleafcommerce.search.api.type.IndexableType type)
      Description copied from interface: QueueProvider
      Get the Queue for the given IndexableType. If the Queue does not exist yet, creates a new queue and registers it for the type.

      When creating a new Queue, the ReindexQueue.getQueueName() will be 'IndexableType.getType()'. For example, 'PRODUCT'.

      Specified by:
      getOrCreateQueue in interface QueueProvider
      Parameters:
      type - the type to get or create the queue for
      Returns:
      the queue registered for the type
    • createQueue

      protected abstract <T> ReindexQueue<T> createQueue(com.broadleafcommerce.search.api.type.IndexableType type)
      Create a new queue for the given IndexableType.
      Type Parameters:
      T - the type of object the queue will hold
      Parameters:
      type - the type to create a queue for
      Returns:
      a new queue for the indexable type
    • destroyQueue

      public final void destroyQueue(ReindexQueue<?> queue) throws com.broadleafcommerce.search.api.SearchIndexException
      Description copied from interface: QueueProvider
      Takes the necessary steps to remove or destroy the Queue, if necessary. Otherwise, this will be a pass-through (e.g. when the Queue is in-memory and has no cleanup requirements).
      Specified by:
      destroyQueue in interface QueueProvider
      Parameters:
      queue - the queue to be destroyed
      Throws:
      com.broadleafcommerce.search.api.SearchIndexException - if an error occurs trying to destroy the queue
    • destroyQueueInternal

      protected abstract void destroyQueueInternal(ReindexQueue<?> queue)
      Takes the necessary steps to remove or destroy the Queue, if necessary. Otherwise, this will be a pass-through (e.g. when the Queue is in-memory and has no cleanup requirements).
      Parameters:
      queue - the queue to be destroyed
    • getQueueSize

      protected int getQueueSize()
      The maximum allowed size of the queue.
      Returns:
      maximum allowed size of the queue