akka.stm

Ref

class Ref [T] extends BasicRef[T] with Transactional

Refs (transactional references) are mutable references to values and through the STM allow the safe sharing of mutable data. Refs separate identity from value. To ensure safety the value stored in a Ref should be immutable (they can also contain refs themselves). The value referenced by a Ref can only be accessed or swapped within a transaction. If a transaction is not available, the call will be executed in its own transaction.

Creating a Ref (Scala)

import akka.stm._

// giving an initial value
val ref = Ref(0)

// specifying a type but no initial value
val ref = Ref[Int]


Creating a Ref (Java)

import akka.stm.*;

// giving an initial value
final Ref<Integer> ref = new Ref<Integer>(0);

// specifying a type but no initial value
final Ref<Integer> ref = new Ref<Integer>();
Self Type
Ref[T]
Linear Supertypes
Transactional, Serializable, Serializable, BasicRef[T], Ref[T], AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Ref
  2. Transactional
  3. Serializable
  4. Serializable
  5. BasicRef
  6. Ref
  7. AnyRef
  8. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Ref ()

  2. new Ref (initialValue: T)

Type Members

  1. class WithFilter extends AnyRef

Value Members

  1. def != (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  2. def != (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  3. def ## (): Int

    Attributes
    final
    Definition Classes
    AnyRef → Any
  4. def == (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  5. def == (arg0: Any): Boolean

    Attributes
    final
    Definition Classes
    Any
  6. def ___getListeners (): Listeners

    Attributes
    final
    Definition Classes
    BasicRef
  7. def ___getLockOwner (): Transaction

    Attributes
    final
    Definition Classes
    BasicRef
  8. def ___load (arg0: Long): AlphaTranlocal

    Attributes
    final
    Definition Classes
    BasicRef
  9. def ___load (): AlphaTranlocal

    Attributes
    final
    Definition Classes
    BasicRef
  10. def ___openForCommutingOperation (): AlphaTranlocal

    Definition Classes
    BasicRef
  11. def ___registerRetryListener (arg0: Latch, arg1: Long): RegisterRetryListenerResult

    Attributes
    final
    Definition Classes
    BasicRef
  12. def ___releaseLock (arg0: Transaction): Unit

    Definition Classes
    BasicRef
  13. def ___storeInitial (arg0: AlphaTranlocal, arg1: Long): Unit

    Definition Classes
    BasicRef
  14. def ___storeUpdate (arg0: AlphaTranlocal, arg1: Long, arg2: Boolean): Listeners

    Definition Classes
    BasicRef
  15. def ___tryLock (arg0: Transaction): Boolean

    Definition Classes
    BasicRef
  16. def alter (f: (T) ⇒ T): T

  17. def apply (): T

  18. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  19. def clear (): T

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  20. def clear___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  21. def clear___ro (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  22. def clear___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  23. def clear___up (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  24. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  25. def elements : Iterator[T]

  26. def eq (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  27. def equals (arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  28. def filter (p: (T) ⇒ Boolean): Ref[T]

  29. def finalize (): Unit

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  30. def flatMap [B] (f: (T) ⇒ Ref[B]): Ref[B]

  31. def foreach [U] (f: (T) ⇒ U): Unit

  32. def get (): T

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  33. def getClass (): java.lang.Class[_]

    Attributes
    final
    Definition Classes
    AnyRef → Any
  34. def getOrAwait (): T

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  35. def getOrAwaitInterruptibly (): T

    Attributes
    final
    Definition Classes
    BasicRef → Ref
    Annotations
    @throws()
  36. def getOrAwaitInterruptibly___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
    Annotations
    @throws()
  37. def getOrAwaitInterruptibly___ro (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
    Annotations
    @throws()
  38. def getOrAwaitInterruptibly___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
    Annotations
    @throws()
  39. def getOrAwaitInterruptibly___up (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
    Annotations
    @throws()
  40. def getOrAwait___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  41. def getOrAwait___ro (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  42. def getOrAwait___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  43. def getOrAwait___up (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  44. def getOrElse (default: ⇒ T): T

  45. def getOrWait : T

  46. def get___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  47. def get___ro (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  48. def get___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  49. def get___up (arg0: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  50. def hashCode (): Int

    Definition Classes
    AnyRef → Any
  51. def isDefined : Boolean

  52. def isEmpty : Boolean

  53. def isInstanceOf [T0] : Boolean

    Attributes
    final
    Definition Classes
    Any
  54. def isNull (): Boolean

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  55. def isNull___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): Boolean

    Attributes
    final
    Definition Classes
    BasicRef
  56. def isNull___ro (arg0: AlphaTransaction): Boolean

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  57. def isNull___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): Boolean

    Attributes
    final
    Definition Classes
    BasicRef
  58. def isNull___up (arg0: AlphaTransaction): Boolean

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  59. def map [B] (f: (T) ⇒ B): Ref[B]

  60. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  61. def notify (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  62. def notifyAll (): Unit

    Attributes
    final
    Definition Classes
    AnyRef
  63. def opt : Option[T]

  64. def set (arg0: T): T

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  65. def set___ro (arg0: Any, arg1: AlphaTransaction, arg2: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  66. def set___ro (arg0: Any, arg1: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  67. def set___up (arg0: Any, arg1: AlphaTransaction, arg2: BasicRef__Tranlocal): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef
  68. def set___up (arg0: Any, arg1: AlphaTransaction): AnyRef

    Attributes
    final
    Definition Classes
    BasicRef → Ref
  69. def swap (newValue: T): T

  70. def synchronized [T0] (arg0: ⇒ T0): T0

    Attributes
    final
    Definition Classes
    AnyRef
  71. def toLeft [X] (right: ⇒ X): Product with Serializable with Either[T, X]

  72. def toList : List[T]

  73. def toRight [X] (left: ⇒ X): Product with Serializable with Either[X, T]

  74. def toString (): String

    Attributes
    final
    Definition Classes
    BasicRef → AnyRef → Any
  75. def toString___ro (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): String

    Attributes
    final
    Definition Classes
    BasicRef
  76. def toString___ro (arg0: AlphaTransaction): String

    Attributes
    final
    Definition Classes
    BasicRef
  77. def toString___up (arg0: AlphaTransaction, arg1: BasicRef__Tranlocal): String

    Attributes
    final
    Definition Classes
    BasicRef
  78. def toString___up (arg0: AlphaTransaction): String

    Attributes
    final
    Definition Classes
    BasicRef
  79. def update (newValue: T): T

  80. val uuid : String

    Definition Classes
    RefTransactional
  81. def wait (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()
  84. def withFilter (p: (T) ⇒ Boolean): WithFilter

    Necessary to keep from being implicitly converted to Iterable in for comprehensions.

Inherited from Transactional

Inherited from Serializable

Inherited from Serializable

Inherited from BasicRef[T]

Inherited from Ref[T]

Inherited from AnyRef

Inherited from Any