public class SEnvironmentConfig
extends java.lang.Object
For a user created instance, no attribute is set by default. In addition, calling the getter method of an unset attribute results in an IllegalStateException. To set an attribute, call the setter method of the attribute.
When used to construct an environment, system default values are used for unset attributes. When used to modify the configuration of an existing environment, only set attributes are modified; unset attributes are not modified.
Constructor and Description |
---|
SEnvironmentConfig()
Create an empty SEnvironmentConfig with no attribute set.
|
Modifier and Type | Method and Description |
---|---|
boolean |
getAllowCreate()
Return true if the environment is configured to create any underlying
files, as necessary.
|
int |
getCacheCount()
Return the number of shared memory buffer pools, that is, the number of
cache regions.
|
long |
getCacheSize()
Return the size of the shared memory buffer pool, that is, the cache.
|
protected java.lang.Object |
getField(F field)
Return the value set on a specified field.
|
boolean |
getInitializeCache()
Always return true.
|
boolean |
getInitializeCDB()
Always return false.
|
boolean |
getInitializeLocking()
Always return true.
|
SLockDetectMode |
getLockDetectMode()
Return the policy used by the deadlock detector.
|
boolean |
getMultiversion()
Return true if the handle is configured to open all databases for
multiversion concurrency control.
|
boolean |
getRunRecovery()
Return true if the handle is configured to run normal recovery on the
environment before opening it for use.
|
protected T |
getThriftObj() |
boolean |
getTransactional()
Always return true.
|
boolean |
getTxnNoSync()
Return true if the system has been configured to not write or
synchronously flush the log on transaction commit.
|
boolean |
getTxnNoWait()
Return true if the transactions have been configured to not wait for
locks by default.
|
boolean |
getTxnSnapshot()
Return true if the handle is configured to run all transactions at
snapshot isolation.
|
boolean |
getTxnWriteNoSync()
Return true if the system has been configured to write, but not
synchronously flush, the log on transaction commit.
|
SEnvironmentConfig |
setAllowCreate(boolean allowCreate)
Configure the environment to create any underlying files, as necessary.
|
SEnvironmentConfig |
setCacheCount(int cacheCount)
Set the number of shared memory buffer pools.
|
SEnvironmentConfig |
setCacheSize(long cacheSize)
Set the size of the cache.
|
SEnvironmentConfig |
setEncrypted(java.lang.String password)
Set the password used to perform encryption and decryption.
|
SEnvironmentConfig |
setLockDetectMode(SLockDetectMode lockDetectMode)
Set policy used by the deadlock detector.
|
SEnvironmentConfig |
setMultiversion(boolean multiversion)
Configure the database environment to open all databases that are not
using the queue access method for multiversion concurrency control.
|
SEnvironmentConfig |
setRunRecovery(boolean runRecovery)
Configure to run normal recovery on this environment before opening it
for normal use.
|
SEnvironmentConfig |
setTxnNoSync(boolean txnNoSync)
Configure the system to not write or synchronously flush the log on
transaction commit.
|
SEnvironmentConfig |
setTxnNoWait(boolean txnNoWait)
If a lock is unavailable for any Berkeley DB operation performed in the
context of a transaction, cause the operation to throw
SLockNotGrantedException without waiting for the lock. |
SEnvironmentConfig |
setTxnSnapshot(boolean txnSnapshot)
Configure the database environment to run transactions at snapshot
isolation by default.
|
SEnvironmentConfig |
setTxnWriteNoSync(boolean txnWriteNoSync)
Configure the system to write, but not synchronously flush, the log on
transaction commit.
|
public SEnvironmentConfig()
public boolean getAllowCreate()
public SEnvironmentConfig setAllowCreate(boolean allowCreate)
allowCreate
- if true, configure the environment to create any
underlying files, as necessarypublic int getCacheCount()
public SEnvironmentConfig setCacheCount(int cacheCount)
It is possible to specify caches large enough so that they cannot be allocated contiguously on some architectures. This method allows applications to break the cache into a number of equally sized, separate pieces of memory.
This method configures an environment, including all handles on the environment, not only the operations performed using a specified handle.
This attribute cannot be changed after the environment is constructed. If joining an existing environment, this attribute is ignored.
cacheCount
- the number of shared buffer poolspublic long getCacheSize()
public SEnvironmentConfig setCacheSize(long cacheSize)
The cache should be the size of the normal working data set of the application, with some small amount of additional memory for unusual situations. (Note: the working set is not the same as the number of pages accessed simultaneously, and is usually much larger.)
The default cache size is 256KB, and may not be specified as less than 20KB. Any cache size less than 500MB is automatically increased by 25% to account for buffer pool overhead; cache sizes larger than 500MB are used as specified. The current maximum size of a single cache is 4GB. (All sizes are in powers-of-two, that is, 256KB is 2^18 not 256,000.)
This method configures an environment, including all handles on the environment, not only the operations performed using a specified handle.
This attribute cannot be changed after the environment is constructed. If joining an existing environment, this attribute is ignored.
cacheSize
- the size of the cachepublic SEnvironmentConfig setEncrypted(java.lang.String password)
password
- the passwordpublic boolean getInitializeCache()
public boolean getInitializeLocking()
public boolean getInitializeCDB()
public SLockDetectMode getLockDetectMode()
public SEnvironmentConfig setLockDetectMode(SLockDetectMode lockDetectMode)
This method configures an environment, including all handles on the environment, not only the operations performed using a specified handle.
This attribute cannot be changed after the environment is constructed. If joining an existing environment, this attribute is ignored.
lockDetectMode
- the lock request to be rejectedpublic boolean getMultiversion()
public SEnvironmentConfig setMultiversion(boolean multiversion)
This method only affects the specified SEnvironment
handle (and
any other library handles opened within the scope of that handle). For
consistent behavior across the environment, all SEnvironment handles
opened in the database environment must call this method.
multiversion
- if true, all databases that are not using the queue
access method will be opened for multiversion concurrency control.public boolean getRunRecovery()
public SEnvironmentConfig setRunRecovery(boolean runRecovery)
A standard part of the recovery process is to remove the existing database environment and create a new one. If the thread of control performing recovery does not specify the correct database environment initialization information (for example, the correct memory pool cache size), the result can be an application running in an environment with incorrect cache and other subsystem sizes. For this reason, the thread of control performing recovery should specify correct configuration information before recovering the environment.
All recovery processing must be single-threaded; that is, only a single thread of control may perform recovery or access a database environment while recovery is being performed.
runRecovery
- if true, configure to run normal recovery on this
environment before opening it for normal use.public boolean getTransactional()
public boolean getTxnNoWait()
public SEnvironmentConfig setTxnNoWait(boolean txnNoWait)
SLockNotGrantedException
without waiting for the lock.
This method only affects the specified SEnvironment
handle (and
any other library handles opened within the scope of that handle). For
consistent behavior across the environment, all SEnvironment handles
opened in the database environment must call this method.
txnNoWait
- if true, configure transactions to not wait for locks
by default.public boolean getTxnSnapshot()
public SEnvironmentConfig setTxnSnapshot(boolean txnSnapshot)
This method only affects the specified SEnvironment
handle (and
any other library handles opened within the scope of that handle). For
consistent behavior across the environment, all SEnvironment handles
opened in the database environment must call this method.
txnSnapshot
- if true, configure the system to default to snapshot
isolation.public boolean getTxnNoSync()
public SEnvironmentConfig setTxnNoSync(boolean txnNoSync)
This means that transactions exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but if the server fails, it is possible some number of the most recently committed transactions may be undone during recovery. The number of transactions at risk is governed by how many log updates can fit into the log buffer, how often the server operating system flushes dirty buffers to disk, and how often the log is checkpointed.
This method only affects the specified SEnvironment
handle (and
any other library handles opened within the scope of that handle). For
consistent behavior across the environment, all SEnvironment handles
opened in the database environment must call this method.
txnNoSync
- if true, configure the system to not write or
synchronously flush the log on transaction commit.public boolean getTxnWriteNoSync()
public SEnvironmentConfig setTxnWriteNoSync(boolean txnWriteNoSync)
This means that transactions exhibit the ACI (atomicity, consistency, and isolation) properties, but not D (durability); that is, database integrity will be maintained, but if the server fails, it is possible some number of the most recently committed transactions may be undone during recovery. The number of transactions at risk is governed by how often the server system flushes dirty buffers to disk and how often the log is checkpointed.
This method only affects the specified SEnvironment
handle (and
any other library handles opened within the scope of that handle). For
consistent behavior across the environment, all SEnvironment handles
opened in the database environment must call this method.
txnWriteNoSync
- if true, configure the system to write, but not
synchronously flush, the log on transaction commit.protected T getThriftObj()
protected java.lang.Object getField(F field) throws java.lang.IllegalStateException
field
- the fieldjava.lang.IllegalStateException
- if the field is not setCopyright (c) 2016, 2019 Oracle and/or its affiliates. All rights reserved.