|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.appenginefan.toolkit.common.PersistentQueue<T>
public class PersistentQueue<T>
An experimental!! class that can be used to
persist objects in the data store in an ordered fashion.
This class does not implement the
java.util.Queue interface, since certain
aspects (like size) are inefficient to implement.
However, it tries to use the same method names and
semantics as the core Queue interface, thus making it an
easy class to use.
If you run into any problems, please let me know!
| Constructor Summary | |
|---|---|
PersistentQueue(Counter idGenerator,
Persistence<T> store,
String name)
Constructor |
|
| Method Summary | ||
|---|---|---|
static
|
createQueue(String name,
Persistence<T> persistence)
Creates a persistent queue, using the given backend and a given name |
|
boolean |
offer(T element)
Inserts the specified element into this queue, if possible. |
|
T |
peek()
Retrieves, but does not remove, the head of this queue, returning null if this queue is empty. |
|
T |
poll()
Retrieves and removes the head of this queue, or null if this queue is empty. |
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public PersistentQueue(Counter idGenerator,
Persistence<T> store,
String name)
idGenerator - a counter (must be idgenerator-capable) that
is used to maintain an order in the queuestore - a place to persist queue elementsname - a key that is used to persist the elements in
the datastore. Must not contain any slashes.| Method Detail |
|---|
public static <T> PersistentQueue<T> createQueue(String name,
Persistence<T> persistence)
name - the name to be used for persisting elements
(must not contain slashes)
public boolean offer(T element)
element - the element to insert. null is not allowed.
NullPointerException - if the element was nullpublic T poll()
public T peek()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||