| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Object
   com.tangosol.io.bdb.DatabaseFactory.EnvironmentHolder
com.tangosol.io.bdb.DatabaseFactory.EnvironmentHolder
protected static class DatabaseFactory.EnvironmentHolder
Holder for Berkeley DB Environment and its Databases.
The Environment and Databases will be automatically flushed upon JVM shutdown or GC of the associated DatabaseFactory. For temporary Environments, the data will also be deleted. These operations are accomplished by registering this class as a JVM shutdown hook.
This logic is maintained externally from DatabaseFactory to allow for the Factory to be GC'd. If the Factory acted as the shutdown hook then it would never be GC'd as the Runtime would always hold a reference to it via the registered shutdown hook.
| Nested Class Summary | |
|---|---|
| protected static class | DatabaseFactory.EnvironmentHolder.DirectoryLockDirectory based lock. | 
| Field Summary | |
|---|---|
| static java.lang.String | ENVIRONMENT_NAME_PREFIXPrefix for temporary environment names. | 
| static java.lang.String | JE_PROPERTY_PREFIXPrefix for all Berkeley DB JE configuration settings. | 
| protected  java.util.Collection | m_colRegisteredDbsDatabases to close prior to deleting the Environment. | 
| protected  java.io.File | m_dirEnvEnvironment directory. | 
| protected  DatabaseFactory.EnvironmentHolder.DirectoryLock | m_dirLockLock held on the directory associated with the Environment. | 
| protected  java.io.File | m_dirParentConfiguration setting for parent directory. | 
| protected  com.sleepycat.je.Environment | m_envBerkeley DB Environment for managing Databases. | 
| protected  com.sleepycat.je.EnvironmentConfig | m_envConfigBerkeley DB Environment Configuration. | 
| protected  boolean | m_fTemporaryFlag indicating if this is a temporary environment. | 
| protected  java.lang.Thread | m_threadShutdownHookShutdown hook for closing environment. | 
| protected  XmlElement | m_xmlConfigConfiguration. | 
| static java.lang.String | SUB_DIR_NAMEDefault directory name for berkeley db environments. | 
| static java.lang.String | TEMP_FILE_NAME_PREFIXPrefix for temporary file names. | 
| Constructor Summary | |
|---|---|
| DatabaseFactory.EnvironmentHolder(BerkeleyDBBinaryStoreManager bdbManager)Construct a EnvironmentHolder for a given Berkeley DB Environment. | |
| Method Summary | |
|---|---|
|  void | closeEnvironment(boolean fDeregister)Close an Environment. | 
| protected  java.io.File | computeTmpDir()Compute the system's temp directory. | 
| protected  void | configure(BerkeleyDBBinaryStoreManager bdbManager)Configure the new Environment. | 
| protected  void | createPersistentEnvironment()Create a persistent Environment. | 
| protected  void | createTemporaryEnvironment()Create a temporary Environment. | 
|  void | forgetDatabase(com.sleepycat.je.Database db)Remove a database handle from the cleanup list. | 
| protected  java.lang.String | generateEnvironmentName()Generate a potentially unique Environment name. | 
|  java.io.File | getDirEnv()Get the Environment Directory. | 
|  DatabaseFactory.EnvironmentHolder.DirectoryLock | getDirLock()Get the DirectoryLock held on a temporary Environment. | 
|  java.io.File | getDirParent()Get the Parent Directory. | 
|  com.sleepycat.je.EnvironmentConfig | getEnvConfig()Get the Environment Configuration. | 
|  com.sleepycat.je.Environment | getEnvironment()Get underlying Berkeley DB Environment. | 
|  java.util.Collection | getRegisteredDbs()Get the registered Databases. | 
|  XmlElement | getXmlConfig()Get the XML Configuration. | 
|  boolean | isTemporary()Return true if this is a temporary environment. | 
|  void | run()Shutdown hook runnable method. | 
|  java.lang.String | toString()Return a human readable description of the EnvironmentHolder. | 
|  void | trackDatabase(com.sleepycat.je.Database db)Add a database handle to the trackings list. | 
| Field Detail | 
|---|
public static final java.lang.String SUB_DIR_NAME
public static final java.lang.String ENVIRONMENT_NAME_PREFIX
public static final java.lang.String TEMP_FILE_NAME_PREFIX
public static final java.lang.String JE_PROPERTY_PREFIX
protected XmlElement m_xmlConfig
protected java.io.File m_dirParent
protected java.io.File m_dirEnv
protected com.sleepycat.je.EnvironmentConfig m_envConfig
protected com.sleepycat.je.Environment m_env
protected java.util.Collection m_colRegisteredDbs
protected DatabaseFactory.EnvironmentHolder.DirectoryLock m_dirLock
protected boolean m_fTemporary
protected java.lang.Thread m_threadShutdownHook
| Constructor Detail | 
|---|
public DatabaseFactory.EnvironmentHolder(BerkeleyDBBinaryStoreManager bdbManager)
                                  throws com.sleepycat.je.DatabaseException
Berkeley DB Environments are bound to a single directory. Java File locking is used to ensure that only one JVM uses the Environment. The new environment will be created in a unique sub directory of the specificed parent directory.
bdbManager - the BinaryStoreManager to create an environment forcom.sleepycat.je.DatabaseException - if the Berkeley DB Environment could not be created| Method Detail | 
|---|
public java.lang.String toString()
public void forgetDatabase(com.sleepycat.je.Database db)
Databases which are closed externally may be removed from tracking.
db - the Database to remove from listpublic void run()
This is responsible for cleaning up the databases and associated directories when the JVM exits.
run in interface java.lang.Runnablepublic void closeEnvironment(boolean fDeregister)
This includes closing the environment and databases, and if temporary deleting the associated files.
fDeregister - indicates if the shutdown hook should be deregisteredpublic void trackDatabase(com.sleepycat.je.Database db)
Databases for the environment must be tracked so that they may be closed prior to closing the environment.
db - the Database to add to the listprotected void configure(BerkeleyDBBinaryStoreManager bdbManager)
bdbManager - the BinaryStoreManager to create an environment forprotected java.io.File computeTmpDir()
null if it could not be determined
protected void createTemporaryEnvironment()
                                   throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException - if environment creation fails
protected void createPersistentEnvironment()
                                    throws com.sleepycat.je.DatabaseException
com.sleepycat.je.DatabaseException - if environment creation failsprotected java.lang.String generateEnvironmentName()
public com.sleepycat.je.Environment getEnvironment()
public XmlElement getXmlConfig()
public java.io.File getDirParent()
public java.io.File getDirEnv()
public com.sleepycat.je.EnvironmentConfig getEnvConfig()
public java.util.Collection getRegisteredDbs()
public DatabaseFactory.EnvironmentHolder.DirectoryLock getDirLock()
public boolean isTemporary()
| 
 | Oracle® Fusion Middleware Java API Reference for Oracle Coherence 12c (12.1.3.0.0) E47890-01 | |||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||