public class DefaultTaskQueueService extends Object implements TaskQueueService
| Modifier and Type | Field and Description |
|---|---|
static String |
DEFAULT_QUEUE_NAME
default queue name if no queue name was given
|
| Constructor and Description |
|---|
DefaultTaskQueueService(com.spikeify.Spikeify spikeify) |
| Modifier and Type | Method and Description |
|---|---|
QueueTask |
add(Job job,
String queueName)
Adds job to queue
|
List<QueueTask> |
list(TaskState state,
String queueName)
Lists all tasks from queue in given state
|
QueueTask |
next(String queueName)
Returns next open and put's it into running state
...
|
TaskStatistics |
purge(TaskState state,
int taskAge,
String queueName)
Removes tasks from queue
|
protected boolean |
remove(QueueTask task)
Removes job from queue
|
QueueTask |
transition(QueueTask task,
TaskState newState)
Transitions job from current state to new state
This is done in transaction so only one thread can change the state (this is then the worker thread for this job)
|
public static final String DEFAULT_QUEUE_NAME
public DefaultTaskQueueService(com.spikeify.Spikeify spikeify)
public QueueTask add(Job job, String queueName)
TaskQueueServiceadd in interface TaskQueueServicejob - to be executedqueueName - name of queuepublic QueueTask next(String queueName)
next in interface TaskQueueServicequeueName - name of queuepublic List<QueueTask> list(TaskState state, String queueName)
TaskQueueServicelist in interface TaskQueueServicestate - job is inqueueName - name of queuepublic QueueTask transition(QueueTask task, TaskState newState)
TaskQueueServicetransition in interface TaskQueueServicetask - to transition statenewState - to transition toprotected boolean remove(QueueTask task)
task - to be removedpublic TaskStatistics purge(TaskState state, int taskAge, String queueName)
TaskQueueServicepurge in interface TaskQueueServicestate - of tasks to be removedtaskAge - age in minutes to allow action, 0 == now or neverqueueName - name of queueCopyright © 2015–2016. All rights reserved.