Packages

c

com.digitalasset.canton.util

StampedLockWithHandle

class StampedLockWithHandle extends AnyRef

A stamped lock that allows passing around a lock handle to better guard methods that should only be called with an active lock.

For example:

object Foo {
  val lock = new StampedLockWithHandle()

  def bar() = lockWithWriteLockHandle { implicit writeLock =>
    // do something
    baz()
    // do more stuff
  }

  def baz()(implicit writeLockHandle: lock.WriteLockHandle) = {
    // do some more stuff
  }
}

In the above example, baz cannot be called unless a write lock was acquired specifically only with lock.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. StampedLockWithHandle
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

Instance Constructors

  1. new StampedLockWithHandle()

Type Members

  1. class ReadLockHandle extends AnyRef
  2. class WriteLockHandle extends AnyRef

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##: Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @IntrinsicCandidate() @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  9. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @IntrinsicCandidate() @native()
  10. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  11. val lock: StampedLock
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @IntrinsicCandidate() @native()
  15. def readLock(): ReadLockHandle

    Acquire a read lock, blocking if it's currently not possible.

    Acquire a read lock, blocking if it's currently not possible.

    returns

    A read lock handle with which the lock can be unlocked again.

  16. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  17. def toString(): String
    Definition Classes
    AnyRef → Any
  18. def unlockRead(readLockHandle: ReadLockHandle): Unit

    Unlock a previously acquired read lock.

  19. def unlockWrite(writeLockHandle: WriteLockHandle): Unit

    Unlock a previously acquired write lock.

  20. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  21. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  22. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  23. def withReadLock[A](fn: => A): A

    Run a block of code within a read lock.

  24. def withReadLock[A, F[_]](fn: => F[A])(implicit arg0: Thereafter[F]): F[A]

    Run a block of code within a read lock.

  25. def withReadLockHandle[A, F[_]](fn: (ReadLockHandle) => F[A])(implicit arg0: Thereafter[F]): F[A]

    Run a block of code within a read lock, providing the acquired read lock handle.

  26. def withWriteLock[A, F[_]](fn: => F[A])(implicit arg0: Thereafter[F]): F[A]

    Run a block of code within a write lock, providing the acquired write lock handle.

  27. def withWriteLockHandle[A, F[_]](fn: (WriteLockHandle) => F[A])(implicit arg0: Thereafter[F]): F[A]

    Run a block of code within a write lock, providing the acquired write lock handle.

  28. def writeLock(): WriteLockHandle

    Acquire a write lock, blocking if it's currently not possible.

    Acquire a write lock, blocking if it's currently not possible.

    returns

    A write lock handle with which the lock can be unlocked again.

Deprecated Value Members

  1. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable]) @Deprecated
    Deprecated

    (Since version 9)

Inherited from AnyRef

Inherited from Any

Ungrouped