Package org.jpos.space
Class JESpace<K,V>
- java.lang.Object
-
- org.jpos.util.Log
-
- org.jpos.space.JESpace<K,V>
-
- All Implemented Interfaces:
java.lang.Runnable
,LocalSpace<K,V>
,Space<K,V>
,Loggeable
,LogSource
public class JESpace<K,V> extends Log implements LocalSpace<K,V>, Loggeable, java.lang.Runnable
BerkeleyDB Jave Edition based persistent space implementation- Since:
- 1.6.5
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
JESpace.GCRef
static class
JESpace.Ref
-
Constructor Summary
Constructors Constructor Description JESpace(java.lang.String name, java.lang.String params)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addListener(java.lang.Object key, SpaceListener listener)
add a SpaceListener associated with a given keyvoid
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 Spacevoid
out(K key, V value, long timeout)
Write a new entry into the Space, with an timeout valuevoid
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 valuevoid
put(K key, V value)
Write a single entry at the head of the queue discarding the other entriesvoid
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 keyvoid
run()
int
size(java.lang.Object key)
-
Methods inherited from class org.jpos.util.Log
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
-
-
-
-
Field Detail
-
GC_DELAY
public static final long GC_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_TXN_TIMEOUT
public static final long DEFAULT_TXN_TIMEOUT
- See Also:
- Constant Field Values
-
DEFAULT_LOCK_TIMEOUT
public static final long DEFAULT_LOCK_TIMEOUT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
JESpace
public JESpace(java.lang.String name, java.lang.String params) throws SpaceError
- Throws:
SpaceError
-
-
Method Detail
-
out
public void out(K key, V value)
Description copied from interface:Space
Write a new entry into the Space
-
out
public void out(K key, V value, long timeout)
Description copied from interface:Space
Write a new entry into the Space, with an timeout value
-
push
public void push(K key, V value, long timeout)
Description copied from interface:Space
Write a new entry at the head of the queue with a timeout value
-
push
public void push(K key, V value)
Description copied from interface:Space
Write a new entry at the head of a queue.
-
rdp
public V rdp(java.lang.Object key)
Description copied from interface:Space
Read probe reads an entry from the space if one exists, return null otherwise.
-
in
public V in(java.lang.Object key)
Description copied from interface:Space
Take an entry from the space, waiting forever until one exists.
-
in
public V in(java.lang.Object key, long timeout)
Description copied from interface:Space
Take an entry from the space, waiting a limited amount of time until one exists.
-
rd
public V rd(java.lang.Object key)
Description copied from interface:Space
Read an entry from the space, waiting forever until one exists.
-
rd
public V rd(java.lang.Object key, long timeout)
Description copied from interface:Space
Read an entry from the space, waiting a limited amount of time until one exists.
-
nrd
public void nrd(java.lang.Object key)
Description copied from interface:Space
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.
-
nrd
public V nrd(java.lang.Object key, long timeout)
Description copied from interface:Space
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.
-
inp
public V inp(java.lang.Object key)
Description copied from interface:Space
In probe takes an entry from the space if one exists, return null otherwise.
-
existAny
public boolean existAny(java.lang.Object[] keys)
-
existAny
public boolean existAny(java.lang.Object[] keys, long timeout)
-
put
public void put(K key, V value, long timeout)
Description copied from interface:Space
Write a single entry at the head of the queue discarding the other entries, with timeout.
-
put
public void put(K key, V value)
Description copied from interface:Space
Write a single entry at the head of the queue discarding the other entries
-
gc
public void gc() throws com.sleepycat.je.DatabaseException
- Throws:
com.sleepycat.je.DatabaseException
-
run
public void run()
- Specified by:
run
in interfacejava.lang.Runnable
-
close
public void close() throws com.sleepycat.je.DatabaseException
- Throws:
com.sleepycat.je.DatabaseException
-
addListener
public void addListener(java.lang.Object key, SpaceListener listener)
Description copied from interface:LocalSpace
add a SpaceListener associated with a given key- Specified by:
addListener
in interfaceLocalSpace<K,V>
- Parameters:
key
- Entry's keylistener
- a SpaceListener
-
addListener
public void addListener(java.lang.Object key, SpaceListener listener, long timeout)
Description copied from interface:LocalSpace
add a SpaceListener associated with a given key for a given period of time. Warning: not supported by all space implementations.- Specified by:
addListener
in interfaceLocalSpace<K,V>
- Parameters:
key
- Entry's keylistener
- a SpaceListenertimeout
- listener registration timeout in millis
-
removeListener
public void removeListener(java.lang.Object key, SpaceListener listener)
Description copied from interface:LocalSpace
removes a SpaceListener associated with a given key- Specified by:
removeListener
in interfaceLocalSpace<K,V>
- Parameters:
key
- Entry's keylistener
- the SpaceListener
-
getKeySet
public java.util.Set getKeySet()
- Specified by:
getKeySet
in interfaceLocalSpace<K,V>
- Returns:
- Set containing all keys in Space
-
size
public int size(java.lang.Object key)
- Specified by:
size
in interfaceLocalSpace<K,V>
- Returns:
- number of entries in a given key
-
-