public class BdbModule extends Object implements org.springframework.context.Lifecycle, Checkpointable, Closeable, org.springframework.beans.factory.DisposableBean
Modifier and Type | Class and Description |
---|---|
static class |
BdbModule.BdbConfig
Configuration object for databases.
|
Modifier and Type | Field and Description |
---|---|
protected int |
cachePercent |
protected int |
cacheSize |
protected ConfigPath |
dir |
protected int |
expectedConcurrency
Expected number of concurrent threads; used to tune nLockTables
according to JE FAQ
http://www.oracle.com/technology/products/berkeley-db/faq/je_faq.html#33
|
protected boolean |
isRunning |
protected Checkpoint |
recoveryCheckpoint |
protected long |
sn
uniqueness serial number for temp map databases
|
protected boolean |
useHardLinkCheckpoints
Whether to use hard-links to log files to collect/retain
the BDB log files needed for a checkpoint.
|
protected boolean |
useSharedCache |
Constructor and Description |
---|
BdbModule() |
Modifier and Type | Method and Description |
---|---|
void |
close() |
void |
closeDatabase(com.sleepycat.je.Database db) |
void |
closeDatabase(String name) |
void |
destroy() |
void |
doCheckpoint(Checkpoint checkpointInProgress)
Do the actual checkpoint.
|
protected void |
doRecover() |
void |
finishCheckpoint(Checkpoint checkpointInProgress)
Cleanup/unlock; need not complete for a checkpoint to be valid.
|
int |
getCachePercent() |
int |
getCacheSize() |
com.sleepycat.bind.serial.StoredClassCatalog |
getClassCatalog() |
com.sleepycat.je.Database |
getDatabase(String name) |
ConfigPath |
getDir() |
int |
getExpectedConcurrency() |
<V extends IdentityCacheable> |
getObjectCache(String dbName,
boolean recycle,
Class<V> valueClass) |
<V extends IdentityCacheable> |
getObjectCache(String dbName,
boolean recycle,
Class<V> declaredClass,
Class<? extends V> valueClass)
Get an ObjectIdentityCache, backed by a BDB Database of the given
name, with objects of the given valueClass type.
|
<V extends IdentityCacheable> |
getOIBCCache(String dbName,
boolean recycle,
Class<? extends V> valueClass)
Get an ObjectIdentityBdbCache, backed by a BDB Database of the
given name, with the given value class type.
|
<K,V> DisposableStoredSortedMap<K,V> |
getStoredMap(String dbName,
Class<K> keyClass,
Class<V> valueClass,
boolean allowDuplicates,
boolean usePriorData)
Creates a database-backed TempStoredSortedMap for transient
reporting requirements.
|
<K extends Serializable> |
getStoredQueue(String dbname,
Class<K> clazz,
boolean usePriorData) |
boolean |
getUseHardLinkCheckpoints() |
boolean |
getUseSharedCache() |
boolean |
isRunning() |
com.sleepycat.je.Database |
openDatabase(String name,
BdbModule.BdbConfig config,
boolean usePriorData)
Open a Database inside this BdbModule's environment, and
remember it for automatic close-at-module-stop.
|
void |
setCachePercent(int cachePercent) |
void |
setCacheSize(int cacheSize) |
void |
setDir(ConfigPath dir) |
void |
setExpectedConcurrency(int expectedConcurrency) |
void |
setRecoveryCheckpoint(Checkpoint checkpoint)
Used to inform a bean that it should restore its state from
the given Checkpoint when launched (Lifecycle start()).
|
protected void |
setup(File f,
boolean create) |
void |
setUseHardLinkCheckpoints(boolean useHardLinkCheckpoints) |
void |
setUseSharedCache(boolean useSharedCache) |
void |
start() |
void |
startCheckpoint(Checkpoint checkpointInProgress)
Note a checkpoint is about to begin.
|
void |
stop() |
protected ConfigPath dir
protected int cachePercent
protected int cacheSize
protected boolean useSharedCache
protected int expectedConcurrency
protected boolean useHardLinkCheckpoints
protected boolean isRunning
protected Checkpoint recoveryCheckpoint
protected long sn
public ConfigPath getDir()
public void setDir(ConfigPath dir)
public int getCachePercent()
public void setCachePercent(int cachePercent)
public int getCacheSize()
public void setCacheSize(int cacheSize)
public boolean getUseSharedCache()
public void setUseSharedCache(boolean useSharedCache)
public int getExpectedConcurrency()
public void setExpectedConcurrency(int expectedConcurrency)
public boolean getUseHardLinkCheckpoints()
public void setUseHardLinkCheckpoints(boolean useHardLinkCheckpoints)
public void start()
start
in interface org.springframework.context.Lifecycle
public boolean isRunning()
isRunning
in interface org.springframework.context.Lifecycle
public void stop()
stop
in interface org.springframework.context.Lifecycle
protected void setup(File f, boolean create) throws com.sleepycat.je.DatabaseException, IOException
com.sleepycat.je.DatabaseException
IOException
public void closeDatabase(com.sleepycat.je.Database db)
public void closeDatabase(String name)
public com.sleepycat.je.Database openDatabase(String name, BdbModule.BdbConfig config, boolean usePriorData) throws com.sleepycat.je.DatabaseException
name
- config
- usePriorData
- com.sleepycat.je.DatabaseException
public com.sleepycat.bind.serial.StoredClassCatalog getClassCatalog()
public <K extends Serializable> StoredQueue<K> getStoredQueue(String dbname, Class<K> clazz, boolean usePriorData)
public <V extends IdentityCacheable> ObjectIdentityBdbManualCache<V> getOIBCCache(String dbName, boolean recycle, Class<? extends V> valueClass) throws com.sleepycat.je.DatabaseException
V
- dbName
- recycle
- valueClass
- com.sleepycat.je.DatabaseException
public <V extends IdentityCacheable> ObjectIdentityCache<V> getObjectCache(String dbName, boolean recycle, Class<V> valueClass) throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException
public <V extends IdentityCacheable> ObjectIdentityCache<V> getObjectCache(String dbName, boolean recycle, Class<V> declaredClass, Class<? extends V> valueClass) throws com.sleepycat.je.DatabaseException
V
- dbName
- recycle
- valueClass
- com.sleepycat.je.DatabaseException
public void startCheckpoint(Checkpoint checkpointInProgress)
Checkpointable
startCheckpoint
in interface Checkpointable
checkpointInProgress
- Checkpointpublic void doCheckpoint(Checkpoint checkpointInProgress) throws IOException
Checkpointable
doCheckpoint
in interface Checkpointable
checkpointInProgress
- CheckpointIOException
protected void doRecover() throws IOException
IOException
public void finishCheckpoint(Checkpoint checkpointInProgress)
Checkpointable
finishCheckpoint
in interface Checkpointable
checkpointInProgress
- Checkpointpublic void setRecoveryCheckpoint(Checkpoint checkpoint)
Checkpointable
setRecoveryCheckpoint
in interface Checkpointable
checkpoint
- Checkpointpublic void close()
close
in interface Closeable
close
in interface AutoCloseable
public com.sleepycat.je.Database getDatabase(String name)
public <K,V> DisposableStoredSortedMap<K,V> getStoredMap(String dbName, Class<K> keyClass, Class<V> valueClass, boolean allowDuplicates, boolean usePriorData)
K
- V
- dbName
- Database name to use; if null a name will be synthesizedkeyClass
- Class of keys; should be a Java primitive typevalueClass
- Class of values; may be any serializable typeallowDuplicates
- whether duplicate keys allowedCopyright © 2003-2014 Internet Archive. All Rights Reserved.