Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 3.2.76
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.sleepycat.je
Class EnvironmentMutableConfig

    java.lang.Object
      com.sleepycat.je.EnvironmentMutableConfig

All Implemented Interfaces:
  Cloneable

Direct Known Subclasses:
  EnvironmentConfig

    public class EnvironmentMutableConfig

extends Object
implements Cloneable

Specifies the environment attributes that may be changed after the environment has been opened. EnvironmentMutableConfig is a parameter to `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

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 = myEnvHandle.getMutableConfig();
>         mutableConfig.setTxnNoSync(true);
>         myEnvHandle.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.

- `setTxnNoSync(boolean)`, `getTxnNoSync()`
- `setTxnWriteNoSync(boolean)`, `getTxnWriteNoSync()`

#### Environment-Wide Mutable Properties

Environment-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 thread for the environment.
>         EnvironmentMutableConfig mutableConfig = myEnvHandle.getMutableConfig();
>         mutableConfig.setConfigParam("je.env.runCleaner", "false");
>         myEnvHandle.setMutableConfig(mutableConfig);

The environment-wide mutable properties are listed below. These properties are accessed using the `setConfigParam(java.lang.String, java.lang.String)` and `getConfigParam(java.lang.String)` methods, as shown in the example above, using the property names listed below. In some cases setter and getter methods are also available.

- je.maxMemory (`setCacheSize(long)`, `getCacheSize()`)
- je.maxMemoryPercent (`setCachePercent(int)`, `getCachePercent()`)
- je.env.runINCompressor
- je.env.runEvictor
- je.env.runCheckpointer
- je.env.runCleaner

See Also:
  `EnvironmentConfig`

Constructor Summary
`EnvironmentMutableConfig()` An instance created using the default constructor is initialized with the system's default settings.

Method Summary
`int` | `getCachePercent()` Return the percentage value used in the JE cache size calculation.
`long` | `getCacheSize()` Return the memory available to the database system, in bytes.
`String` | `getConfigParam(String configParamName)` Return the value for this configuration parameter.
`boolean` | `getTxnNoSync()` Return if the database environment is configured for asynchronous transactions.
`boolean` | `getTxnWriteNoSync()` Return if the database environment is configured for transactions which write but do not flush the log.
`void` | `setCachePercent(int percent)` By default, JE sets its cache size proportionally to the JVM memory.
`void` | `setCacheSize(long cacheSize)` Configure the memory available to the database system, in bytes.
`void` | `setConfigParam(String configParamName, String value)` Validate the value prescribed for the configuration parameter; if it is valid, the value is set in the configuration.
`void` | `setTxnNoSync(boolean txnNoSync)` Configure the database environment for asynchronous transactions.
`void` | `setTxnWriteNoSync(boolean txnWriteNoSync)` Configure the database environment for transactions which write but do not flush the log.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### EnvironmentMutableConfig

    public EnvironmentMutableConfig()

  An instance created using the default constructor is initialized with the system's default settings.

Method Detail

### setTxnNoSync

    public void setTxnNoSync(boolean txnNoSync)

  Configure the database environment for asynchronous transactions.

  Parameters:
    `txnNoSync` - 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.

  Throws:
    `DatabaseException` - if a failure occurs.

### getTxnNoSync

    public boolean getTxnNoSync()

  Return if the database environment is configured for asynchronous transactions.

  Returns:
    If the database environment is configured for asynchronous transactions.

### setTxnWriteNoSync

    public void setTxnWriteNoSync(boolean txnWriteNoSync)

  Configure the database environment for transactions which write but do not flush the log.

  Parameters:
    `txnWriteNoSync` - 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.

  Throws:
    `DatabaseException` - if a failure occurs.

### getTxnWriteNoSync

    public boolean getTxnWriteNoSync()

  Return if the database environment is configured for transactions which write but do not flush the log.

  Returns:
    If the database environment is configured for transactions which write but do not flush the log.

### setCacheSize

    public void setCacheSize(long cacheSize)
                      throws IllegalArgumentException

  Configure the memory available to the database system, in bytes.

  Equivalent to setting the je.maxMemory property in the je.properties file. The system will evict database objects when it comes within a prescribed margin of the limit.

  By default, JE sets the cache size to:

              je.maxMemoryPercent *  JVM maximum memory

  where JVM maximum memory is specified by the JVM -Xmx flag. However, calling setCacheSize() with a non-zero value overrides the percentage based calculation and sets the cache size explicitly.

  Note that the cache does not include transient objects created by the JE library, such as cursors, locks and transactions.

  Note that the log buffer cache may be cleared if the cache size is changed after the environment has been opened.

  Parameters:
    `cacheSize` - The memory available to the database system, in bytes.

  Throws:
    `IllegalArgumentException` - if an invalid parameter was specified.

    `DatabaseException` - if a failure occurs.

### getCacheSize

    public long getCacheSize()

  Return the memory available to the database system, in bytes. A valid value is only available if this EnvironmentConfig object has been returned from Environment.getConfig();

  Returns:
    The memory available to the database system, in bytes.

### setCachePercent

    public void setCachePercent(int percent)
                         throws IllegalArgumentException

  By default, JE sets its cache size proportionally to the JVM memory. This formula is used:

  >             je.maxMemoryPercent *  JVM maximum memory

  where JVM maximum memory is specified by the JVM -Xmx flag. setCachePercent() specifies the percentage used and is equivalent to setting the je.maxMemoryPercent property in the je.properties file.

  Calling setCacheSize() with a non-zero value overrides the percentage based calculation and sets the cache size explicitly.

  Note that the log buffer cache may be cleared if the cache size is changed after the environment has been opened.

  Parameters:
    `percent` - The percent of JVM memory to allocate to the JE cache.

  Throws:
    `IllegalArgumentException` - if an invalid parameter was specified.

    `DatabaseException` - if a failure occurs.

### getCachePercent

    public int getCachePercent()

  Return the percentage value used in the JE cache size calculation.

  Returns:
    the percentage value used in the JE cache size calculation.

### setConfigParam

    public void setConfigParam(String configParamName,
                               String value)
                        throws IllegalArgumentException

  Validate the value prescribed for the configuration parameter; if it is valid, the value is set in the configuration.

  Parameters:
    `configParamName` - The name of the configuration parameter. See the sample je.properties file for descriptions of all parameters.

    `value` - The value for this configuration parameter.

  Throws:
    `IllegalArgumentException` - if an invalid parameter was specified.

    `DatabaseException` - if a failure occurs.

### getConfigParam

    public String getConfigParam(String configParamName)
                          throws IllegalArgumentException

  Return the value for this configuration parameter.

  Parameters:
    `configParamName` - Name of the requested parameter.
  Throws:
    `IllegalArgumentException` - if the configParamName is invalid.

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
| Berkeley DB Java Edition version 3.2.76
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright 1996,2008 Oracle. All rights reserved.