|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.sleepycat.je.dbi.EnvironmentImpl
public class EnvironmentImpl
Underlying Environment implementation. There is a single instance for any database environment opened by the application.
Field Summary | |
---|---|
static boolean |
JAVA5_AVAILABLE
|
protected LogManager |
logManager
|
RunRecoveryException |
SAVED_RRE
|
Constructor Summary | |
---|---|
EnvironmentImpl(java.io.File envHome,
EnvironmentConfig envConfig)
Create a database environment to represent the data in envHome. |
Method Summary | |
---|---|
void |
addConfigObserver(EnvConfigObserver o)
Adds an observer of mutable config changes. |
void |
addToCompressorQueue(BIN bin,
Key deletedKey,
boolean doWakeup)
Tells the asynchronous IN compressor thread about a BIN with a deleted entry. |
void |
addToCompressorQueue(BINReference binRef,
boolean doWakeup)
Tells the asynchronous IN compressor thread about a BINReference with a deleted entry. |
void |
addToCompressorQueue(java.util.Collection binRefs,
boolean doWakeup)
Tells the asynchronous IN compressor thread about a collections of BINReferences with deleted entries. |
(package private) void |
alertEvictor()
|
void |
checkIfInvalid()
|
void |
checkImmutablePropsForEquality(EnvironmentConfig config)
Throws an exception if an immutable property is changed. |
void |
checkNotClosed()
|
EnvironmentConfig |
cloneConfig()
Clones the current configuration. |
EnvironmentMutableConfig |
cloneMutableConfig()
Clones the current mutable configuration. |
void |
close()
|
void |
close(boolean doCheckpoint)
|
void |
closeAfterRunRecovery()
|
void |
closeLogger()
Close down the logger. |
DatabaseImpl |
createDb(Locker locker,
java.lang.String databaseName,
DatabaseConfig dbConfig,
Database databaseHandle)
Creates a new database object given a database name. |
void |
dbRemove(Locker locker,
java.lang.String databaseName)
Remove a database. |
void |
dbRename(Locker locker,
java.lang.String databaseName,
java.lang.String newName)
Rename a database. |
static void |
decThreadLocalReferenceCount()
|
void |
dumpMapTree()
For debugging. |
void |
enableDebugLoggingToDbLog()
Add the database log as one of the debug logging destinations when the logging system is sufficiently initialized. |
void |
envConfigUpdate(DbConfigManager mgr)
Respond to config updates. |
void |
forceClose()
|
long |
forceLogFileFlip()
Flip the log to a new file, forcing an fsync. |
static int |
getAdler32ChunkSize()
|
Checkpointer |
getCheckpointer()
|
Cleaner |
getCleaner()
|
DbConfigManager |
getConfigManager()
Returns the config manager for the current base configuration. |
DatabaseImpl |
getDb(Locker locker,
java.lang.String databaseName,
Database databaseHandle)
Get a database object given a database name. |
boolean |
getDbEviction()
Returns whether DB/MapLN eviction is enabled. |
DbTree |
getDbMapTree()
|
java.util.List |
getDbNames()
|
boolean |
getDeferredWriteTemp()
|
java.io.File |
getEnvironmentHome()
Get the environment home directory. |
Evictor |
getEvictor()
|
ExceptionListener |
getExceptionListener()
|
static boolean |
getFairLatches()
|
FileManager |
getFileManager()
|
INCompressor |
getINCompressor()
Return the incompressor. |
int |
getINCompressorQueueSize()
|
INList |
getInMemoryINs()
|
RecoveryInfo |
getLastRecoveryInfo()
Info about the last recovery |
long |
getLockTimeout()
|
java.util.logging.Logger |
getLogger()
|
LogManager |
getLogManager()
|
MemoryBudget |
getMemoryBudget()
|
static boolean |
getNoComparators()
|
ReplicatorInstance |
getReplicator()
|
long |
getRootLsn()
|
static boolean |
getSharedLatches()
|
static int |
getThreadLocalReferenceCount()
|
SharedLatch |
getTriggerLatch()
Returns the shared trigger latch. |
TxnManager |
getTxnManager()
|
long |
getTxnTimeout()
|
UtilizationProfile |
getUtilizationProfile()
Returns the UtilizationProfile. |
UtilizationTracker |
getUtilizationTracker()
Returns the UtilizationTracker. |
void |
incReferenceCount()
|
static void |
incThreadLocalReferenceCount()
|
void |
invalidate(java.lang.Error e)
|
void |
invalidate(RunRecoveryException e)
Invalidate the environment. |
boolean |
invokeCheckpoint(CheckpointConfig config,
boolean flushAll,
java.lang.String invokingSource)
Invoke a checkpoint programatically. |
int |
invokeCleaner()
|
boolean |
invokeCompressor()
Invoke a compress programatically. |
void |
invokeEvictor()
|
boolean |
isClosed()
|
boolean |
isClosing()
|
boolean |
isMemOnly()
|
boolean |
isNoLocking()
|
boolean |
isOpen()
|
boolean |
isReadOnly()
|
boolean |
isReplicated()
Return true if this environment is part of a replication group. |
boolean |
isTransactional()
|
void |
lazyCompress(IN in,
UtilizationTracker tracker)
Do lazy compression at opportune moments. |
EnvironmentStats |
loadStats(StatsConfig config)
Retrieve and return stat information. |
LockStats |
lockStat(StatsConfig config)
Retrieve lock statistics |
void |
logMapTreeRoot()
Log the map tree root and save the LSN. |
static boolean |
maybeForceYield()
For stress testing. |
boolean |
mayNotWrite()
When a RunRecoveryException occurs or the environment is closed, further writing can cause log corruption. |
void |
open()
Not much to do, mark state. |
void |
readMapTreeFromLog(long rootLsn)
Set the mapping tree from the log. |
void |
releaseDb(DatabaseImpl db)
Decrements the use count of the given DB, allowing it to be evicted if the use count reaches zero. |
void |
removeConfigObserver(EnvConfigObserver o)
Removes an observer of mutable config changes. |
void |
rewriteMapTreeRoot(long cleanerTargetLsn)
Force a rewrite of the map tree root if required. |
boolean |
scanLog(long startPosition,
long endPosition,
LogScanConfig config,
LogScanner scanner)
|
void |
setBackgroundSleepHook(TestHook hook)
|
void |
setExceptionListener(ExceptionListener exceptionListener)
|
void |
setMutableConfig(EnvironmentMutableConfig config)
Changes the mutable config properties that are present in the given config, and notifies all config observer. |
void |
setReplicator(ReplicatorInstance repInstance)
|
(package private) void |
shutdownCheckpointer()
|
void |
shutdownCleaner()
public for unit tests. |
void |
shutdownEvictor()
|
void |
shutdownINCompressor()
Available for the unit tests. |
void |
sleepAfterBackgroundIO()
If the sleep backlog is non-zero (set by updateBackgroundReads or updateBackgroundWrites), sleep for the configured interval and decrement the backlog. |
TruncateResult |
truncate(Locker locker,
DatabaseImpl database)
Deprecated. This supports Database.truncate(), which is deprecated. |
long |
truncate(Locker locker,
java.lang.String databaseName,
boolean returnCount)
Truncate a database. |
Txn |
txnBegin(Transaction parent,
TransactionConfig txnConfig)
Transactional services. |
TransactionStats |
txnStat(StatsConfig config)
Retrieve txn statistics |
void |
updateBackgroundReads(int nReads)
If a background read limit has been configured and that limit is exceeded when the cumulative total is incremented by the given number of reads, increment the sleep backlog to cause a sleep to occur. |
void |
updateBackgroundWrites(int writeSize,
int logBufferSize)
If a background write limit has been configured and that limit is exceeded when the given amount written is added to the cumulative total, increment the sleep backlog to cause a sleep to occur. |
boolean |
useDirectNIO()
|
boolean |
verify(VerifyConfig config,
java.io.PrintStream out)
|
void |
verifyCursors()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected LogManager logManager
public final RunRecoveryException SAVED_RRE
public static final boolean JAVA5_AVAILABLE
Constructor Detail |
---|
public EnvironmentImpl(java.io.File envHome, EnvironmentConfig envConfig) throws DatabaseException
envHome
- absolute path of the database environment
home directoryenvConfig
-
DatabaseException
- on all other failuresMethod Detail |
---|
public void envConfigUpdate(DbConfigManager mgr) throws DatabaseException
envConfigUpdate
in interface EnvConfigObserver
DatabaseException
public INCompressor getINCompressor()
public UtilizationTracker getUtilizationTracker()
public UtilizationProfile getUtilizationProfile()
public void updateBackgroundReads(int nReads)
sleepAfterBackgroundIO()
public void updateBackgroundWrites(int writeSize, int logBufferSize)
The number of writes is estimated by dividing the bytes written by the log buffer size. Since the log write buffer is shared by all writers, this is the best approximation possible.
sleepAfterBackgroundIO()
public void sleepAfterBackgroundIO()
If two threads call this method and the first call causes a sleep, the call by the second thread will block until the first thread's sleep interval is over. When the call by the second thread is unblocked, if another sleep is needed then the second thread will sleep again. In other words, when lots of sleeps are needed, background threads may backup. This is intended to give foreground threads a chance to "catch up" when background threads are doing a lot of IO.
public void setBackgroundSleepHook(TestHook hook)
public boolean scanLog(long startPosition, long endPosition, LogScanConfig config, LogScanner scanner) throws DatabaseException
DatabaseException
public void logMapTreeRoot() throws DatabaseException
DatabaseException
public void rewriteMapTreeRoot(long cleanerTargetLsn) throws DatabaseException
DatabaseException
public long getRootLsn()
public void readMapTreeFromLog(long rootLsn) throws DatabaseException
DatabaseException
public void addToCompressorQueue(BIN bin, Key deletedKey, boolean doWakeup) throws DatabaseException
DatabaseException
public void addToCompressorQueue(BINReference binRef, boolean doWakeup) throws DatabaseException
DatabaseException
public void addToCompressorQueue(java.util.Collection binRefs, boolean doWakeup) throws DatabaseException
DatabaseException
public void lazyCompress(IN in, UtilizationTracker tracker) throws DatabaseException
DatabaseException
public void enableDebugLoggingToDbLog() throws DatabaseException
DatabaseException
public void closeLogger()
public void open()
public void invalidate(RunRecoveryException e)
public void invalidate(java.lang.Error e)
public boolean isOpen()
public boolean isClosing()
public boolean isClosed()
public boolean mayNotWrite()
public void checkIfInvalid() throws RunRecoveryException
RunRecoveryException
public void checkNotClosed() throws DatabaseException
DatabaseException
public void close() throws DatabaseException
DatabaseException
public void close(boolean doCheckpoint) throws DatabaseException
DatabaseException
public void closeAfterRunRecovery() throws DatabaseException
DatabaseException
public void forceClose() throws DatabaseException
DatabaseException
public void incReferenceCount()
public static int getThreadLocalReferenceCount()
public static void incThreadLocalReferenceCount()
public static void decThreadLocalReferenceCount()
public static boolean getNoComparators()
public boolean invokeCheckpoint(CheckpointConfig config, boolean flushAll, java.lang.String invokingSource) throws DatabaseException
DatabaseException
public long forceLogFileFlip() throws DatabaseException
DatabaseException
public boolean invokeCompressor() throws DatabaseException
DatabaseException
public void invokeEvictor() throws DatabaseException
DatabaseException
public int invokeCleaner() throws DatabaseException
DatabaseException
public void shutdownINCompressor() throws java.lang.InterruptedException
java.lang.InterruptedException
public void shutdownEvictor() throws java.lang.InterruptedException
java.lang.InterruptedException
void shutdownCheckpointer() throws java.lang.InterruptedException
java.lang.InterruptedException
public void shutdownCleaner() throws java.lang.InterruptedException
java.lang.InterruptedException
public boolean isNoLocking()
public boolean isTransactional()
public boolean isReadOnly()
public boolean isMemOnly()
public static boolean getFairLatches()
public static boolean getSharedLatches()
public boolean getDbEviction()
public boolean getDeferredWriteTemp()
public boolean useDirectNIO()
public static int getAdler32ChunkSize()
public DatabaseImpl createDb(Locker locker, java.lang.String databaseName, DatabaseConfig dbConfig, Database databaseHandle) throws DatabaseException
DatabaseException
public DatabaseImpl getDb(Locker locker, java.lang.String databaseName, Database databaseHandle) throws DatabaseException
databaseName
- target database.
DatabaseException
public void releaseDb(DatabaseImpl db)
public java.util.List getDbNames() throws DatabaseException
DatabaseException
public void dumpMapTree() throws DatabaseException
DatabaseException
public void dbRename(Locker locker, java.lang.String databaseName, java.lang.String newName) throws DatabaseException
DatabaseException
public void dbRemove(Locker locker, java.lang.String databaseName) throws DatabaseException
DatabaseException
public TruncateResult truncate(Locker locker, DatabaseImpl database) throws DatabaseException
DatabaseException
public long truncate(Locker locker, java.lang.String databaseName, boolean returnCount) throws DatabaseException
DatabaseException
public Txn txnBegin(Transaction parent, TransactionConfig txnConfig) throws DatabaseException
DatabaseException
public LogManager getLogManager()
public FileManager getFileManager()
public DbTree getDbMapTree()
public DbConfigManager getConfigManager()
The configuration can change, but changes are made by replacing the config manager object with a enw one. To use a consistent set of properties, call this method once and query the returned manager repeatedly for each property, rather than getting the config manager via this method for each property individually.
public EnvironmentConfig cloneConfig()
public EnvironmentMutableConfig cloneMutableConfig()
public void checkImmutablePropsForEquality(EnvironmentConfig config) throws java.lang.IllegalArgumentException
java.lang.IllegalArgumentException
public void setMutableConfig(EnvironmentMutableConfig config) throws DatabaseException
DatabaseException
public void setExceptionListener(ExceptionListener exceptionListener)
public ExceptionListener getExceptionListener()
public void addConfigObserver(EnvConfigObserver o)
public void removeConfigObserver(EnvConfigObserver o)
public INList getInMemoryINs()
public TxnManager getTxnManager()
public Checkpointer getCheckpointer()
public Cleaner getCleaner()
public MemoryBudget getMemoryBudget()
public java.util.logging.Logger getLogger()
public boolean verify(VerifyConfig config, java.io.PrintStream out) throws DatabaseException
DatabaseException
public void verifyCursors() throws DatabaseException
DatabaseException
public EnvironmentStats loadStats(StatsConfig config) throws DatabaseException
DatabaseException
public LockStats lockStat(StatsConfig config) throws DatabaseException
DatabaseException
public TransactionStats txnStat(StatsConfig config) throws DatabaseException
DatabaseException
public int getINCompressorQueueSize() throws DatabaseException
DatabaseException
public RecoveryInfo getLastRecoveryInfo()
public java.io.File getEnvironmentHome()
public long getTxnTimeout()
public long getLockTimeout()
public SharedLatch getTriggerLatch()
public Evictor getEvictor()
void alertEvictor()
public boolean isReplicated()
public ReplicatorInstance getReplicator()
public void setReplicator(ReplicatorInstance repInstance)
public static boolean maybeForceYield()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |