Modifier and Type | Field and Description |
---|---|
protected boolean |
autoCommit |
static long |
GCDELAY |
protected jdbm.htree.HTree |
htree |
protected java.lang.String |
name |
protected jdbm.RecordManager |
recman |
protected static jdbm.helper.Serializer |
refSerializer |
protected static java.util.Map<java.lang.String,Space> |
spaceRegistrar |
Modifier | Constructor and Description |
---|---|
protected |
JDBMSpace(java.lang.String name,
java.lang.String filename)
protected constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
close this space - use with care
|
void |
commit()
force commit
|
boolean |
existAny(java.lang.Object[] keys) |
boolean |
existAny(java.lang.Object[] keys,
long timeout) |
void |
gc()
garbage collector.
|
java.lang.String |
getKeys() |
static JDBMSpace |
getSpace() |
static JDBMSpace |
getSpace(java.lang.String name)
creates a named JDBMSpace
(filename used for storage is the same as the given name)
|
static JDBMSpace |
getSpace(java.lang.String name,
java.lang.String filename)
creates a named JDBMSpace
|
V |
in(java.lang.Object key)
Take an entry from the space, waiting forever until one exists.
|
V |
in(java.lang.Object key,
long timeout)
Take an entry from the space, waiting forever until one exists.
|
V |
inp(java.lang.Object key)
In probe takes an entry from the space if one exists,
return null otherwise.
|
void |
nrd(java.lang.Object key)
Nrd (not read) waits forever until Key is not present in space
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.
|
V |
nrd(java.lang.Object key,
long timeout)
Nrd (not read) waits up to timeout until Key is not present in space
Resolution for expiring entries is implementation dependant, but a minimum one-second is suggested.
|
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(java.lang.Object key,
java.lang.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(java.lang.Object key)
Read an entry from the space, waiting forever until one exists.
|
V |
rd(java.lang.Object key,
long timeout)
Read an entry from the space, waiting a limited amount of time
until one exists.
|
V |
rdp(java.lang.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(java.lang.Object key) |
protected jdbm.htree.HTree htree
protected jdbm.RecordManager recman
protected static final jdbm.helper.Serializer refSerializer
protected static final java.util.Map<java.lang.String,Space> spaceRegistrar
protected boolean autoCommit
protected java.lang.String name
public static final long GCDELAY
protected JDBMSpace(java.lang.String name, java.lang.String filename)
name
- Space Namefilename
- underlying JDBM filenamepublic static JDBMSpace getSpace()
public static JDBMSpace getSpace(java.lang.String name)
name
- the Space namepublic static JDBMSpace getSpace(java.lang.String name, java.lang.String filename)
name
- the Space namefilename
- the storage file namepublic 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, long timeout)
public void push(K key, V value)
Space
public void push(java.lang.Object key, java.lang.Object value, long timeout)
public V rdp(java.lang.Object key)
public V inp(java.lang.Object key)
public V in(java.lang.Object key)
Space
public V in(java.lang.Object key, long timeout)
public V rd(java.lang.Object key)
public V rd(java.lang.Object key, long timeout)
public void nrd(java.lang.Object key)
Space
public V nrd(java.lang.Object key, long timeout)
Space
public long size(java.lang.Object key)
key
- the Keypublic boolean existAny(java.lang.Object[] keys)
public boolean existAny(java.lang.Object[] keys, long timeout)
public void put(K key, V value, long timeout)
Space
public void put(K key, V value)
Space
public void run()
run
in interface java.lang.Runnable
run
in class java.util.TimerTask
public void gc()
public java.lang.String getKeys()