STransactionConfig (Oracle - Berkeley DB Client-Server API)
Date: 2018-05-29

com.sleepycat.client

## Class STransactionConfig

- java.lang.Object
- - com.sleepycat.client.STransactionConfig

-     public class STransactionConfig
      extends java.lang.Object

  Specifies the attributes of a database environment transaction.

  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 begin a new transaction, system default values are used for unset attributes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `STransactionConfig()` Create an empty STransactionConfig with no attribute set.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `getBulk()` Return true if the Bulk attribute is set.
    `protected java.lang.Object` | `getField(F field)` Return the value set on a specified field.
    `boolean` | `getNoSync()` Return if the transaction is configured to not write or synchronously flush the log when it commits.
    `boolean` | `getNoWait()` Return if the transaction is configured to not wait if a lock request cannot be immediately granted.
    `boolean` | `getReadCommitted()` Return if the transaction is configured for read committed isolation.
    `boolean` | `getReadUncommitted()` Return if read operations performed by the transaction are configured to return modified but not yet committed data.
    `boolean` | `getSnapshot()` Return true if the transaction is configured for Snapshot Isolation.
    `boolean` | `getSync()` Return if the transaction is configured to write and synchronously flush the log when it commits.
    `protected T` | `getThriftObj()`
    `boolean` | `getWait()` Return if the transaction is configured to wait if a lock request cannot be immediately granted.
    `boolean` | `getWriteNoSync()` Return if the transaction is configured to write but not synchronously flush the log when it commits.
    `STransactionConfig` | `setBulk(boolean bulk)` Configures the transaction to enable the transactional bulk insert optimization.
    `STransactionConfig` | `setNoSync(boolean noSync)` Configure the transaction to not write or synchronously flush the log when it commits.
    `STransactionConfig` | `setNoWait(boolean noWait)` Configure the transaction to not wait if a lock request cannot be immediately granted.
    `STransactionConfig` | `setReadCommitted(boolean readCommitted)` Configure the transaction for read committed isolation.
    `STransactionConfig` | `setReadUncommitted(boolean readUncommitted)` Configure read operations performed by the transaction to return modified but not yet committed data.
    `STransactionConfig` | `setSnapshot(boolean snapshot)` This transaction will execute with snapshot isolation.
    `STransactionConfig` | `setSync(boolean sync)` Configure the transaction to write and synchronously flush the log when it commits.
    `STransactionConfig` | `setWait(boolean wait)` Configure the transaction to wait if a lock request cannot be immediately granted.
    `STransactionConfig` | `setWriteNoSync(boolean writeNoSync)` Configure the transaction to write but not synchronously flush the log when it commits.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### STransactionConfig

          public STransactionConfig()

      Create an empty STransactionConfig with no attribute set.

  - ### Method Detail

    - #### getBulk

          public boolean getBulk()

      Return true if the Bulk attribute is set.
      Returns:
        the current setting of the Bulk attribute.

    - #### setBulk

          public STransactionConfig setBulk(boolean bulk)

      Configures the transaction to enable the transactional bulk insert optimization. When this attribute is set, the transaction will avoid logging the contents of insertions on newly allocated database pages. In a transaction that inserts a large number of new records, the I/O savings of choosing this option can be significant. Users of this option should be aware of several issues. When the optimization is in effect, page allocations that extend the database file are logged as usual; this allows transaction aborts to work correctly, both online and during recovery. At commit time, the database's pages are flushed to disk, eliminating the need to roll-forward the transaction during normal recovery.

      The bulk insert optimization is effective only for top-level transactions.

      Parameters:
        `bulk` - if true, configure the transaction to enable the bulk optimization.
      Returns:
        this

    - #### getNoSync

          public boolean getNoSync()

      Return if the transaction is configured to not write or synchronously flush the log when it commits.
      Returns:
        if the transaction is configured to not write or synchronously flush the log when it commits.

    - #### setNoSync

          public STransactionConfig setNoSync(boolean noSync)

      Configure the transaction to not write or synchronously flush the log when it commits.

      This behavior may be set for a database environment using the `SEnvironment.setConfig(SEnvironmentConfig)` method. Any value specified to this method overrides that setting.

      Parameters:
        `noSync` - if true, 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.
      Returns:
        this

    - #### getSync

          public boolean getSync()

      Return if the transaction is configured to write and synchronously flush the log when it commits.
      Returns:
        if the transaction is configured to write and synchronously flush the log when it commits.

    - #### setSync

          public STransactionConfig setSync(boolean sync)

      Configure the transaction to write and synchronously flush the log when it commits.
      Parameters:
        `sync` - if true, transactions exhibit all the ACID (atomicity, consistency, isolation, and durability) properties.
      Returns:
        this

    - #### getWriteNoSync

          public boolean getWriteNoSync()

      Return if the transaction is configured to write but not synchronously flush the log when it commits.

      Returns:
        if the transaction is configured to not write or synchronously flush the log when it commits.

    - #### setWriteNoSync

          public STransactionConfig setWriteNoSync(boolean writeNoSync)

      Configure the transaction to write but not synchronously flush the log when it commits.

      This behavior may be set for a database environment using the `SEnvironment.setConfig(SEnvironmentConfig)` method. Any value specified to this method overrides that setting.

      Parameters:
        `writeNoSync` - if true, 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.
      Returns:
        this

    - #### getNoWait

          public boolean getNoWait()

      Return if the transaction is configured to not wait if a lock request cannot be immediately granted.
      Returns:
        if the transaction is configured to not wait if a lock request cannot be immediately granted.

    - #### setNoWait

          public STransactionConfig setNoWait(boolean noWait)

      Configure the transaction to not wait if a lock request cannot be immediately granted.
      Parameters:
        `noWait` - if true, transactions will not wait if a lock request cannot be immediately granted, instead `SDeadlockException` will be thrown.
      Returns:
        this

    - #### getWait

          public boolean getWait()

      Return if the transaction is configured to wait if a lock request cannot be immediately granted.
      Returns:
        if the transaction is configured to wait if a lock request cannot be immediately granted.

    - #### setWait

          public STransactionConfig setWait(boolean wait)

      Configure the transaction to wait if a lock request cannot be immediately granted.
      Parameters:
        `wait` - if true, transactions will wait if a lock request cannot be immediately granted.
      Returns:
        this

    - #### getReadCommitted

          public boolean getReadCommitted()

      Return if the transaction is configured for read committed isolation.
      Returns:
        if the transaction is configured for read committed isolation.

    - #### setReadCommitted

          public STransactionConfig setReadCommitted(boolean readCommitted)

      Configure the transaction for read committed isolation.

      This ensures the stability of the current data item read by the cursor but permits data read by this transaction to be modified or deleted prior to the commit of the transaction.

      Parameters:
        `readCommitted` - if true, configure the transaction for read committed isolation.
      Returns:
        this

    - #### getReadUncommitted

          public boolean getReadUncommitted()

      Return if read operations performed by the transaction are configured to return modified but not yet committed data.
      Returns:
        if read operations performed by the transaction are configured to return modified but not yet committed data.

    - #### setReadUncommitted

          public STransactionConfig setReadUncommitted(boolean readUncommitted)

      Configure read operations performed by the transaction to return modified but not yet committed data.
      Parameters:
        `readUncommitted` - if true, configure read operations performed by the transaction to return modified but not yet committed data.
      Returns:
        this

    - #### getSnapshot

          public boolean getSnapshot()

      Return true if the transaction is configured for Snapshot Isolation.
      Returns:
        true if the transaction is configured for Snapshot Isolation.

    - #### setSnapshot

          public STransactionConfig setSnapshot(boolean snapshot)

      This transaction will execute with snapshot isolation. For databases configured with `SDatabaseConfig.setMultiversion(boolean)`, data values will be read as they are when the transaction begins, without taking read locks.

      Updates operations performed in the transaction will cause a `SDeadlockException` to be thrown if data is modified between reading and writing it.

      Parameters:
        `snapshot` - if this transaction will execute with snapshot isolation
      Returns:
        this

    - #### getThriftObj

          protected T getThriftObj()

    - #### getField

          protected java.lang.Object getField(F field)
                                       throws java.lang.IllegalStateException

      Return the value set on a specified field. Throw IllegalStateException if the field is not set.
      Parameters:
        `field` - the field
      Returns:
        the field's value
      Throws:
        `java.lang.IllegalStateException` - if the field is not set

Copyright (c) 2016, 2018 Oracle and/or its affiliates. All rights reserved.