Class AbstractQueueProvider
java.lang.Object
com.broadleafcommerce.search.index.core.queue.AbstractQueueProvider
- All Implemented Interfaces:
Distributable
,QueueProvider
- Direct Known Subclasses:
DefaultLocalQueueProvider
Abstract provider which stores queues in a map based on their
IndexableType
.-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract <T> ReindexQueue<T>
createQueue
(com.broadleafcommerce.search.api.type.IndexableType type) Create a new queue for the givenIndexableType
.final void
destroyQueue
(ReindexQueue<?> queue) Takes the necessary steps to remove or destroy the Queue, if necessary.protected abstract void
destroyQueueInternal
(ReindexQueue<?> queue) Takes the necessary steps to remove or destroy the Queue, if necessary.final <T> ReindexQueue<T>
getOrCreateQueue
(@NonNull com.broadleafcommerce.search.api.type.IndexableType type) Get the Queue for the givenIndexableType
.protected final Map<com.broadleafcommerce.search.api.type.IndexableType,
ReindexQueue<?>> Get the registry map registeringReindexQueue
toIndexableType
.protected int
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
-
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 registeringReindexQueue
toIndexableType
.- 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 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:
getOrCreateQueue
in 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: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 interfaceQueueProvider
- Parameters:
queue
- the queue to be destroyed- Throws:
com.broadleafcommerce.search.api.SearchIndexException
- if an error occurs trying to destroy the queue
-
destroyQueueInternal
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
-