public interface Queue extends Iterable<String>
QueueSimple
queues, an element can only contain one
binary string.
Modifier and Type | Method and Description |
---|---|
String |
add(byte[] data)
Add byte array data to the queue.
|
String |
add(String data)
Add String data to the queue.
|
String |
addPath(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.
|
String |
get(String name)
Get the given locked element as String data.
|
byte[] |
getAsByteArray(String name)
Get the given locked element as byte array data.
|
String |
getId()
Return a unique identifier for the queue.
|
String |
getPath(String name)
Get the path of the given locked element.
|
String |
getQueuePath()
Return the path of the queue.
|
boolean |
lock(String name)
Lock an element in permissive mode.
|
boolean |
lock(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(String name)
Remove a locked element from the queue.
|
boolean |
unlock(String name)
Unlock an element in non-permissive mode.
|
boolean |
unlock(String name,
boolean permissive)
Unlock an element.
|
forEach, iterator, spliterator
String getQueuePath()
String getId()
String add(String data) throws IOException
data
- data to be addedIOException
- if any file operation failsString add(byte[] data) throws IOException
data
- data to be addedIOException
- if any file operation failsString addPath(String path) throws IOException
path
- path of the file to be addedIOException
- if any file operation failsString get(String name) throws IOException
name
- name of the element to be retrievedIOException
byte[] getAsByteArray(String name) throws IOException
name
- name of the element to be retrievedIOException
String getPath(String name)
name
- name of the elementboolean lock(String name) throws IOException
name
- name of the element to be lockedtrue
on success, false
if the element
could not be lockedIOException
- if any file operation failsboolean lock(String name, boolean permissive) throws IOException
name
- name of the element to be lockedpermissive
- work in permissive modetrue
on success, false
if the element
could not be lockedIOException
- if any file operation failsboolean unlock(String name) throws IOException
name
- name of the element to be unlockedtrue
on success, false
if the element
could not be unlockedIOException
- if any file operation failsboolean unlock(String name, boolean permissive) throws IOException
name
- name of the element to be unlockedpermissive
- work in permissive modetrue
on success, false
if the element
could not be unlockedIOException
- if any file operation failsvoid remove(String name) throws IOException
name
- name of the element to be removedIOException
- if any file operation failsint count()
void purge() throws IOException
IOException
- if any file operation failsvoid purge(int maxLock) throws 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 usedIOException
- if any file operation failsvoid purge(int maxLock, int maxTemp) throws 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 usedIOException
- if any file operation failsCopyright © 2022. All rights reserved.