org.apache.ode.bpel.engine

## Class NStateLatch

- java.lang.Object
- - org.apache.ode.bpel.engine.NStateLatch

-     public class NStateLatch
      extends java.lang.Object

  An N state synchronization latch useful for implementing hydration/dehydration. The latch functions as follows. At any time, the latch is in one of N states and has a count. Clients can "latch" and "release" the latch, which increments/decrements the count; however, when latching, a state must be specified. If the state does not match the current state, the latch blocks until the count is zero. Essentially, the latch can change state only when the count is zero. Every time the latch changes state an optional `Runnable` corresponding to the new state is executed.

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected java.lang.Runnable[]` | `_transitions` Action for state transition ?-->i

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NStateLatch(java.lang.Runnable[] transitions)` Constructor, the array of `Runnable`s defines the number of states and the transition actions.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `int` | `getDepth(int state)`
    `void` | `latch(int state)`
    `void` | `release(int state)`

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

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

- - ### Field Detail

    - #### _transitions

          protected java.lang.Runnable[] _transitions

      Action for state transition ?-->i

  - ### Constructor Detail

    - #### NStateLatch

          public NStateLatch(java.lang.Runnable[] transitions)

      Constructor, the array of `Runnable`s defines the number of states and the transition actions.
      Parameters:
        `transitions` - action to perform when entering state x.

  - ### Method Detail

    - #### latch

          public void latch(int state)

    - #### release

          public void release(int state)

    - #### getDepth

          public int getDepth(int state)