Package org.duracloud.common.queue.local
Class LocalTaskQueue
java.lang.Object
org.duracloud.common.queue.local.LocalTaskQueue
- All Implemented Interfaces:
TaskQueue
This class implements a local, in-memory task queue. (It is intended to use
for testing purposes.)
- Author:
- Daniel Bernstein Date: Oct 24, 2013
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddeleteTask(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.longintgetName()A name identifying the queue used for logging and analysis purposes.voidputs multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidputs a task on the queuevoidputs multiple tasks on the queue using batch puts if the queue implementation supports batch putsvoidRequeues the task by deleting the task, incrementing the "attempts" counter, and re-adding back to the queue.size()take()Blocks until a task is availabletake(int maxTasks) Take a max of specified number of tasks.
-
Constructor Details
-
LocalTaskQueue
public LocalTaskQueue()
-
-
Method Details
-
getName
Description copied from interface:TaskQueueA name identifying the queue used for logging and analysis purposes. -
put
Description copied from interface:TaskQueueputs a task on the queue -
put
Description copied from interface:TaskQueueputs multiple tasks on the queue using batch puts if the queue implementation supports batch puts -
put
Description copied from interface:TaskQueueputs multiple tasks on the queue using batch puts if the queue implementation supports batch puts -
take
Description copied from interface:TaskQueueBlocks until a task is available- Specified by:
takein interfaceTaskQueue- Returns:
- Throws:
TimeoutException
-
extendVisibilityTimeout
Description copied from interface:TaskQueueResponsible for robustly extending the visibility timeout of a Task.- Specified by:
extendVisibilityTimeoutin interfaceTaskQueue- Throws:
TaskNotFoundException
-
deleteTask
Description copied from interface:TaskQueueDeletes a task from the queue.- Specified by:
deleteTaskin interfaceTaskQueue- Throws:
TaskNotFoundException
-
size
-
getInprocessCount
public int getInprocessCount() -
getCompletedCount
public long getCompletedCount() -
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
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
Description copied from interface:TaskQueueDeletes a set of tasks- Specified by:
deleteTasksin interfaceTaskQueue- Throws:
TaskException
-
take
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
-