Package ai.preferred.venom.job
Class FIFOScheduler
- java.lang.Object
-
- java.util.AbstractCollection<E>
-
- java.util.AbstractQueue<Job>
-
- ai.preferred.venom.job.AbstractQueueScheduler
-
- ai.preferred.venom.job.FIFOScheduler
-
- All Implemented Interfaces:
Scheduler,java.lang.Iterable<Job>,java.util.Collection<Job>,java.util.concurrent.BlockingQueue<Job>,java.util.Queue<Job>
public class FIFOScheduler extends AbstractQueueScheduler
This class provides and implementation of scheduler with a first in first out queue.Jobs in queue will be processed first in order of insertion.
- Author:
- Ween Jiann Lee
-
-
Constructor Summary
Constructors Constructor Description FIFOScheduler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidadd(@NotNull Request r, @NotNull Handler h, Priority p, Priority pf)Adds a request to the queue.booleanoffer(Job job, long timeout, java.util.concurrent.TimeUnit unit)Jobpoll()Jobpoll(long timeout, java.util.concurrent.TimeUnit unit)voidput(Job job)-
Methods inherited from class ai.preferred.venom.job.AbstractQueueScheduler
add, add, add, add, add, drainTo, drainTo, iterator, offer, peek, remainingCapacity, size, 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
-
-
-
-
Method Detail
-
add
public final void add(@NotNull @NotNull Request r, @NotNull @NotNull Handler h, Priority p, Priority pf)Description copied from interface:SchedulerAdds a request to the queue.This request would be parsed by the handler specified, and its priority can be downgraded to a minimum priority specified.
- Parameters:
r- request to fetch when dequeuedh- handler to be used to parse the requestp- initial priority of the requestpf- the minimum (floor) priority of this request
-
put
public final void put(@Nonnull Job job) throws java.lang.InterruptedException- Throws:
java.lang.InterruptedException
-
offer
public final boolean offer(Job job, long timeout, @Nonnull java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
poll
public final Job poll(long timeout, @Nonnull java.util.concurrent.TimeUnit unit) throws java.lang.InterruptedException
- Throws:
java.lang.InterruptedException
-
poll
public final Job poll()
-
-