Trait/Object

monifu.concurrent.atomic

Atomic

Related Docs: object Atomic | package atomic

Permalink

trait Atomic[T] extends Any

Base trait of all atomic references, no matter the type.

Source
Atomic.scala
Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Atomic
  2. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Abstract Value Members

  1. abstract def :=(value: T): Unit

    Permalink

    Alias for set().

    Alias for set(). Updates the current value.

    value

    will be the new value returned by get()

  2. abstract def compareAndSet(expect: T, update: T): Boolean

    Permalink

    Does a compare-and-set operation on the current value.

    Does a compare-and-set operation on the current value. For more info, checkout the related Compare-and-swap Wikipedia page.

    It's an atomic, worry free operation.

    expect

    is the value you expect to be persisted when the operation happens

    update

    will be the new value, should the check for expect succeeds

    returns

    either true in case the operation succeeded or false otherwise

  3. abstract def get: T

    Permalink

    returns

    the current value persisted by this Atomic

  4. abstract def getAndSet(update: T): T

    Permalink

    Sets the persisted value to update and returns the old value that was in place.

    Sets the persisted value to update and returns the old value that was in place. It's an atomic, worry free operation.

  5. abstract def getAndTransform(cb: (T) ⇒ T): T

    Permalink

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    the old value, just prior to when the successful update happened

  6. abstract def getClass(): Class[_]

    Permalink
    Definition Classes
    Any
  7. abstract def lazySet(update: T): Unit

    Permalink

    Eventually sets to the given value.

    Eventually sets to the given value. Has weaker visibility guarantees than the normal set().

  8. abstract def set(update: T): Unit

    Permalink

    Updates the current value.

    Updates the current value.

    update

    will be the new value returned by get()

  9. abstract def transform(cb: (T) ⇒ T): Unit

    Permalink

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

  10. abstract def transformAndExtract[U](cb: (T) ⇒ (U, T)): U

    Permalink

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by your callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns a tuple that specifies the update + what should this method return when the operation succeeds.

    returns

    whatever was specified by your callback, once the operation succeeds

  11. abstract def transformAndGet(cb: (T) ⇒ T): T

    Permalink

    Abstracts over compareAndSet.

    Abstracts over compareAndSet. You specify a transformation by specifying a callback to be executed, a callback that transforms the current value. This method will loop until it will succeed in replacing the current value with the one produced by the given callback.

    Note that the callback will be executed on each iteration of the loop, so it can be called multiple times - don't do destructive I/O or operations that mutate global state in it.

    cb

    is a callback that receives the current value as input and returns the update which is the new value that should be persisted

    returns

    whatever the update is, after the operation succeeds

  12. abstract def update(value: T): Unit

    Permalink

    Alias for set().

    Alias for set(). Updates the current value.

    value

    will be the new value returned by get()

Concrete Value Members

  1. final def !=(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  2. final def ##(): Int

    Permalink
    Definition Classes
    Any
  3. final def ==(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  4. def apply(): T

    Permalink

    returns

    the current value persisted by this Atomic, an alias for get()

  5. final def asInstanceOf[T0]: T0

    Permalink
    Definition Classes
    Any
  6. def equals(arg0: Any): Boolean

    Permalink
    Definition Classes
    Any
  7. def hashCode(): Int

    Permalink
    Definition Classes
    Any
  8. final def isInstanceOf[T0]: Boolean

    Permalink
    Definition Classes
    Any
  9. def toString(): String

    Permalink
    Definition Classes
    Any

Inherited from Any

Ungrouped