|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.sgs.impl.service.data.store.db.je.JeEnvironment
public class JeEnvironment
Provides a database implementation based on Berkeley DB Java Edition.
Operations on classes in this package will throw an Error if the
underlying Berkeley DB database requires recovery. In that case, callers
need to restart the application or create a new instance of this class.
Note that, although databases returned by this class provide support for the
DbTransaction.prepare method, they do not
provide facilities for resolving prepared transactions after a crash.
Callers can work around this limitation by insuring that the transaction
implementation calls TransactionParticipant.prepareAndCommit to commit transactions on this
class. The current transaction implementation calls
prepareAndCommit on durable participants, so the inability to
resolve prepared transactions should have no effect at present.
The constructor supports the following
configuration properties:
false
false, the modifications made in some
of the most recent transactions may be lost if the host crashes, although
data integrity will be maintained. Flushing changes to disk avoids data
loss but introduces a significant reduction in performance.
com.sun.sgs.txn.timeout property, if
specified, otherwise times the value of the default transaction
timeout.
0, and should be less than
the transaction timeout.
-1
-1 by default, which disables statistics
logging.
SERIALIZABLE
READ_UNCOMMITTED,
READ_COMMITTED,
REPEATABLE_READ, or
SERIALIZABLE.
The constructor also supports any initialization properties supported by the
Berkeley DB Environment class that start with the je.
prefix.
Unless overridden, this implementation provides the following non-default settings for Berkeley DB initialization properties:
je.checkpointer.bytesInterval 1000000
je.env.sharedLatches true
This class uses the Logger named
com.sun.sgs.impl.service.data.db.je to log information at
the following logging levels:
SEVERE - Berkeley DB failures
that require application restart and recovery
WARNING - Berkeley DB
exceptions
INFO - Berkeley DB statistics
CONFIG - Constructor properties
| Nested Class Summary | |
|---|---|
static class |
JeEnvironment.TxnIsolationLevel
The supported transaction isolation levels. |
| Field Summary | |
|---|---|
static long |
DEFAULT_LOCK_TIMEOUT
The default value of the lock timeout property, if no transaction timeout is specified. |
static double |
DEFAULT_LOCK_TIMEOUT_PROPORTION
The default proportion of the transaction timeout to use for the lock timeout, if no lock timeout is specified. |
static String |
FLUSH_TO_DISK_PROPERTY
The property that specifies whether to flush changes to disk on transaction boundaries. |
static String |
LOCK_TIMEOUT_PROPERTY
The property that specifies the amount of time permitted to obtain a lock, in milliseconds. |
(package private) static LoggerWrapper |
logger
The logger for this class. |
static String |
STATS_PROPERTY
The property that specifies the interval in milliseconds between calls to log database statistics, or a negative value to disable logging. |
static String |
TXN_ISOLATION_PROPERTY
The property that specifies the default transaction isolation level. |
| Constructor Summary | |
|---|---|
JeEnvironment(String directory,
Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
Creates an instance of this class. |
|
| Method Summary | |
|---|---|
DbTransaction |
beginTransaction(long timeout)
Begins a new transaction with the specified timeout and the implementation-specific default isolation level. |
DbTransaction |
beginTransaction(long timeout,
boolean fullIsolation)
Begins a transaction with the specified timeout and isolation level. |
void |
close()
Closes the environment, releasing any associated resources. |
(package private) static RuntimeException |
convertException(Exception e,
boolean convertTxnExceptions)
Returns the correct exception for a Berkeley DB DatabaseException, or XAException, thrown during an operation. |
DbDatabase |
openDatabase(DbTransaction txn,
String fileName,
boolean create)
Opens a database. |
boolean |
useAllocationBlockPlaceholders()
Specifies whether object allocations in this environment should use a placeholder at the end of each allocation block to avoid allocation concurrency conflicts. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
static final LoggerWrapper logger
public static final String FLUSH_TO_DISK_PROPERTY
public static final String LOCK_TIMEOUT_PROPERTY
public static final double DEFAULT_LOCK_TIMEOUT_PROPORTION
public static final long DEFAULT_LOCK_TIMEOUT
public static final String STATS_PROPERTY
public static final String TXN_ISOLATION_PROPERTY
| Constructor Detail |
|---|
public JeEnvironment(String directory,
Properties properties,
ComponentRegistry systemRegistry,
TransactionProxy txnProxy)
directory - the directory containing database filesproperties - the properties to configure this instancesystemRegistry - the registry of available system componentstxnProxy - the transaction proxy
DbDatabaseException - if an unexpected database problem occurs| Method Detail |
|---|
static RuntimeException convertException(Exception e,
boolean convertTxnExceptions)
public DbTransaction beginTransaction(long timeout)
beginTransaction in interface DbEnvironmenttimeout - the number of milliseconds the transaction should be
allowed to run
public DbTransaction beginTransaction(long timeout,
boolean fullIsolation)
beginTransaction in interface DbEnvironmenttimeout - the number of milliseconds the transaction should be
allowed to runfullIsolation - if true, requires the transaction to
support full serializable isolation, otherwise uses the default
transaction isolation level
public DbDatabase openDatabase(DbTransaction txn,
String fileName,
boolean create)
throws FileNotFoundException
directory argument passed to DbEnvironmentFactory.getEnvironment.
openDatabase in interface DbEnvironmenttxn - the transaction under which the database should be openedfileName - the name of the file containing the databasecreate - whether to create the database if it does not exist
FileNotFoundException - if create is false and
the database is not foundpublic void close()
close in interface DbEnvironmentpublic boolean useAllocationBlockPlaceholders()
This implementation returns true to specify that this
environment requires the use of allocation block placeholders.
useAllocationBlockPlaceholders in interface DbEnvironment
|
RedDwarf, Version 0.10.1 2010-03-14 10:56:12 |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||