akka.transactor

Coordinated

Related Docs: object Coordinated | package transactor

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.

Annotations
@deprecated
Deprecated

(Since version 2.3) akka.transactor will be removed

Source
Coordinated.scala
See also

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

Linear Supertypes
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 StringFormat
  3. by Ensuring
  4. by ArrowAssoc
  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: Any): Boolean

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

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

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

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

    Definition Classes
    AnyRef → Any
  6. 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.

  7. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  8. 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.

  9. 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.

  10. 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.

  11. 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.

  12. def cancel(info: Any): Unit

    Cancel this Coordinated transaction.

  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. 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.

  15. 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 Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  16. def ensuring(cond: (Coordinated) ⇒ Boolean): Coordinated

    Implicit information
    This member is added by an implicit conversion from Coordinated to Ensuring[Coordinated] performed by method Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  17. 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 Ensuring in scala.Predef.
    Definition Classes
    Ensuring
  18. def ensuring(cond: Boolean): Coordinated

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

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

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

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

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

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

    Java API: get the message for this Coordinated.

  25. def hashCode(): Int

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

    Definition Classes
    Any
  27. val message: Any

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

    Definition Classes
    AnyRef
  29. 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.

  30. final def notify(): Unit

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

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

    Definition Classes
    AnyRef
  33. def toString(): String

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

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

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

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

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

Inherited from AnyRef

Inherited from Any

Inherited by implicit conversion any2stringadd from Coordinated to any2stringadd[Coordinated]

Inherited by implicit conversion StringFormat from Coordinated to StringFormat[Coordinated]

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

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

Ungrouped