akka.transactor

Coordinated

class Coordinated extends AnyRef

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

Creating a Coordinated will create a commit barrier with initially one member. For each member in the coordination set a transaction is expected to be created using the coordinated atomic method, or the coordination cancelled using the cancel method.

The number of included members 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 { implicit txn =>
// 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.transactor.Transactor for an actor that implements coordinated transactions

Linear Supertypes
AnyRef, Any
Type Hierarchy Learn more about scaladoc diagrams
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. Coordinated
  2. AnyRef
  3. Any
Implicitly
  1. by any2stringadd
  2. by any2stringfmt
  3. by any2ArrowAssoc
  4. by any2Ensuring
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Instance Constructors

  1. new Coordinated(timeout: Timeout)

  2. new Coordinated(message: Any, timeout: Timeout)

  3. new Coordinated(message: Any, member: Member)

Value Members

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

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

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

    Definition Classes
    AnyRef → Any
  4. def +(other: String): String

    Implicit information
    This member is added by an implicit conversion from Coordinated to StringAdd performed by method any2stringadd in scala.Predef.
    Definition Classes
    StringAdd
  5. def ->[B](y: B): (Coordinated, B)

    Implicit information
    This member is added by an implicit conversion from Coordinated to ArrowAssoc[Coordinated] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc
    Annotations
    @inline()
  6. final def ==(arg0: AnyRef): Boolean

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

    Definition Classes
    Any
  8. def apply(msg: Any): Coordinated

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

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

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def atomic[A](callable: Callable[A]): A

    Java API: coordinated atomic method that accepts a java.util.concurrent.Callable.

    Java API: coordinated atomic method that accepts a java.util.concurrent.Callable. Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified when creating the Coordinated.

    Exceptions thrown
    CoordinatedTransactionException

    if the coordinated transaction fails.

  11. def atomic(runnable: Runnable): Unit

    Java API: coordinated atomic method that accepts a java.lang.Runnable.

    Java API: coordinated atomic method that accepts a java.lang.Runnable. Delimits the coordinated transaction. The transaction will wait for all other transactions in this coordination before committing. The timeout is specified when creating the Coordinated.

    Exceptions thrown
    CoordinatedTransactionException

    if the coordinated transaction fails.

  12. def atomic[A](body: (InTxn) ⇒ A): A

    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 when creating the Coordinated.

    Exceptions thrown
    CoordinatedTransactionException

    if the coordinated transaction fails.

  13. def await(): Unit

    An empty coordinated atomic block.

    An empty coordinated atomic block. Can be used to complete the number of members involved and wait for all transactions to complete.

  14. def cancel(info: Any): Unit

    Cancel this Coordinated transaction.

  15. def clone(): AnyRef

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

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

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

  17. def ensuring(cond: (Coordinated) ⇒ Boolean, msg: ⇒ Any): Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: (Coordinated) ⇒ Boolean): Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  19. def ensuring(cond: Boolean, msg: ⇒ Any): Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  20. def ensuring(cond: Boolean): Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method any2Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  21. final def eq(arg0: AnyRef): Boolean

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

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

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  24. def formatted(fmtstr: String): String

    Implicit information
    This member is added by an implicit conversion from Coordinated to StringFormat performed by method any2stringfmt in scala.Predef.
    Definition Classes
    StringFormat
    Annotations
    @inline()
  25. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  26. def getMessage(): Any

    Java API: get the message for this Coordinated.

  27. def hashCode(): Int

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

    Definition Classes
    Any
  29. val message: Any

  30. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  31. def noIncrement(msg: Any): Coordinated

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

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

  32. final def notify(): Unit

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

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

    Definition Classes
    AnyRef
  35. def toString(): String

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  39. def [B](y: B): (Coordinated, B)

    Implicit information
    This member is added by an implicit conversion from Coordinated to ArrowAssoc[Coordinated] performed by method any2ArrowAssoc in scala.Predef.
    Definition Classes
    ArrowAssoc

Shadowed Implicit Value Members

  1. val self: Any

    Implicit information
    This member is added by an implicit conversion from Coordinated to StringAdd performed by method any2stringadd in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (coordinated: StringAdd).self
    Definition Classes
    StringAdd
  2. val self: Any

    Implicit information
    This member is added by an implicit conversion from Coordinated to StringFormat performed by method any2stringfmt in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (coordinated: StringFormat).self
    Definition Classes
    StringFormat

Deprecated Value Members

  1. def x: Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to ArrowAssoc[Coordinated] performed by method any2ArrowAssoc in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (coordinated: ArrowAssoc[Coordinated]).x
    Definition Classes
    ArrowAssoc
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use leftOfArrow instead

  2. def x: Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method any2Ensuring in scala.Predef.
    Shadowing
    This implicitly inherited member is ambiguous. One or more implicitly inherited members have similar signatures, so calling this member may produce an ambiguous implicit conversion compiler error.
    To access this member you can use a type ascription:
    (coordinated: Ensuring[Coordinated]).x
    Definition Classes
    Ensuring
    Annotations
    @deprecated
    Deprecated

    (Since version 2.10.0) Use resultOfEnsuring instead

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Coordinated to StringAdd

Inherited by implicit conversion any2stringfmt from Coordinated to StringFormat

Inherited by implicit conversion any2ArrowAssoc from Coordinated to ArrowAssoc[Coordinated]

Inherited by implicit conversion any2Ensuring from Coordinated to Ensuring[Coordinated]

Ungrouped