public class QueueNull extends Queue
The goal of this module is to offer a null queue system using the same API as the other directory queue implementations. The queue will behave like a black hole: added data will disappear immediately so the queue will therefore always appear empty.
This can be used for testing purposes or to discard data like one would do on Unix by redirecting output to /dev/null.
Please refer to Queue for general information about
directory queues.
DirectoryRegexp, ElementRegexp| Constructor and Description |
|---|
QueueNull()
Constructor which creates a null directory queues which
accept no parameters.
|
| Modifier and Type | Method and Description |
|---|---|
String |
add(byte[] data)
Add data as byte array to the queue.
|
String |
add(String data)
Add data as a string 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, locked or not
(but not temporary).
|
String |
get(String name)
Get locked element as a string.
|
byte[] |
getAsByteArray(String name)
Get locked element as a byte array.
|
String |
getPath(String path)
Return the path given the name of the element.
|
Iterator<String> |
iterator()
Return the queue iterator.
|
boolean |
lock(String name,
boolean permissive)
Lock an element.
|
void |
purge(int maxTemp,
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 |
remove(String name)
Remove a locked element from the queue.
|
boolean |
unlock(String name,
boolean permissive)
Unlock an element.
|
public QueueNull()
public String add(byte[] data)
Queuepublic String add(String data)
Queuepublic String addPath(String path)
Queuepublic String get(String name) throws NotSupportedMethodException
Queueget in class Queuename - the name of the element to be returnedNotSupportedMethodExceptionpublic byte[] getAsByteArray(String name) throws NotSupportedMethodException
QueuegetAsByteArray in class Queuename - the name of the element to be returnedNotSupportedMethodExceptionpublic String getPath(String path) throws NotSupportedMethodException
QueuegetPath in class Queuepath - the name of the elementNotSupportedMethodExceptionpublic boolean lock(String name, boolean permissive) throws NotSupportedMethodException
Queuelock in class Queuename - name of the element to be lockedpermissive - work in permissive modetrue on success, false if
the element could not be lockedNotSupportedMethodExceptionpublic boolean unlock(String name, boolean permissive) throws NotSupportedMethodException
Queueunlock in class Queuename - name of the element to be lockedpermissive - work in permissive modetrue on success, false if
the element could not be unlockedNotSupportedMethodExceptionpublic void remove(String name) throws NotSupportedMethodException
Queueremove in class Queuename - name of the element to be removedNotSupportedMethodExceptionpublic int count()
Queuepublic void purge(int maxTemp,
int maxLock)
QueueCopyright © 2012. All Rights Reserved.