Package org.duracloud.common.queue.local
Class LocalTaskQueue
- java.lang.Object
-
- org.duracloud.common.queue.local.LocalTaskQueue
-
-
Constructor Summary
Constructors Constructor Description LocalTaskQueue()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddeleteTask(Task task)Deletes a task from the queue.voiddeleteTasks(Set<Task> tasks)Deletes a set of tasksvoidextendVisibilityTimeout(Task task)Responsible for robustly extending the visibility timeout of a Task.longgetCompletedCount()intgetInprocessCount()StringgetName()A name identifying the queue used for logging and analysis purposes.voidput(Set<Task> tasks)puts multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidput(Task task)puts a task on the queuevoidput(Task... tasks)puts multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidrequeue(Task task)Requeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue.Integersize()IntegersizeIncludingInvisibleAndDelayed()Tasktake()Blocks until a task is availableSet<Task>take(int maxTasks)Take a max of specified number of tasks.
-
-
-
Method Detail
-
getName
public String getName()
Description copied from interface:TaskQueueA name identifying the queue used for logging and analysis purposes.
-
put
public void put(Task task)
Description copied from interface:TaskQueueputs a task on the queue
-
put
public void put(Task... tasks)
Description copied from interface:TaskQueueputs multiple tasks on the queue using batch puts if the queue implementation supports batch puts
-
put
public void put(Set<Task> tasks)
Description copied from interface:TaskQueueputs multiple tasks on the queue using batch puts if the queue implementation supports batch puts
-
take
public Task take() throws TimeoutException
Description copied from interface:TaskQueueBlocks until a task is available- Specified by:
takein interfaceTaskQueue- Returns:
- Throws:
TimeoutException
-
extendVisibilityTimeout
public void extendVisibilityTimeout(Task task) throws TaskNotFoundException
Description copied from interface:TaskQueueResponsible for robustly extending the visibility timeout of a Task.- Specified by:
extendVisibilityTimeoutin interfaceTaskQueue- Throws:
TaskNotFoundException
-
deleteTask
public void deleteTask(Task task) throws TaskNotFoundException
Description copied from interface:TaskQueueDeletes a task from the queue.- Specified by:
deleteTaskin interfaceTaskQueue- Throws:
TaskNotFoundException
-
size
public Integer size()
-
getInprocessCount
public int getInprocessCount()
-
getCompletedCount
public long getCompletedCount()
-
sizeIncludingInvisibleAndDelayed
public Integer sizeIncludingInvisibleAndDelayed()
- Specified by:
sizeIncludingInvisibleAndDelayedin interfaceTaskQueue- Returns:
- The approximate number of elements in this queue including all items that are visible (available for takes), invisible (in process - not yet completed), and delayed (pending addition to the queue).
-
requeue
public void requeue(Task task)
Description copied from interface:TaskQueueRequeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue. Any subsequent calls on the requeued task via the task queue should fail due to the task not being found.
-
deleteTasks
public void deleteTasks(Set<Task> tasks) throws TaskException
Description copied from interface:TaskQueueDeletes a set of tasks- Specified by:
deleteTasksin interfaceTaskQueue- Throws:
TaskException
-
take
public Set<Task> take(int maxTasks) throws TimeoutException
Description copied from interface:TaskQueueTake a max of specified number of tasks. Blocks until at least one task is available.- Specified by:
takein interfaceTaskQueue- Parameters:
maxTasks- to take from queue. Must be between 1 and 10 inclusive.- Returns:
- Throws:
TimeoutException
-
-