org.apache.xmlbeans.impl.common

## Class Mutex

- java.lang.Object
- - org.apache.xmlbeans.impl.common.Mutex

-     public class Mutex
      extends Object

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Mutex()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `acquire()` Acquire the mutex.
    `void` | `release()` Release the mutex.
    `boolean` | `tryToAcquire()` Attempts to acquire the mutex.

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

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

- - ### Constructor Detail

    - #### Mutex

          public Mutex()

  - ### Method Detail

    - #### acquire

          public void acquire()
                       throws InterruptedException

      Acquire the mutex. The mutex can be acquired multiple times by the same thread, provided that it is released as many times as it is acquired. The calling thread blocks until it has acquired the mutex. (There is no timeout).
      Throws:
        `InterruptedException`

    - #### tryToAcquire

          public boolean tryToAcquire()

      Attempts to acquire the mutex. Returns false (and does not block) if it can't get it.

    - #### release

          public void release()

      Release the mutex. The mutex has to be released as many times as it was acquired to actually unlock the resource. The mutex must be released by the thread that acquired it
      Throws:
        `IllegalStateException` - (a RuntimeException) if a thread other than the current owner tries to release the mutex.