Package com.tangosol.io.bdb
Class BerkeleyDBBinaryStore
java.lang.Object
com.tangosol.util.Base
com.tangosol.io.AbstractBinaryStore
com.tangosol.io.bdb.BerkeleyDBBinaryStore
- All Implemented Interfaces:
BinaryStore
An implementation of the BinaryStore interface using Sleepycat Berkeley
DB Java Edition.
- Author:
- mf 2005.09.29
- See Also:
-
Nested Class Summary
Modifier and TypeClassDescriptionprotected class
The DatabaseHolder class is used as a wrapper around a Berkeley DB Database object.Nested classes/interfaces inherited from class com.tangosol.util.Base
Base.LoggingWriter
Nested classes/interfaces inherited from interface com.tangosol.io.BinaryStore
BinaryStore.KeySetAware, BinaryStore.SizeAware
-
Field Summary
Modifier and TypeFieldDescriptionprotected final Lock
The lock to hold during read and write operations.protected BerkeleyDBBinaryStore.DatabaseHolder
The Database handle.protected DatabaseFactory
Factory used to create this Database. -
Constructor Summary
ConstructorDescriptionBerkeleyDBBinaryStore
(String sDbName, DatabaseFactory dbFactory) Create a new Berkeley DB BinaryStore using the supplied DatabaseFactory. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Close the BinaryStore.void
Remove the specified key from the underlying store if present.void
eraseAll()
Remove all data from the underlying store.Get the DatabaseHolder.Get the DatabaseFactory used to create the underlying Database.protected void
init
(String sDbName, DatabaseFactory dbFactory) Initialize the BinaryStore.keys()
Iterate all keys in the underlying store.Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.void
Store the specified value under the specific key in the underlying store.toString()
Return a human readable description of the BinaryStore.Methods inherited from class com.tangosol.io.AbstractBinaryStore
getDefaultDirectory
Methods inherited from class com.tangosol.util.Base
azzert, azzert, azzert, azzertFailed, breakLines, breakLines, capitalize, checkNotEmpty, checkNotNull, checkRange, computeSafeWaitTime, decimalValue, dup, dup, ensureBigDecimal, ensureClassLoader, ensureRuntimeException, ensureRuntimeException, equals, equalsDeep, err, err, err, err, err, escape, formatDateTime, getCallerStackFrame, getCommonMonitor, getCommonMonitor, getCommonMonitor, getContextClassLoader, getContextClassLoader, getDeepMessage, getErr, getLastSafeTimeMillis, getLog, getMaxDecDigits, getMaxHexDigits, getOriginalException, getOut, getProcessRandom, getRandom, getRandomBinary, getRandomBinary, getRandomString, getSafeTimeMillis, getStackFrame, getStackFrames, getStackTrace, getStackTrace, getStackTrace, getThreadFactory, getTimeZone, getUpTimeMillis, hashCode, hexValue, indentString, indentString, isDecimal, isHex, isLogEcho, isOctal, log, log, log, log, log, makeInteger, makeLong, makeThread, mergeArray, mergeBooleanArray, mergeByteArray, mergeCharArray, mergeDoubleArray, mergeFloatArray, mergeIntArray, mergeLongArray, mod, mod, octalValue, out, out, out, out, out, pad, parseBandwidth, parseBandwidth, parseDelimitedString, parseHex, parseHex, parseMemorySize, parseMemorySize, parsePercentage, parseTime, parseTime, parseTimeNanos, parseTimeNanos, printStackTrace, randomize, randomize, randomize, randomize, read, read, read, read, read, read, read, replace, setErr, setLog, setLogEcho, setOut, sleep, toBandwidthString, toBandwidthString, toCharEscape, toCrc, toCrc, toCrc, toCrc, toCrc, toDecString, toDelimitedString, toDelimitedString, toDelimitedString, toDelimitedString, toHex, toHex, toHexDump, toHexEscape, toHexEscape, toHexEscape, toHexEscape, toHexString, toMemorySizeString, toMemorySizeString, toQuotedCharEscape, toQuotedStringEscape, toSqlString, toString, toString, toStringEscape, toUnicodeEscape, trace, trace, trace, trace, trace, trace, trace, trace, trace, truncateString, truncateString, wait
-
Field Details
-
m_db
The Database handle. -
m_factory
Factory used to create this Database. -
f_lock
The lock to hold during read and write operations.
-
-
Constructor Details
-
BerkeleyDBBinaryStore
public BerkeleyDBBinaryStore(String sDbName, DatabaseFactory dbFactory) throws com.sleepycat.je.DatabaseException Create a new Berkeley DB BinaryStore using the supplied DatabaseFactory.- Parameters:
sDbName
- the name of the table to store the cache's data in, null indicates a temporary table name.dbFactory
- the factory to use to create the Database- Throws:
com.sleepycat.je.DatabaseException
- if the Database creation failed
-
-
Method Details
-
init
protected void init(String sDbName, DatabaseFactory dbFactory) throws com.sleepycat.je.DatabaseException Initialize the BinaryStore.- Parameters:
sDbName
- the name of the table to store the cache's data in, null indicates a temporary table name.dbFactory
- the factory to use to create the Database- Throws:
com.sleepycat.je.DatabaseException
- if the Database creation failed
-
toString
Return a human readable description of the BinaryStore. -
load
Return the value associated with the specified key, or null if the key does not have an associated value in the underlying store.- Specified by:
load
in interfaceBinaryStore
- Specified by:
load
in classAbstractBinaryStore
- Parameters:
binKey
- key whose associated value is to be returned- Returns:
- the value associated with the specified key, or null if no value is available for that key
-
store
Store the specified value under the specific key in the underlying store.This method is supports both key/value creation and value update for a specific key.
- Specified by:
store
in interfaceBinaryStore
- Overrides:
store
in classAbstractBinaryStore
- Parameters:
binKey
- key to store the value underbinValue
- value to be stored
-
erase
Remove the specified key from the underlying store if present.- Specified by:
erase
in interfaceBinaryStore
- Overrides:
erase
in classAbstractBinaryStore
- Parameters:
binKey
- key whose mapping is to be removed from the map
-
eraseAll
public void eraseAll()Remove all data from the underlying store.- Specified by:
eraseAll
in interfaceBinaryStore
- Overrides:
eraseAll
in classAbstractBinaryStore
-
keys
Iterate all keys in the underlying store.- Specified by:
keys
in interfaceBinaryStore
- Overrides:
keys
in classAbstractBinaryStore
- Returns:
- a read-only iterator of the keys in the underlying store
-
close
public void close()Close the BinaryStore. -
getDbHolder
Get the DatabaseHolder. To prevent the underlying Database from being deleted during usage, hold onto this handle while using the Database object.- Returns:
- the DatabaseHolder
-
getFactory
Get the DatabaseFactory used to create the underlying Database.- Returns:
- the DatabaseFactory
-