public interface Queue
extends java.lang.Iterable<java.lang.String>
QueueSimple
queues, an element can only contain one
binary string.
Modifier and Type | Method and Description |
---|---|
java.lang.String |
add(byte[] data)
Add byte array data to the queue.
|
java.lang.String |
add(java.lang.String data)
Add String data to the queue.
|
java.lang.String |
addPath(java.lang.String path)
Add the given file (identified by its path) to the queue and return the
corresponding element name, the file must be on the same filesystem and
will be moved to the queue.
|
int |
count()
Return the number of elements in the queue.
|
java.lang.String |
get(java.lang.String name)
Get the given locked element as String data.
|
byte[] |
getAsByteArray(java.lang.String name)
Get the given locked element as byte array data.
|
java.lang.String |
getId()
Return a unique identifier for the queue.
|
java.lang.String |
getPath(java.lang.String name)
Get the path of the given locked element.
|
java.lang.String |
getQueuePath()
Return the path of the queue.
|
boolean |
lock(java.lang.String name)
Lock an element in permissive mode.
|
boolean |
lock(java.lang.String name,
boolean permissive)
Lock an element.
|
void |
purge()
Purge the queue by removing unused intermediate directories, removing too
old temporary elements and unlocking too old locked elements (aka staled
locks); note: this can take a long time on queues with many elements.
|
void |
purge(int maxLock)
Purge the queue by removing unused intermediate directories, removing too
old temporary elements and unlocking too old locked elements (aka staled
locks); note: this can take a long time on queues with many elements.
|
void |
purge(int maxLock,
int maxTemp)
Purge the queue by removing unused intermediate directories, removing too
old temporary elements and unlocking too old locked elements (aka staled
locks); note: this can take a long time on queues with many elements.
|
void |
remove(java.lang.String name)
Remove a locked element from the queue.
|
boolean |
unlock(java.lang.String name)
Unlock an element in non-permissive mode.
|
boolean |
unlock(java.lang.String name,
boolean permissive)
Unlock an element.
|
java.lang.String getQueuePath()
java.lang.String getId()
java.lang.String add(java.lang.String data) throws java.io.IOException
data
- data to be addedjava.io.IOException
- if any file operation failsjava.lang.String add(byte[] data) throws java.io.IOException
data
- data to be addedjava.io.IOException
- if any file operation failsjava.lang.String addPath(java.lang.String path) throws java.io.IOException
path
- path of the file to be addedjava.io.IOException
- if any file operation failsjava.lang.String get(java.lang.String name) throws java.io.IOException
name
- name of the element to be retrievedjava.io.IOException
byte[] getAsByteArray(java.lang.String name) throws java.io.IOException
name
- name of the element to be retrievedjava.io.IOException
java.lang.String getPath(java.lang.String name)
name
- name of the elementboolean lock(java.lang.String name) throws java.io.IOException
name
- name of the element to be lockedtrue
on success, false
if the element
could not be lockedjava.io.IOException
- if any file operation failsboolean lock(java.lang.String name, boolean permissive) throws java.io.IOException
name
- name of the element to be lockedpermissive
- work in permissive modetrue
on success, false
if the element
could not be lockedjava.io.IOException
- if any file operation failsboolean unlock(java.lang.String name) throws java.io.IOException
name
- name of the element to be unlockedtrue
on success, false
if the element
could not be unlockedjava.io.IOException
- if any file operation failsboolean unlock(java.lang.String name, boolean permissive) throws java.io.IOException
name
- name of the element to be unlockedpermissive
- work in permissive modetrue
on success, false
if the element
could not be unlockedjava.io.IOException
- if any file operation failsvoid remove(java.lang.String name) throws java.io.IOException
name
- name of the element to be removedjava.io.IOException
- if any file operation failsint count()
void purge() throws java.io.IOException
java.io.IOException
- if any file operation failsvoid purge(int maxLock) throws java.io.IOException
maxLock
- maximum time for a locked element (in seconds);
if set to 0, locked elements will not be unlocked;
if set to null, the object's default value will be usedjava.io.IOException
- if any file operation failsvoid purge(int maxLock, int maxTemp) throws java.io.IOException
maxLock
- maximum time for a locked element (in seconds);
if set to 0, locked elements will not be unlocked;
if set to null, the object's default value will be usedmaxTemp
- maximum time for a temporary element (in seconds);
if set to 0, temporary elements will not be removed
if set to null, the object's default value will be usedjava.io.IOException
- if any file operation fails