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 theirIndexableType.
-
-
Constructor Summary
Constructors Constructor Description AbstractQueueProvider(int queueSize)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract <T> ReindexQueue<T>createQueue(com.broadleafcommerce.search.api.type.IndexableType type)Create a new queue for the givenIndexableType.voiddestroyQueue(ReindexQueue<?> queue)Takes the necessary steps to remove or destroy the Queue, if necessary.protected abstract voiddestroyQueueInternal(ReindexQueue<?> queue)Takes the necessary steps to remove or destroy the Queue, if necessary.<T> ReindexQueue<T>getOrCreateQueue(@NonNull com.broadleafcommerce.search.api.type.IndexableType type)Get the Queue for the givenIndexableType.protected Map<com.broadleafcommerce.search.api.type.IndexableType,ReindexQueue<?>>getQueueRegistry()Get the registry map registeringReindexQueuetoIndexableType.protected intgetQueueSize()The maximum allowed size of the queue.-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface com.broadleafcommerce.search.index.core.Distributable
isDistributed
-
-
-
-
Method Detail
-
getQueueRegistry
protected final Map<com.broadleafcommerce.search.api.type.IndexableType,ReindexQueue<?>> getQueueRegistry()
Get the registry map registeringReindexQueuetoIndexableType.- 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:QueueProviderGet the Queue for the givenIndexableType. 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:
getOrCreateQueuein interfaceQueueProvider- 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 givenIndexableType.- 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:QueueProviderTakes 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:
destroyQueuein interfaceQueueProvider- 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
-
-