Class JDBMSpace<K,V>
java.lang.Object
java.util.TimerTask
org.jpos.space.JDBMSpace<K,V>
- Type Parameters:
K- key type stored in this spaceV- value type stored in this space
- All Implemented Interfaces:
AutoCloseable, Runnable, PersistentSpace, Space<K,V>
JDBM based persistent space implementation
- Since:
- 1.4.7
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected booleanWhether mutating operations should commit immediately.static final longPeriodic interval, in milliseconds, between background GC sweeps.protected jdbm.htree.HTreeJDBM hash tree storing the space entries.protected StringSpace name used for registration.protected jdbm.RecordManagerUnderlying JDBM record manager used to persisthtree.protected static final jdbm.helper.SerializerShared serializer used forRefvalues stored inhtree.Cache of named JDBM spaces, keyed by space name. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()close this space - use with carevoidcommit()force commitbooleanReturns true if any of the given keys are present in the space.booleanReturns true if any of the given keys become available within the timeout.voidgc()garbage collector.getKeys()Returns a space-separated list of every key currently stored in this space.static JDBMSpacegetSpace()Returns a reference to the default JDBMSpace, backed by a file namedspace.static JDBMSpacecreates a named JDBMSpace (filename used for storage is the same as the given name)static JDBMSpacecreates a named JDBMSpaceTake an entry from the space, waiting forever until one exists.Take an entry from the space, waiting forever until one exists.In probe takes an entry from the space if one exists, return null otherwise.voidNrd (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 (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.voidWrite a new entry into the SpacevoidWrite a new entry into the Space The entry will timeout after the specified periodvoidWrite a new entry into the Space at the head of a queue The entry will timeout after the specified periodvoidWrite a new entry at the head of a queue.voidWrite a single entry at the head of the queue discarding the other entriesvoidWrite a single entry at the head of the queue discarding the other entries, with timeout.Read an entry from the space, waiting forever until one exists.Read an entry from the space, waiting a limited amount of time until one exists.Read probe reads an entry from the space if one exists, return null otherwise.voidrollback()force rollbackvoidrun()voidsetAutoCommit(boolean b) Use with utmost care and at your own risk.longReturns the approximate number of entries currently stored underkey.Methods inherited from class TimerTask
cancel, scheduledExecutionTime
-
Field Details
-
htree
JDBM hash tree storing the space entries. -
recman
-
refSerializer
Shared serializer used forRefvalues stored inhtree. -
spaceRegistrar
Cache of named JDBM spaces, keyed by space name. -
autoCommit
Whether mutating operations should commit immediately. -
name
-
GCDELAY
Periodic interval, in milliseconds, between background GC sweeps.- See Also:
-
-
Constructor Details
-
JDBMSpace
-
-
Method Details
-
getSpace
-
getSpace
-
getSpace
-
setAutoCommit
Use with utmost care and at your own risk. If you are to perform several operations on the space you should synchronize on the space, i.e:synchronized (sp) { sp.setAutoCommit (false); sp.out (..., ...) sp.out (..., ...) ... ... sp.inp (...); sp.commit (); // or sp.rollback (); sp.setAutoCommit (true); }- Parameters:
b- true or false
-
commit
force commit -
rollback
force rollback -
close
-
out
-
out
-
push
-
push
-
rdp
-
inp
-
in
-
in
-
rd
-
rd
-
nrd
Description copied from interface:SpaceNrd (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
Description copied from interface:SpaceNrd (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. -
size
-
existAny
-
existAny
Description copied from interface:SpaceReturns true if any of the given keys become available within the timeout. -
put
Description copied from interface:SpaceWrite a single entry at the head of the queue discarding the other entries, with timeout. -
put
-
run
-
gc
garbage collector. removes expired entries -
getKeys
-