|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectde.javakaffee.simplequeue.BDBQueue
public class BDBQueue
Fast queue implementation on top of Berkley DB Java Edition. This class is thread-safe.
Created on Jun 27, 2011
| Constructor Summary | |
|---|---|
BDBQueue(String queueEnvPath,
String queueName,
int cacheSize)
Creates instance of persistent queue. |
|
| Method Summary | |
|---|---|
int |
clear()
|
void |
close()
Closes this queue and frees up all resources associated to it. |
String |
getQueueName()
Returns this queue name. |
boolean |
isEmpty()
Determines if this queue is empty (equivalent to ). |
static void |
mkdir(File dir)
Asserts that the given directory exists and creates it if necessary. |
byte[] |
peek()
Retrieves element from the head of this queue. |
byte[] |
poll()
Retrieves and and removes element from the head of this queue. |
void |
push(byte[] element)
Pushes element to the tail of this queue. |
void |
remove()
Removes the eldest element. |
long |
size()
Returns the size of this queue. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public BDBQueue(String queueEnvPath,
String queueName,
int cacheSize)
throws IOException
queueEnvPath - queue database environment directory pathqueueName - descriptive queue namecacheSize - how often to sync the queue to disk
IOException - thrown when the given queueEnvPath does not exist and cannot be created.| Method Detail |
|---|
public static void mkdir(@Nonnull
File dir)
throws IOException
dir - the directory that shall exist
IOException - thrown if the directory could not be created.
public byte[] poll()
throws IOException
IOException - in case of disk IO failure
public byte[] peek()
throws IOException
IOException - in case of disk IO failure
public void remove()
throws NoSuchElementException
NoSuchElementException
public void push(byte[] element)
throws IOException
element - element
IOException - in case of disk IO failurepublic int clear()
public long size()
public boolean isEmpty()
size() == 0).
true if this queue is empty, otherwise false.public String getQueueName()
public void close()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||