public class FifoMappedJobQueue extends Object implements MappedJobQueue
JobQueue
that ensures
the FIFO execution of jobs.Constructor and Description |
---|
FifoMappedJobQueue(int maxSize,
JobRepository repo) |
Modifier and Type | Method and Description |
---|---|
String |
addJob(JobSpec spec)
Persists a
JobSpec to the queue. |
void |
addQueue(String queueName)
Add a queue with the given name.
|
int |
getCapacity()
This method returns the number of jobs in any given queue that can be
retained in the queue.
|
JobRepository |
getJobRepository()
|
JobSpec |
getNextJob()
Gets the next
JobSpec from the queue, and correspondingly removes
it from persitance. |
JobSpec |
getNextJob(String queueName)
Gets the next
JobSpec in the queue with the given name. |
List |
getQueuedJobs()
|
List<JobSpec> |
getQueuedJobs(String queueName)
Gets a list of all queued jobs that belong to the queue with the given
name.
|
List<String> |
getQueueNames() |
int |
getSize()
Gets the number of jobs in queue
|
int |
getSize(String queueName)
Gets the number of jobs in the queue with the given name.
|
boolean |
isEmpty()
Returns a boolean value representing whether or not the queue is empty.
|
boolean |
isEmpty(String queueName)
Returns a boolean value representing whether or not the job queue contains
jobs in the given queue.
|
void |
promoteJob(JobSpec spec) |
void |
promoteKeyValPair(String key,
String val) |
void |
purge()
Purges all
JobSpec s from the queue. |
void |
removeJob(JobSpec spec)
Removes the
JobSpec with the given ID from the queue. |
void |
removeQueue(String queueName)
Remove the queue with the given name.
|
String |
requeueJob(JobSpec spec)
Re-adds a
JobSpec to the back of the queue. |
public FifoMappedJobQueue(int maxSize, JobRepository repo)
public String addJob(JobSpec spec) throws JobQueueException
JobQueue
JobSpec
to the queue.addJob
in interface JobQueue
addJob
in interface MappedJobQueue
spec
- The JobSpec
to persist.JobQueueException
- If there is any error queueing the JobSpec
.org.apache.oodt.cas.resource.jobqueue.JobQueue.addJob(JobSpec)
public String requeueJob(JobSpec spec) throws JobQueueException
JobQueue
JobSpec
to the back of the queue.requeueJob
in interface JobQueue
requeueJob
in interface MappedJobQueue
spec
- The JobSpec
to re-add.JobQueueException
- If there is any error requeueing the JobSpec
.org.apache.oodt.cas.resource.jobqueue.JobQueue.requeueJob(JobSpec)
public List getQueuedJobs()
JobQueue
getQueuedJobs
in interface JobQueue
List
of queued JobSpec
s.org.apache.oodt.cas.resource.jobqueue.JobQueue.getQueuedJobs()
public List<JobSpec> getQueuedJobs(String queueName) throws JobQueueException, JobRepositoryException
MappedJobQueue
getQueuedJobs
in interface MappedJobQueue
queueName
- The name of the queue whose members will be given.List
of queued s from the given queue.JobQueueException
- If the given queue name is null or if no queue with the given
name exists.JobRepositoryException
public void purge()
JobQueue
JobSpec
s from the queue.public boolean isEmpty()
JobQueue
public boolean isEmpty(String queueName) throws JobQueueException
MappedJobQueue
isEmpty
in interface MappedJobQueue
queueName
- The name of the queue which you are checking.JobQueueException
- If the given queue name is null or if no queue with that name
exists.public JobSpec getNextJob()
JobQueue
JobSpec
from the queue, and correspondingly removes
it from persitance.getNextJob
in interface JobQueue
JobSpec
from the queue.org.apache.oodt.cas.resource.jobqueue.JobQueue.getNextJob()
public JobSpec getNextJob(String queueName) throws JobQueueException, JobRepositoryException
MappedJobQueue
JobSpec
in the queue with the given name.getNextJob
in interface MappedJobQueue
queueName
- The name of the queue from which the next JobSpec
will be
returned.JobSpec
from the jobqueue belonging to the queue
with the given name.JobQueueException
- If the given queue name is null or if no queue with that name
exists.JobRepositoryException
public JobRepository getJobRepository()
JobQueue
getJobRepository
in interface JobQueue
JobRepository
.org.apache.oodt.cas.resource.jobqueue.JobQueue.getJobRepository()
public int getSize()
JobQueue
public int getSize(String queueName) throws JobQueueException
MappedJobQueue
getSize
in interface MappedJobQueue
queueName
- The name of the queue whos size will be given.JobSpec
s in the queue with the given name.JobQueueException
- If the given queue name is null or if no queue with that name
exists.public int getCapacity()
getCapacity
in interface JobQueue
public void removeJob(JobSpec spec) throws JobQueueException
MappedJobQueue
JobSpec
with the given ID from the queue.removeJob
in interface MappedJobQueue
JobQueueException
- If no JobSpec
has the given ID.public void addQueue(String queueName) throws JobQueueException
MappedJobQueue
addQueue
in interface MappedJobQueue
queueName
- The name of the queue to be created.JobQueueException
- If the given queue name is null or if a queue with the given name
already exists.public void removeQueue(String queueName) throws JobQueueException
MappedJobQueue
removeQueue
in interface MappedJobQueue
queueName
- The name of the queue to be removed.JobQueueException
- If the given queue name is null or if no queue with the given
name exists.public void promoteJob(JobSpec spec) throws JobQueueException
promoteJob
in interface MappedJobQueue
JobQueueException
public void promoteKeyValPair(String key, String val) throws JobQueueException, JobRepositoryException
promoteKeyValPair
in interface MappedJobQueue
JobQueueException
JobRepositoryException
Copyright © 1999–2017 Apache OODT. All rights reserved.