org.apache.ode.utils

## Class ProcessMutex

- java.lang.Object
- - org.apache.ode.utils.ProcessMutex

-     public class ProcessMutex
      extends java.lang.Object

  An inter-process synchronization mechanism. This class uses a well known TCP port to synchronize multiple processes. The method of operation is simple: by opening a port, a process prevents other processes on the local machine from opening the same port.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `ProcessMutex(int port)` Constructor.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `lock()` Acquire the lock.
    `void` | `unlock()` Release the lock

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

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

- - ### Constructor Detail

    - #### ProcessMutex

          public ProcessMutex(int port)

      Constructor.
      Parameters:
        `port` - synchronization TCP port

  - ### Method Detail

    - #### lock

          public void lock()
                    throws java.lang.InterruptedException

      Acquire the lock. Will throw InterruptedException after timeout (15 seconds).
      Throws:
        `java.lang.InterruptedException` - in case of timeout
        `java.lang.IllegalStateException` - in case lock is already acquired

    - #### unlock

          public void unlock()

      Release the lock
      Throws:
        `java.lang.IllegalStateException` - DOCUMENTME