LockMode (Oracle - Berkeley DB Java API)
Date: 2017-04-13

com.sleepycat.db

## Class LockMode

- java.lang.Object
- - com.sleepycat.db.LockMode

-     public final class LockMode
      extends java.lang.Object

  Locking modes for database operations. Locking modes are required parameters for operations that retrieve data or modify the database.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static LockMode` | `DEFAULT` Acquire read locks for read operations and write locks for write operations.
    `static LockMode` | `DEGREE_2` Deprecated. This has been replaced by `READ_COMMITTED` to conform to ANSI database isolation terminology.
    `static LockMode` | `DIRTY_READ` Deprecated. This has been replaced by `READ_UNCOMMITTED` to conform to ANSI database isolation terminology.
    `static LockMode` | `IGNORE_LEASES` Return the data item irrespective of the state of master leases.
    `static LockMode` | `READ_COMMITTED` Read committed isolation provides for cursor stability but not repeatable reads.
    `static LockMode` | `READ_UNCOMMITTED` Read modified but not yet committed data.
    `static LockMode` | `RMW` Acquire write locks instead of read locks when doing the retrieval.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `java.lang.String` | `toString()`

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

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

- - ### Field Detail

    - #### DEFAULT

          public static final LockMode DEFAULT

      Acquire read locks for read operations and write locks for write operations.

    - #### READ_UNCOMMITTED

          public static final LockMode READ_UNCOMMITTED

      Read modified but not yet committed data.

    - #### READ_COMMITTED

          public static final LockMode READ_COMMITTED

      Read committed isolation provides for cursor stability but not repeatable reads. Data items which have been previously read by this transaction may be deleted or modified by other transactions before the cursor is closed or the transaction completes.

      Note that this LockMode may only be passed to `Database` get methods, not to `Cursor` methods. To configure a cursor for Read committed isolation, use `CursorConfig.setReadCommitted(boolean)`.

    - #### RMW

          public static final LockMode RMW

      Acquire write locks instead of read locks when doing the retrieval. Setting this flag can eliminate deadlock during a read-modify-write cycle by acquiring the write lock during the read part of the cycle so that another thread of control acquiring a read lock for the same item, in its own read-modify-write cycle, will not result in deadlock.

    - #### DIRTY_READ

          public static final LockMode DIRTY_READ

      Deprecated. This has been replaced by `READ_UNCOMMITTED` to conform to ANSI database isolation terminology.
      Read modified but not yet committed data.

    - #### DEGREE_2

          public static final LockMode DEGREE_2

      Deprecated. This has been replaced by `READ_COMMITTED` to conform to ANSI database isolation terminology.
      Read committed isolation provides for cursor stability but not repeatable reads. Data items which have been previously read by this transaction may be deleted or modified by other transactions before the cursor is closed or the transaction completes.

      Note that this LockMode may only be passed to `Database` get methods, not to `Cursor` methods. To configure a cursor for Read committed isolation, use `CursorConfig.setReadCommitted(boolean)`.

    - #### IGNORE_LEASES

          public static final LockMode IGNORE_LEASES

      Return the data item irrespective of the state of master leases. The item will be returned under all conditions: if master leases are not configured, if the request is made to a client, if the request is made to a master with a valid lease, or if the request is made to a master without a valid lease.

  - ### Method Detail

    - #### toString

          public java.lang.String toString()

      Overrides:
        `toString` in class `java.lang.Object`

Copyright (c) 1996, 2017 Oracle and/or its affiliates. All rights reserved.