|
|||||||||
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 |
IS_DALVIK
|
protected LogManager |
logManager
|
RunRecoveryException |
SAVED_RRE
|
static boolean |
USE_JAVA5_ADLER32
|
Constructor Summary | |
---|---|
EnvironmentImpl(java.io.File envHome,
EnvironmentConfig envConfig,
EnvironmentImpl sharedCacheEnv,
boolean replicationIntended)
Create a database environment to represent the data in envHome. |
Method Summary | |
---|---|
void |
abnormalClose()
Used by tests to close an environment to simulate a crash. |
void |
acquireAPIReadLock(Locker who)
|
void |
acquireAPIWriteLock(int time,
java.util.concurrent.TimeUnit units)
|
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<BINReference> binRefs,
boolean doWakeup)
Tells the asynchronous IN compressor thread about a collections of BINReferences with deleted entries. |
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()
Decrements the reference count and closes the enviornment when it reaches zero. |
void |
close(boolean doCheckpoint)
Decrements the reference count and closes the environment when it reaches zero. |
void |
closeAfterRunRecovery()
|
void |
closeLogger()
Close down the logger. |
static void |
decThreadLocalReferenceCount()
|
void |
enableDebugLoggingToDbLog()
Add the database log as one of the debug logging destinations when the logging system is sufficiently initialized. |
void |
envConfigUpdate(DbConfigManager mgr,
EnvironmentMutableConfig newConfig)
Respond to config updates. |
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. |
boolean |
getDbEviction()
Returns whether DB/MapLN eviction is enabled. |
DbTree |
getDbTree()
|
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()
|
NodeSequence |
getNodeSequence()
|
ReplicatorInstance |
getReplicator()
|
long |
getRootLsn()
|
boolean |
getSharedCache()
|
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. |
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,
LocalUtilizationTracker localTracker)
Do lazy compression at opportune moments. |
EnvironmentStats |
loadStats(StatsConfig config)
Retrieve and return stat information. |
LockStats |
lockStat(StatsConfig config)
Retrieve lock statistics |
void |
logMapTreeRoot()
Logs the map tree root and saves the LSN. |
void |
logMapTreeRoot(long ifBeforeLsn)
Logs the map tree root, but only if its current LSN is before the ifBeforeLsn parameter or ifBeforeLsn is NULL_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,
boolean replicationIntended)
Set the mapping tree from the log. |
void |
reinit(boolean replicationIntended)
Reinitialize after an Internal Init copies new *.jdb files into envhome. |
boolean |
releaseAPIReadLock(Locker who)
|
void |
releaseAPIWriteLock()
|
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)
|
void |
setupAPILock()
|
void |
shutdownCleaner()
public for 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. |
void |
stopDaemons()
For unit testing -- shuts down daemons completely but leaves environment usable since environment references are not nulled out. |
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 USE_JAVA5_ADLER32
public static final boolean IS_DALVIK
Constructor Detail |
---|
public EnvironmentImpl(java.io.File envHome, EnvironmentConfig envConfig, EnvironmentImpl sharedCacheEnv, boolean replicationIntended) throws DatabaseException
envHome
- absolute path of the database environment
home directoryenvConfig
- sharedCacheEnv
- if non-null, is another environment that is
sharing the cache with this environment; if null, this environment is
not sharing the cache or is the first environment to share the cache.
DatabaseException
- on all other failuresMethod Detail |
---|
public void reinit(boolean replicationIntended) throws DatabaseException
DatabaseException
public void envConfigUpdate(DbConfigManager mgr, EnvironmentMutableConfig newConfig) 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 void setupAPILock() throws DatabaseException
DatabaseException
public void acquireAPIWriteLock(int time, java.util.concurrent.TimeUnit units) throws DatabaseException
DatabaseException
public void releaseAPIWriteLock() throws DatabaseException
DatabaseException
public void acquireAPIReadLock(Locker who) throws DatabaseException
DatabaseException
public boolean releaseAPIReadLock(Locker who) throws DatabaseException
DatabaseException
public boolean scanLog(long startPosition, long endPosition, LogScanConfig config, LogScanner scanner) throws DatabaseException
DatabaseException
public void logMapTreeRoot() throws DatabaseException
DatabaseException
public void logMapTreeRoot(long ifBeforeLsn) throws DatabaseException
DatabaseException
public void rewriteMapTreeRoot(long cleanerTargetLsn) throws DatabaseException
DatabaseException
public long getRootLsn()
public void readMapTreeFromLog(long rootLsn, boolean replicationIntended) 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<BINReference> binRefs, boolean doWakeup) throws DatabaseException
DatabaseException
public void lazyCompress(IN in, LocalUtilizationTracker localTracker) 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 abnormalClose() throws DatabaseException
DatabaseException
public void closeAfterRunRecovery() throws DatabaseException
DatabaseException
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 stopDaemons() 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 useDirectNIO()
public static int getAdler32ChunkSize()
public boolean getSharedCache()
public Txn txnBegin(Transaction parent, TransactionConfig txnConfig) throws DatabaseException
DatabaseException
public LogManager getLogManager()
public FileManager getFileManager()
public DbTree getDbTree()
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 NodeSequence getNodeSequence()
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()
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 |