|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjava.util.TimerTask
org.jpos.space.JDBMSpace<K,V>
public class JDBMSpace<K,V>
JDBM based persistent space implementation
| Field Summary | |
|---|---|
protected boolean |
autoCommit
|
static long |
GCDELAY
|
protected jdbm.htree.HTree |
htree
|
protected String |
name
|
protected jdbm.RecordManager |
recman
|
protected static jdbm.helper.Serializer |
refSerializer
|
protected static Map<String,Space> |
spaceRegistrar
|
| Constructor Summary | |
|---|---|
protected |
JDBMSpace(String name,
String filename)
protected constructor. |
| Method Summary | |
|---|---|
void |
close()
close this space - use with care |
void |
commit()
force commit |
boolean |
existAny(Object[] keys)
|
boolean |
existAny(Object[] keys,
long timeout)
|
void |
gc()
garbage collector. |
String |
getKeys()
|
static JDBMSpace |
getSpace()
|
static JDBMSpace |
getSpace(String name)
creates a named JDBMSpace (filename used for storage is the same as the given name) |
static JDBMSpace |
getSpace(String name,
String filename)
creates a named JDBMSpace |
V |
in(Object key)
Take an entry from the space, waiting forever until one exists. |
V |
in(Object key,
long timeout)
Take an entry from the space, waiting forever until one exists. |
V |
inp(Object key)
In probe takes an entry from the space if one exists, return null otherwise. |
void |
out(K key,
V value)
Write a new entry into the Space |
void |
out(K key,
V value,
long timeout)
Write a new entry into the Space The entry will timeout after the specified period |
void |
push(K key,
V value)
Write a new entry at the head of a queue. |
void |
push(Object key,
Object value,
long timeout)
Write a new entry into the Space at the head of a queue The entry will timeout after the specified period |
void |
put(K key,
V value)
Write a single entry at the head of the queue discarding the other entries |
void |
put(K key,
V value,
long timeout)
Write a single entry at the head of the queue discarding the other entries, with timeout. |
V |
rd(Object key)
Read an entry from the space, waiting forever until one exists. |
V |
rd(Object key,
long timeout)
Read an entry from the space, waiting a limited amount of time until one exists. |
V |
rdp(Object key)
Read probe reads an entry from the space if one exists, return null otherwise. |
void |
rollback()
force rollback |
void |
run()
|
void |
setAutoCommit(boolean b)
Use with utmost care and at your own risk. |
long |
size(Object key)
|
| Methods inherited from class java.util.TimerTask |
|---|
cancel, scheduledExecutionTime |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected jdbm.htree.HTree htree
protected jdbm.RecordManager recman
protected static final jdbm.helper.Serializer refSerializer
protected static final Map<String,Space> spaceRegistrar
protected boolean autoCommit
protected String name
public static final long GCDELAY
| Constructor Detail |
|---|
protected JDBMSpace(String name,
String filename)
name - Space Namefilename - underlying JDBM filenameSpaceFactory().getSpace()| Method Detail |
|---|
public static JDBMSpace getSpace()
public static JDBMSpace getSpace(String name)
name - the Space name
public static JDBMSpace getSpace(String name,
String filename)
name - the Space namefilename - the storage file name
public void setAutoCommit(boolean b)
synchronized (sp) {
sp.setAutoCommit (false);
sp.out (..., ...)
sp.out (..., ...)
...
...
sp.inp (...);
sp.commit (); // or sp.rollback ();
sp.setAutoCommit (true);
}
b - true or falsepublic void commit()
public void rollback()
public void close()
public void out(K key,
V value)
out in interface Space<K,V>key - Entry's keyvalue - Object value
public void out(K key,
V value,
long timeout)
out in interface Space<K,V>key - Entry's keyvalue - Object valuetimeout - entry timeout in millis
public void push(K key,
V value)
Space
push in interface Space<K,V>key - Entry's keyvalue - Object value
public void push(Object key,
Object value,
long timeout)
push in interface Space<K,V>key - Entry's keyvalue - Object valuetimeout - entry timeout in millispublic V rdp(Object key)
rdp in interface Space<K,V>key - Entry's key
public V inp(Object key)
inp in interface Space<K,V>key - Entry's key
public V in(Object key)
Space
in in interface Space<K,V>key - Entry's key
public V in(Object key,
long timeout)
in in interface Space<K,V>key - Entry's keytimeout - millis to wait
public V rd(Object key)
rd in interface Space<K,V>key - Entry's key
public V rd(Object key,
long timeout)
rd in interface Space<K,V>key - Entry's keytimeout - millis to wait
public long size(Object key)
key - the Key
public boolean existAny(Object[] keys)
existAny in interface Space<K,V>keys - array of keys to check
public boolean existAny(Object[] keys,
long timeout)
existAny in interface Space<K,V>keys - array of keys to checktimeout - to wait for any of the entries to become available
public void put(K key,
V value,
long timeout)
Space
put in interface Space<K,V>key - Entry's keyvalue - Object valuetimeout - timeout value
public void put(K key,
V value)
Space
put in interface Space<K,V>key - Entry's keyvalue - Object valuepublic void run()
run in interface Runnablerun in class TimerTaskpublic void gc()
public String getKeys()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||