public class JESpace<K,V> extends Log implements LocalSpace<K,V>, Loggeable, java.lang.Runnable
Modifier and Type | Class and Description |
---|---|
static class |
JESpace.GCRef |
static class |
JESpace.Ref |
Modifier and Type | Field and Description |
---|---|
static long |
DEFAULT_LOCK_TIMEOUT |
static long |
DEFAULT_TXN_TIMEOUT |
static long |
GC_DELAY |
Constructor and Description |
---|
JESpace(java.lang.String name,
java.lang.String params) |
Modifier and Type | Method and Description |
---|---|
void |
addListener(java.lang.Object key,
SpaceListener listener)
add a SpaceListener associated with a given key
|
void |
addListener(java.lang.Object key,
SpaceListener listener,
long timeout)
add a SpaceListener associated with a given key for a given
period of time.
|
void |
close() |
void |
dump(java.io.PrintStream p,
java.lang.String indent) |
boolean |
existAny(java.lang.Object[] keys) |
boolean |
existAny(java.lang.Object[] keys,
long timeout) |
void |
gc() |
java.util.Set |
getKeySet() |
static JESpace |
getSpace(java.lang.String name) |
static JESpace |
getSpace(java.lang.String name,
java.lang.String path) |
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 a limited amount of time
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, with an timeout value
|
void |
push(K key,
V value)
Write a new entry at the head of a queue.
|
void |
push(K key,
V value,
long timeout)
Write a new entry at the head of the queue with a timeout value
|
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 |
removeListener(java.lang.Object key,
SpaceListener listener)
removes a SpaceListener associated with a given key
|
void |
run() |
int |
size(java.lang.Object key) |
createDebug, createDebug, createError, createError, createFatal, createFatal, createInfo, createInfo, createLogEvent, createLogEvent, createTrace, createTrace, createWarn, createWarn, debug, debug, error, error, fatal, fatal, getLog, getLogger, getRealm, info, info, setLogger, setLogger, setRealm, trace, trace, warn, warn
public static final long GC_DELAY
public static final long DEFAULT_TXN_TIMEOUT
public static final long DEFAULT_LOCK_TIMEOUT
public JESpace(java.lang.String name, java.lang.String params) throws SpaceError
SpaceError
public void out(K key, V value)
Space
public void out(K key, V value, long timeout)
Space
public void push(K key, V value, long timeout)
Space
public void push(K key, V value)
Space
public V rdp(java.lang.Object key)
Space
public V in(java.lang.Object key)
Space
public V in(java.lang.Object key, long timeout)
Space
public V rd(java.lang.Object key)
Space
public V rd(java.lang.Object key, long timeout)
Space
public void nrd(java.lang.Object key)
Space
public V nrd(java.lang.Object key, long timeout)
Space
public V inp(java.lang.Object key)
Space
public 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 gc() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
public void run()
run
in interface java.lang.Runnable
public void close() throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
public static JESpace getSpace(java.lang.String name, java.lang.String path)
public static JESpace getSpace(java.lang.String name)
public void addListener(java.lang.Object key, SpaceListener listener)
LocalSpace
addListener
in interface LocalSpace<K,V>
key
- Entry's keylistener
- a SpaceListenerpublic void addListener(java.lang.Object key, SpaceListener listener, long timeout)
LocalSpace
addListener
in interface LocalSpace<K,V>
key
- Entry's keylistener
- a SpaceListenertimeout
- listener registration timeout in millispublic void removeListener(java.lang.Object key, SpaceListener listener)
LocalSpace
removeListener
in interface LocalSpace<K,V>
key
- Entry's keylistener
- the SpaceListenerpublic java.util.Set getKeySet()
getKeySet
in interface LocalSpace<K,V>
public int size(java.lang.Object key)
size
in interface LocalSpace<K,V>