Package ai.preferred.venom.job
Class AbstractJobQueue
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<Job>
-
- ai.preferred.venom.job.AbstractJobQueue
-
- All Implemented Interfaces:
Iterable<Job>
,Collection<Job>
,BlockingQueue<Job>
,Queue<Job>
- Direct Known Subclasses:
AbstractPriorityJobQueue
,FIFOJobQueue
public abstract class AbstractJobQueue extends AbstractQueue<Job> implements BlockingQueue<Job>
- Author:
- Ween Jiann Lee, Maksim Tkachenko
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJobQueue(BlockingQueue<Job> queue)
Constructs an instance of AbstractJobQueue.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
drainTo(Collection<? super Job> c)
int
drainTo(Collection<? super Job> c, int maxElements)
protected BlockingQueue<Job>
getQueue()
Get the BlockingQueue backing this scheduler.Iterator<Job>
iterator()
Job
peek()
int
remainingCapacity()
int
size()
Job
take()
-
Methods inherited from class java.util.AbstractCollection
contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface java.util.concurrent.BlockingQueue
add, contains, offer, offer, poll, put, remove
-
Methods inherited from interface java.util.Collection
addAll, clear, containsAll, equals, hashCode, isEmpty, parallelStream, removeAll, removeIf, retainAll, spliterator, stream, toArray, toArray, toArray
-
-
-
-
Constructor Detail
-
AbstractJobQueue
protected AbstractJobQueue(BlockingQueue<Job> queue)
Constructs an instance of AbstractJobQueue.- Parameters:
queue
- an instance of BlockingQueue
-
-
Method Detail
-
iterator
@Nonnull public final Iterator<Job> iterator()
- Specified by:
iterator
in interfaceCollection<Job>
- Specified by:
iterator
in interfaceIterable<Job>
- Specified by:
iterator
in classAbstractCollection<Job>
-
size
public final int size()
- Specified by:
size
in interfaceCollection<Job>
- Specified by:
size
in classAbstractCollection<Job>
-
take
@Nonnull public final Job take() throws InterruptedException
- Specified by:
take
in interfaceBlockingQueue<Job>
- Throws:
InterruptedException
-
remainingCapacity
public final int remainingCapacity()
- Specified by:
remainingCapacity
in interfaceBlockingQueue<Job>
-
drainTo
public final int drainTo(@Nonnull Collection<? super Job> c)
- Specified by:
drainTo
in interfaceBlockingQueue<Job>
-
drainTo
public final int drainTo(@Nonnull Collection<? super Job> c, int maxElements)
- Specified by:
drainTo
in interfaceBlockingQueue<Job>
-
getQueue
protected final BlockingQueue<Job> getQueue()
Get the BlockingQueue backing this scheduler.- Returns:
- an instance of BlockingQueue
-
-