public class EnvironmentMutableConfig extends Object implements Cloneable, Serializable
Environment.setMutableConfig(com.sleepycat.je.EnvironmentMutableConfig) and is returned by Environment.getMutableConfig().
There are two types of mutable environment properties: per-environment handle properties, and environment wide properties.
Per-environment handle properties apply only to a single Environment instance. For example, to change the default transaction commit behavior for a single environment handle, do this:
// Specify no-sync behavior for a given handle.
EnvironmentMutableConfig mutableConfig = env.getMutableConfig();
mutableConfig.setDurability(Durability.COMMIT_NO_SYNC);
env.setMutableConfig(mutableConfig);
The per-environment handle properties are listed below. These properties are accessed using the setter and getter methods listed, as shown in the example above.
setDurability(com.sleepycat.je.Durability), getDurability()setTxnNoSync(boolean), getTxnNoSync() deprecatedsetTxnWriteNoSync(boolean), getTxnWriteNoSync() deprecatedEnvironment-wide mutable properties are those that can be changed for an environment as a whole, irrespective of which environment instance (for the same physical environment) is used. For example, to stop the cleaner daemon thread, do this:
// Stop the cleaner daemon threads for the environment.
EnvironmentMutableConfig mutableConfig = env.getMutableConfig();
mutableConfig.setConfigParam(EnvironmentConfig.ENV_RUN_CLEANER, "false");
env.setMutableConfig(mutableConfig);
The environment-wide mutable properties are documented as such for each EnvironmentConfig String constant.
Environment.getConfig() or
Environment.getMutableConfig(). The original EnvironmentConfig or
EnvironmentMutableConfig object used to set the properties is not kept up to
date as properties are changed, and does not reflect property validation or
properties that are computed.EnvironmentConfig,
Serialized Form| Constructor and Description |
|---|
EnvironmentMutableConfig()
An instance created using the default constructor is initialized with
the system's default settings.
|
| Modifier and Type | Method and Description |
|---|---|
protected EnvironmentMutableConfig |
clone() |
CacheMode |
getCacheMode()
Returns the default
CacheMode used for operations performed in
this environment, or null if CacheMode.DEFAULT is used. |
int |
getCachePercent()
A convenience method for getting
EnvironmentConfig.MAX_MEMORY_PERCENT. |
long |
getCacheSize()
Returns the memory available to the database system, in bytes.
|
String |
getConfigParam(String paramName)
Returns the value for this configuration parameter.
|
Durability |
getDurability()
Convenience method for setting
EnvironmentConfig.TXN_DURABILITY. |
ExceptionListener |
getExceptionListener()
Returns the exception listener, if set.
|
long |
getMaxDisk()
A convenience method for getting
EnvironmentConfig.MAX_DISK. |
int |
getNumExplicitlySetParams()
Testing support
|
long |
getOffHeapCacheSize()
A convenience method for getting
EnvironmentConfig.MAX_OFF_HEAP_MEMORY. |
boolean |
getTxnNoSync()
Deprecated.
replaced by
getDurability() |
boolean |
getTxnWriteNoSync()
Deprecated.
replaced by
getDurability() |
boolean |
isConfigParamSet(String paramName) |
EnvironmentMutableConfig |
setCacheMode(CacheMode cacheMode)
Sets the default
CacheMode used for operations performed in this
environment. |
void |
setCacheModeVoid(CacheMode cacheMode) |
EnvironmentMutableConfig |
setCachePercent(int percent)
A convenience method for setting
EnvironmentConfig.MAX_MEMORY_PERCENT. |
void |
setCachePercentVoid(int percent) |
EnvironmentMutableConfig |
setCacheSize(long totalBytes)
A convenience method for setting
EnvironmentConfig.MAX_MEMORY. |
void |
setCacheSizeVoid(long totalBytes) |
EnvironmentMutableConfig |
setConfigParam(String paramName,
String value)
Set this configuration parameter.
|
EnvironmentMutableConfig |
setDurability(Durability durability)
Convenience method for setting
EnvironmentConfig.TXN_DURABILITY. |
void |
setDurabilityVoid(Durability durability) |
EnvironmentMutableConfig |
setExceptionListener(ExceptionListener exceptionListener)
Sets the exception listener for an Environment.
|
void |
setExceptionListenerVoid(ExceptionListener exceptionListener) |
EnvironmentMutableConfig |
setMaxDisk(long totalBytes)
A convenience method for setting
EnvironmentConfig.MAX_DISK. |
void |
setMaxDiskVoid(long totalBytes) |
EnvironmentMutableConfig |
setOffHeapCacheSize(long totalBytes)
A convenience method for setting
EnvironmentConfig.MAX_OFF_HEAP_MEMORY. |
void |
setOffHeapCacheSizeVoid(long totalBytes) |
EnvironmentMutableConfig |
setTxnNoSync(boolean noSync)
Deprecated.
replaced by
setDurability(com.sleepycat.je.Durability) |
void |
setTxnNoSyncVoid(boolean noSync) |
EnvironmentMutableConfig |
setTxnWriteNoSync(boolean writeNoSync)
Deprecated.
replaced by
setDurability(com.sleepycat.je.Durability) |
void |
setTxnWriteNoSyncVoid(boolean writeNoSync) |
String |
toString()
Display configuration values.
|
public EnvironmentMutableConfig()
public EnvironmentMutableConfig setTxnNoSync(boolean noSync)
setDurability(com.sleepycat.je.Durability)noSync - If true, do not write or synchronously flush the log on
transaction commit. This means that transactions exhibit the ACI
(Atomicity, Consistency, and Isolation) properties, but not D
(Durability); that is, database integrity is maintained, but if the JVM
or operating system 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 updates fit into
a log buffer, how often the operating system flushes dirty buffers to
disk, and how often the database environment is checkpointed.
This attribute is false by default for this class and for the database environment.
public void setTxnNoSyncVoid(boolean noSync)
public boolean getTxnNoSync()
getDurability()public EnvironmentMutableConfig setTxnWriteNoSync(boolean writeNoSync)
setDurability(com.sleepycat.je.Durability)writeNoSync - If true, write but do not synchronously flush the log
on transaction commit. This means that transactions exhibit the ACI
(Atomicity, Consistency, and Isolation) properties, but not D
(Durability); that is, database integrity is maintained, but if the
operating system 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 operating system
flushes dirty buffers to disk, and how often the database environment is
checkpointed.
The motivation for this attribute is to provide a transaction that has more durability than asynchronous (nosync) transactions, but has higher performance than synchronous transactions.
This attribute is false by default for this class and for the database environment.
public void setTxnWriteNoSyncVoid(boolean writeNoSync)
public boolean getTxnWriteNoSync()
getDurability()public EnvironmentMutableConfig setDurability(Durability durability)
EnvironmentConfig.TXN_DURABILITY.durability - the new durability definitionDurabilitypublic void setDurabilityVoid(Durability durability)
public Durability getDurability()
EnvironmentConfig.TXN_DURABILITY.public EnvironmentMutableConfig setCacheSize(long totalBytes) throws IllegalArgumentException
EnvironmentConfig.MAX_MEMORY.totalBytes - The memory available to the database system, in bytes.IllegalArgumentException - if an invalid parameter is specified.EnvironmentConfig.MAX_MEMORYpublic void setCacheSizeVoid(long totalBytes)
throws IllegalArgumentException
IllegalArgumentExceptionpublic long getCacheSize()
public EnvironmentMutableConfig setCachePercent(int percent) throws IllegalArgumentException
EnvironmentConfig.MAX_MEMORY_PERCENT.percent - The percent of JVM memory to allocate to the JE cache.IllegalArgumentException - if an invalid parameter is specified.EnvironmentConfig.MAX_MEMORY_PERCENTpublic void setCachePercentVoid(int percent)
throws IllegalArgumentException
IllegalArgumentExceptionpublic int getCachePercent()
EnvironmentConfig.MAX_MEMORY_PERCENT.public EnvironmentMutableConfig setOffHeapCacheSize(long totalBytes) throws IllegalArgumentException
EnvironmentConfig.MAX_OFF_HEAP_MEMORY.IllegalArgumentExceptionpublic void setOffHeapCacheSizeVoid(long totalBytes)
throws IllegalArgumentException
IllegalArgumentExceptionpublic long getOffHeapCacheSize()
EnvironmentConfig.MAX_OFF_HEAP_MEMORY.public EnvironmentMutableConfig setMaxDisk(long totalBytes) throws IllegalArgumentException
EnvironmentConfig.MAX_DISK.totalBytes - is an upper limit on the number of bytes used for
data storage, or zero if no limit is desired.IllegalArgumentException - if an invalid parameter is specified.EnvironmentConfig.MAX_DISKpublic void setMaxDiskVoid(long totalBytes)
throws IllegalArgumentException
IllegalArgumentExceptionpublic long getMaxDisk()
EnvironmentConfig.MAX_DISK.EnvironmentConfig.MAX_DISKpublic EnvironmentMutableConfig setExceptionListener(ExceptionListener exceptionListener)
Not all daemon exceptions are fatal, and the application bears responsibility for choosing how to respond to the notification. Since exceptions may repeat, the application should also choose how to handle a spate of exceptions. For example, the application may choose to act upon each notification, or it may choose to batch up its responses by implementing the listener so it stores exceptions, and only acts when a certain number have been received.
exceptionListener - the callback to be executed when an exception
occurs.public void setExceptionListenerVoid(ExceptionListener exceptionListener)
public ExceptionListener getExceptionListener()
public EnvironmentMutableConfig setCacheMode(CacheMode cacheMode)
CacheMode used for operations performed in this
environment. The default cache mode may be overridden on a per-database
basis using DatabaseConfig.setCacheMode(com.sleepycat.je.CacheMode), and on a per-record or
per-operation basis using Cursor.setCacheMode(com.sleepycat.je.CacheMode), ReadOptions.setCacheMode(CacheMode) or WriteOptions.setCacheMode(CacheMode).cacheMode - is the default CacheMode used for operations
performed in this environment. If null is specified, CacheMode.DEFAULT will be used.for further details.public void setCacheModeVoid(CacheMode cacheMode)
public CacheMode getCacheMode()
CacheMode used for operations performed in
this environment, or null if CacheMode.DEFAULT is used.CacheMode used for operations performed on
this database, or null if CacheMode.DEFAULT is used.setCacheMode(com.sleepycat.je.CacheMode)public EnvironmentMutableConfig setConfigParam(String paramName, String value) throws IllegalArgumentException
paramName - the configuration parameter name, one of the String
constants in this classvalue - The configuration valueIllegalArgumentException - if the paramName or value is invalid.public String getConfigParam(String paramName) throws IllegalArgumentException
paramName - a valid configuration parameter, one of the String
constants in this class.IllegalArgumentException - if the paramName is invalid.public boolean isConfigParamSet(String paramName)
protected EnvironmentMutableConfig clone()
public int getNumExplicitlySetParams()
Copyright © 2024. All rights reserved.