scala.concurrent.stm.Source

View

trait View[+A] extends TxnDebuggable

Source.View[+A] consists of the covariant read-only operations of Ref.View[A].

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. View
  2. TxnDebuggable
  3. AnyRef
  4. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def await(f: (A) ⇒ Boolean): Unit

    Blocks until f(get) is true, in a manner consistent with the current context.

    Blocks until f(get) is true, in a manner consistent with the current context. Requires that the predicate be safe to reevaluate, and that f(x) == f(y) if x == y.

    v.await(f) is equivalent to

    atomic { implicit t =>
    if (!f(v.get)) retry
    }

    If you want to wait for a predicate that involves more than one Ref then use retry directly.

    f

    a predicate that is safe to evaluate multiple times.

  2. abstract def get: A

    Performs an atomic read; equivalent to apply().

    Performs an atomic read; equivalent to apply().

    returns

    the value of the Ref as observed by the current context.

  3. abstract def getWith[Z](f: (A) ⇒ Z): Z

    Acts like ref.getWith(f) if there is an active transaction, otherwise just returns f(get).

    Acts like ref.getWith(f) if there is an active transaction, otherwise just returns f(get).

    f

    an idempotent function.

    returns

    the result of applying f to the value contained in ref.

  4. abstract def ref: Source[A]

    Returns a Source that accesses the same memory location as this view.

    Returns a Source that accesses the same memory location as this view. The returned Source might be the original reference that was used to construct this view, or it might be a Source that is equivalent (and ==) to the original.

    returns

    a Source that accesses the same memory location as this view.

  5. abstract def relaxedGet(equiv: (A, A) ⇒ Boolean): A

    Acts like ref.relaxedGet(equiv) if there is an active transaction, otherwise just returns get.

    Acts like ref.relaxedGet(equiv) if there is an active transaction, otherwise just returns get.

    equiv

    an equivalence function that returns true if a transaction that observed the first argument will still complete correctly, where the second argument is the actual value that should have been observed.

    returns

    a value of the Ref, not necessary consistent with the rest of the reads performed by the active transaction, if any.

  6. abstract def tryAwait(timeout: Long, unit: TimeUnit = TimeUnit.MILLISECONDS)(f: (A) ⇒ Boolean): Boolean

    Blocks until f(get) is true and returns true, or returns false if the condition does not become true within within the specified timeout.

    Blocks until f(get) is true and returns true, or returns false if the condition does not become true within within the specified timeout.

    v.tryAwait(timeout)(f) is equivalent to

    atomic { implicit t =>
    f(v.get) || { retryFor(timeout) ; false }
    }
    timeout

    the maximum amount of time to wait, in units of unit.

    unit

    the units in which the timeout is measured, defaulting to milliseconds.

    f

    a predicate that is safe to evaluate multiple times.

    returns

    true if the predicate was satisfied, false if the wait timed out.

Concrete 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. def apply(): A

    Performs an atomic read of the value in ref.

    Performs an atomic read of the value in ref. If an atomic block is active (see Txn.findCurrent) then the read will be performed as part of the transaction, otherwise it will act as if it was performed inside a new atomic block. Equivalent to get.

    returns

    the value of the Ref as observed by the current context.

  5. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  6. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  7. def dbgStr: String

    Returns a string representation of the transactional value in this instance for debugging convenience.

    Returns a string representation of the transactional value in this instance for debugging convenience. The Ref reads (and writes) performed while constructing the result will be discarded before returning. This method works fine outside a transaction.

    If this method is called from within a transaction that is already doomed (status Txn.Rolledback), a string describing the reason for the outer transaction's rollback will be returned.

    Definition Classes
    ViewTxnDebuggable
  8. def dbgValue: Any

    Returns some value that is suitable for examination in a debugger, or returns a Txn.RollbackCause if called from inside a doomed atomic block.

    Returns some value that is suitable for examination in a debugger, or returns a Txn.RollbackCause if called from inside a doomed atomic block.

    Definition Classes
    ViewTxnDebuggable
  9. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  10. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  11. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  12. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  13. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  14. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  15. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  16. final def notify(): Unit

    Definition Classes
    AnyRef
  17. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  18. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  19. def toString(): String

    Definition Classes
    AnyRef → Any
  20. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  21. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  22. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from TxnDebuggable

Inherited from AnyRef

Inherited from Any

Ungrouped