Package org.dspace.curate
Interface TaskQueue
-
- All Known Implementing Classes:
FileTaskQueue
public interface TaskQueueTaskQueue objects manage access to named queues of task entries. Entries represent curation task requests that have been deferred. The queue supports concurrent non-blocking writers, but controls read access to a single reader possessing a ticket (first come, first serve). After the read, the queue remains locked until released by the reader, after which it is typically purged.- Author:
- richardrodgers
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description Set<TaskQueueEntry>dequeue(String queueName, long ticket)Returns the set of task entries from the named queue.voidenqueue(String queueName, Set<TaskQueueEntry> entrySet)Queues a set of task entries to a named queue.voidenqueue(String queueName, TaskQueueEntry entry)Queues a single entry to a named queue.String[]queueNames()Returns list of queue names.voidrelease(String queueName, long ticket, boolean removeEntries)Releases the lock upon the named queue, deleting it ifremoveEntriesis set to true.
-
-
-
Method Detail
-
queueNames
String[] queueNames()
Returns list of queue names.- Returns:
- queues the list of names of active queues
-
enqueue
void enqueue(String queueName, TaskQueueEntry entry) throws IOException
Queues a single entry to a named queue.- Parameters:
queueName- the name of the queue on which to writeentry- the task entry- Throws:
IOException- if IO error
-
enqueue
void enqueue(String queueName, Set<TaskQueueEntry> entrySet) throws IOException
Queues a set of task entries to a named queue.- Parameters:
queueName- the name of the queue on which to writeentrySet- the set of task entries- Throws:
IOException- if IO error
-
dequeue
Set<TaskQueueEntry> dequeue(String queueName, long ticket) throws IOException
Returns the set of task entries from the named queue. The operation locks the queue from any further enqueue or dequeue operations until areleaseis called. The ticket may be any number, but a timestamp should guarantee sufficient uniqueness.- Parameters:
queueName- the name of the queue to readticket- a token which must be presented to release the queue- Returns:
- set the current set of queued task entries
- Throws:
IOException- if IO error
-
release
void release(String queueName, long ticket, boolean removeEntries)
Releases the lock upon the named queue, deleting it ifremoveEntriesis set to true.- Parameters:
queueName- the name of the queue to releaseticket- a token that was presented when queue was dequeued.removeEntries- flag to indicate whether entries may be deleted
-
-