Class BerkeleyDBBinaryStore.DatabaseHolder

java.lang.Object
com.tangosol.io.bdb.BerkeleyDBBinaryStore.DatabaseHolder
Enclosing class:
BerkeleyDBBinaryStore

protected class BerkeleyDBBinaryStore.DatabaseHolder extends Object
The DatabaseHolder class is used as a wrapper around a Berkeley DB Database object.

Database objects cannot be closed if they are in use by other threads. The Java garbage collector and this holder are utilized to delay closing the Database until it is guaranteed to not be in use.

  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected com.sleepycat.je.Database
    The underlying Database Handle.
    protected boolean
    Flag indicating if the database is temporary.
    protected String
    The name of the underlying Database.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Construct a DatabaseHolder, including a Database.
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    Close the Database.
    protected void
    Finalize the holder, deleting the database if it is temporary.
    com.sleepycat.je.Database
    Get the underlying Database handle.
    Get the name of the underlying Database.
    boolean
    Return if the database is temporary.
    Return the Holder's human readable description.

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

    • m_db

      protected com.sleepycat.je.Database m_db
      The underlying Database Handle.
    • m_sDbName

      protected String m_sDbName
      The name of the underlying Database.

      The name is maintained externally from the Database as calls to Database.getDatabaseName() are costly.

    • m_fTemporary

      protected boolean m_fTemporary
      Flag indicating if the database is temporary.

      Temporary databases are automatically deleted on shutdown or GC.

  • Constructor Details

    • DatabaseHolder

      public DatabaseHolder(String sDbName) throws com.sleepycat.je.DatabaseException
      Construct a DatabaseHolder, including a Database.
      Parameters:
      sDbName - if non null specifies the name of a persistent database.
      Throws:
      com.sleepycat.je.DatabaseException
  • Method Details

    • toString

      public String toString()
      Return the Holder's human readable description.
      Overrides:
      toString in class Object
      Returns:
      the Holder's human readable description
    • finalize

      protected void finalize() throws Throwable
      Finalize the holder, deleting the database if it is temporary.
      Overrides:
      finalize in class Object
      Throws:
      Throwable - if the removal fails
    • getDb

      public com.sleepycat.je.Database getDb()
      Get the underlying Database handle.
      Returns:
      the Database handle
    • getName

      public String getName()
      Get the name of the underlying Database.
      Returns:
      the Database name
    • isTemporary

      public boolean isTemporary()
      Return if the database is temporary.
      Returns:
      true if the database is temporary
    • closeDb

      protected void closeDb() throws com.sleepycat.je.DatabaseException
      Close the Database.

      If this is a temporary, or empty persistent DB, then it will be deleted.

      Throws:
      com.sleepycat.je.DatabaseException