akka.transactor

Coordinated

class Coordinated extends AnyRef

Coordinated is a message wrapper that adds a CountDownCommitBarrier for explicitly coordinating transactions across actors or threads.

Creating a Coordinated will create a count down barrier with initially one member. For each member in the coordination set a transaction is expected to be created using the coordinated atomic method. The number of included parties must match the number of transactions, otherwise a successful transaction cannot be coordinated.

To start a new coordinated transaction set that you will also participate in just create a Coordinated object:

val coordinated = Coordinated()


To start a coordinated transaction that you won't participate in yourself you can create a Coordinated object with a message and send it directly to an actor. The recipient of the message will be the first member of the coordination set:

actor ! Coordinated(Message)


To receive a coordinated message in an actor simply match it in a case statement:

def receive = {
  case coordinated @ Coordinated(Message) => ...
}


To include another actor in the same coordinated transaction set that you've created or received, use the apply method on that object. This will increment the number of parties involved by one and create a new Coordinated object to be sent.

actor ! coordinated(Message)


To enter the coordinated transaction use the atomic method of the coordinated object:

coordinated atomic {
  // do something in transaction ...
}

The coordinated transaction will wait for the other transactions before committing. If any of the coordinated transactions fail then they all fail.

See also

akka.actor.Transactor for an actor that implements coordinated transactions

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Hide All
  2. Show all
  1. Coordinated
  2. AnyRef
  3. Any
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Coordinated ()

  2. new Coordinated (message: Any)

  3. new Coordinated (message: Any, barrier: CountDownCommitBarrier)

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 apply (msg: Any): Coordinated

    Create a new Coordinated object and increment the number of parties by one.

    Create a new Coordinated object and increment the number of parties by one. Use this method to pass on the coordination.

  7. def asInstanceOf [T0] : T0

    Attributes
    final
    Definition Classes
    Any
  8. def atomic (atomically: Atomically): Unit

    Java API: coordinated atomic method that accepts an Atomically.

    Java API: coordinated atomic method that accepts an Atomically. Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified by the transaction factory.

  9. def atomic [T] (jatomic: Atomic[T]): T

    Java API: coordinated atomic method that accepts an Atomic.

    Java API: coordinated atomic method that accepts an Atomic. Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified by the transaction factory.

  10. def atomic [T] (factory: TransactionFactory)(body: ⇒ T): T

    Delimits the coordinated transaction.

    Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified by the transaction factory.

  11. def atomic [T] (body: ⇒ T)(implicit factory: TransactionFactory = Coordinated.DefaultFactory): T

    Delimits the coordinated transaction.

    Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified by the transaction factory.

  12. def await (): Unit

    An empty coordinated atomic block.

    An empty coordinated atomic block. Can be used to complete the number of parties involved and wait for all transactions to complete. The default timeout is used.

  13. def clone (): AnyRef

    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws()
  14. def coordinate (msg: Any): Coordinated

    Java API: create a new Coordinated object and increment the number of parties by one.

    Java API: create a new Coordinated object and increment the number of parties by one. Use this method to pass on the coordination.

  15. def eq (arg0: AnyRef): Boolean

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef → Any
  19. def getMessage (): Any

    Java API: get the message for this Coordinated.

  20. def hashCode (): Int

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

    Attributes
    final
    Definition Classes
    Any
  22. val message : Any

  23. def ne (arg0: AnyRef): Boolean

    Attributes
    final
    Definition Classes
    AnyRef
  24. def noIncrement (msg: Any): Coordinated

    Create a new Coordinated object but *do not* increment the number of parties by one.

    Create a new Coordinated object but *do not* increment the number of parties by one. Only use this method if you know this is what you need.

  25. def notify (): Unit

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

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

    Attributes
    final
    Definition Classes
    AnyRef
  28. def toString (): String

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

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

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

    Attributes
    final
    Definition Classes
    AnyRef
    Annotations
    @throws()

Inherited from AnyRef

Inherited from Any