com.tibco.ftl

## Interface TibLock

-     public interface TibLock

  Cooperating application programs can use locks to implement exclusive access to a map within a persistence store.

  To create a lock object, see `Realm.createLock`.

  If a client process exits or disconnects from the persistence server, the library automatically releases all the locks that the process holds.

  This file defines the calls that manipulate locks. In addition, map objects and map iterator objects have methods that operate while holding a lock.

  Since:
    4.2

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `PROPERTY_DOUBLE_LOCK_ACQUIRE_RETRY_DURATION` Retry duration for lock requests.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `destroy()` Destroy a local lock object and reclaim its resources.
    `boolean` | `request()` No operation.
    `void` | `returnLock()` Release a lock.
    `void` | `steal()` Forcibly acquire a lock, even if another process holds it.

- - ### Field Detail

    - #### PROPERTY_DOUBLE_LOCK_ACQUIRE_RETRY_DURATION

          static final java.lang.String PROPERTY_DOUBLE_LOCK_ACQUIRE_RETRY_DURATION

      Retry duration for lock requests. double

      Supply this property to `Realm.createLock`.

      This determines the number of seconds the client will attempt to acquire the lock. The client may retry if it can't access the persistence server, or wait if another client owns the lock. If the client does not already own the lock, the client attempts to acquire it when any map operation requiring a lock is called.

      This value must be positive or zero. A value of 0 (zero) specifies no wait duration.

      See Also:
        Constant Field Values

  - ### Method Detail

    - #### request

          boolean request()
                   throws FTLException

      No operation.

      In releases earlier than 5.0, this call requested a lock from its persistence store.

      In Release 5.0 and later, this call is no longer necessary; it returns `true` without any other effect.

      Calls that require a lock automatically request it; see:

      - `TibMap.set(String, Message, TibLock)`
      - `TibMap.get(String, TibLock)`
      - `TibMap.remove(String, TibLock)`
      - `TibMap.createIterator(TibLock, TibProperties)`

      Programs that correctly used earlier versions of lock calls continue to operate properly.

      Returns:
        This call returns the boolean value `true`.
      Throws:
        `FTLException`
      Since:
        4.2

    - #### steal

          void steal()
              throws FTLException

      Forcibly acquire a lock, even if another process holds it.
      Throws:
        `FTLException`
      Since:
        4.2

    - #### returnLock

          void returnLock()
                   throws FTLException

      Release a lock.

      If the process does not hold the lock, this call has no effect.

      Throws:
        `FTLException`
      Since:
        4.2

    - #### destroy

          void destroy()
                throws FTLException

      Destroy a local lock object and reclaim its resources.

      If the process holds the lock, this call returns the lock before destroying the object.

      Throws:
        `FTLException`
      Since:
        4.2