org.apache.tapestry5.ioc.internal.util

## Class LockSupport

- java.lang.Object
- - org.apache.tapestry5.ioc.internal.util.LockSupport

- Direct Known Subclasses:
    AbstractResource, AlertStorage, ApplicationMessageCatalogObjectProvider, AssetSourceImpl, CachingObjectCreator, InternalComponentResourcesImpl, NamedSet, OneShotLock, TypeCoercerImpl

      public abstract class LockSupport
      extends Object

  Base class for classes that need to manage a ReadWriteLock.

- - ### Constructor Summary

    Constructors
    Modifier | Constructor and Description
    --- | ---
    `protected` | `LockSupport()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `acquireReadLock()` Locks the shared read lock.
    `protected void` | `downgradeWriteLockToReadLock()` Takes the read lock then releases the write lock.
    `protected void` | `releaseReadLock()` Releases the shared read lock.
    `protected void` | `releaseWriteLock()` Releases the exclusive read lock.
    `protected void` | `takeWriteLock()` Takes the exclusive write lock.
    `protected void` | `upgradeReadLockToWriteLock()` Releases the read lock, then takes the write lock.

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

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

- - ### Constructor Detail

    - #### LockSupport

          protected LockSupport()

  - ### Method Detail

    - #### acquireReadLock

          protected final void acquireReadLock()

      Locks the shared read lock. Any number of threads may lock the read lock at the same time.

    - #### takeWriteLock

          protected final void takeWriteLock()

      Takes the exclusive write lock. Once started, no other thread lock the read or write lock. When this method returns, this thread will have locked the write lock and no other thread will have either the read or write lock. Note that this thread must first drop the read lock (if it has it) before attempting to take the write lock, or this method will block forever.

    - #### releaseReadLock

          protected final void releaseReadLock()

      Releases the shared read lock.

    - #### releaseWriteLock

          protected final void releaseWriteLock()

      Releases the exclusive read lock.

    - #### upgradeReadLockToWriteLock

          protected final void upgradeReadLockToWriteLock()

      Releases the read lock, then takes the write lock. There's a short window where the thread will have neither lock: during that window, some other thread may have a chance to take the write lock. In code, you'll often see a second check inside the code that has the write lock to see if the update to perform is still necessary.

    - #### downgradeWriteLockToReadLock

          protected final void downgradeWriteLockToReadLock()

      Takes the read lock then releases the write lock.

5.6.0 - Copyright © 2003-2020 The Apache Software Foundation.