Class AbstractDelegatingQueue<T>
- java.lang.Object
-
- com.broadleafcommerce.search.index.core.queue.AbstractDelegatingQueue<T>
-
- Type Parameters:
T- The type that will be on theReindexQueue.
- All Implemented Interfaces:
Distributable,IndexableTypeAware,ReindexQueue<T>,Iterable<T>,Collection<T>,BlockingQueue<T>,Queue<T>
- Direct Known Subclasses:
DefaultLocalArrayBlockingDelegatingQueue
public abstract class AbstractDelegatingQueue<T> extends Object implements ReindexQueue<T>
Abstract implementation of a ReindexQueue that delegates its work to any implementation of a BlockingQueue.- Author:
- Kelly Tisdell
-
-
Constructor Summary
Constructors Constructor Description AbstractDelegatingQueue(@NonNull com.broadleafcommerce.search.api.type.IndexableType type, @NonNull BlockingQueue<T> delegate)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanadd(T e)booleanaddAll(Collection<? extends T> c)voidclear()booleancontains(Object o)booleancontainsAll(Collection<?> c)intdrainTo(Collection<? super T> c)intdrainTo(Collection<? super T> c, int maxElements)Telement()BlockingQueue<T>getDelegate()The underlying queue which all work is delegated to.com.broadleafcommerce.search.api.type.IndexableTypegetIndexableType()Components that implement this method should return the same, non-null value on each invocation.StringgetQueueName()Any arbitrary Queue name.booleanisEmpty()booleanisLoaded()Indicates whether more data will be added to the Queue.Iterator<T>iterator()voidmarkLoaded()Mark that there is no more data to add to this queue.booleanoffer(T e)booleanoffer(T e, long timeout, TimeUnit unit)Tpeek()Tpoll()Tpoll(long timeout, TimeUnit unit)voidput(T e)intremainingCapacity()Tremove()booleanremove(Object o)booleanremoveAll(Collection<?> c)booleanretainAll(Collection<?> c)intsize()Ttake()Object[]toArray()<E> E[]toArray(E[] a)-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface java.util.Collection
equals, hashCode, parallelStream, removeIf, spliterator, stream, toArray
-
Methods inherited from interface com.broadleafcommerce.search.index.core.Distributable
isDistributed
-
-
-
-
Constructor Detail
-
AbstractDelegatingQueue
public AbstractDelegatingQueue(@NonNull @NonNull com.broadleafcommerce.search.api.type.IndexableType type, @NonNull @NonNull BlockingQueue<T> delegate)
-
-
Method Detail
-
getQueueName
public final String getQueueName()
Description copied from interface:ReindexQueueAny arbitrary Queue name.- Specified by:
getQueueNamein interfaceReindexQueue<T>- Returns:
- the name for the queue
-
isLoaded
public final boolean isLoaded()
Description copied from interface:ReindexQueueIndicates whether more data will be added to the Queue. Returns true if there is no more data to add.- Specified by:
isLoadedin interfaceReindexQueue<T>- Returns:
- whether the queue is fully loaded and no more data will be added
-
markLoaded
public final void markLoaded()
Description copied from interface:ReindexQueueMark that there is no more data to add to this queue.- Specified by:
markLoadedin interfaceReindexQueue<T>
-
getIndexableType
public final com.broadleafcommerce.search.api.type.IndexableType getIndexableType()
Description copied from interface:IndexableTypeAwareComponents that implement this method should return the same, non-null value on each invocation. This should basically return a constant value.- Specified by:
getIndexableTypein interfaceIndexableTypeAware- Returns:
- the associated indexable type
-
add
public boolean add(T e)
- Specified by:
addin interfaceBlockingQueue<T>- Specified by:
addin interfaceCollection<T>- Specified by:
addin interfaceQueue<T>
-
offer
public boolean offer(T e)
-
put
public void put(T e) throws InterruptedException
- Specified by:
putin interfaceBlockingQueue<T>- Throws:
InterruptedException
-
offer
public boolean offer(T e, long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
offerin interfaceBlockingQueue<T>- Throws:
InterruptedException
-
take
public T take() throws InterruptedException
- Specified by:
takein interfaceBlockingQueue<T>- Throws:
InterruptedException
-
poll
public T poll(long timeout, TimeUnit unit) throws InterruptedException
- Specified by:
pollin interfaceBlockingQueue<T>- Throws:
InterruptedException
-
remainingCapacity
public int remainingCapacity()
- Specified by:
remainingCapacityin interfaceBlockingQueue<T>
-
remove
public boolean remove(Object o)
- Specified by:
removein interfaceBlockingQueue<T>- Specified by:
removein interfaceCollection<T>
-
contains
public boolean contains(Object o)
- Specified by:
containsin interfaceBlockingQueue<T>- Specified by:
containsin interfaceCollection<T>
-
drainTo
public int drainTo(Collection<? super T> c)
- Specified by:
drainToin interfaceBlockingQueue<T>
-
drainTo
public int drainTo(Collection<? super T> c, int maxElements)
- Specified by:
drainToin interfaceBlockingQueue<T>
-
size
public int size()
- Specified by:
sizein interfaceCollection<T>
-
isEmpty
public boolean isEmpty()
- Specified by:
isEmptyin interfaceCollection<T>
-
toArray
public Object[] toArray()
- Specified by:
toArrayin interfaceCollection<T>
-
toArray
public <E> E[] toArray(E[] a)
- Specified by:
toArrayin interfaceCollection<T>
-
containsAll
public boolean containsAll(Collection<?> c)
- Specified by:
containsAllin interfaceCollection<T>
-
addAll
public boolean addAll(Collection<? extends T> c)
- Specified by:
addAllin interfaceCollection<T>
-
removeAll
public boolean removeAll(Collection<?> c)
- Specified by:
removeAllin interfaceCollection<T>
-
retainAll
public boolean retainAll(Collection<?> c)
- Specified by:
retainAllin interfaceCollection<T>
-
clear
public void clear()
- Specified by:
clearin interfaceCollection<T>
-
getDelegate
public BlockingQueue<T> getDelegate()
The underlying queue which all work is delegated to.- Returns:
- the underlying delegate queue
-
-