Move transactor.typed to other packages
This commit is contained in:
parent
f57fc4a0f3
commit
ca64512a07
7 changed files with 15 additions and 17 deletions
|
|
@ -13,7 +13,7 @@ import akka.stm.TransactionFactory
|
|||
* or to Coordination.coordinate.
|
||||
*
|
||||
* @see [[akka.transactor.Coordinated]]
|
||||
* @see [[akka.transactor.typed.Coordination]]
|
||||
* @see [[akka.transactor.Coordination]]
|
||||
*/
|
||||
abstract class Atomically(val factory: TransactionFactory) {
|
||||
def this() = this(Coordinated.DefaultFactory)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
package akka.transactor.typed;
|
||||
package akka.transactor.annotation;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
|
|
@ -9,8 +9,8 @@ import akka.dispatch.{MessageDispatcher, Future, CompletableFuture, Dispatchers}
|
|||
import akka.config.Supervision._
|
||||
import akka.util._
|
||||
import ReflectiveAccess._
|
||||
import akka.transactor.Coordinated
|
||||
import akka.transactor.typed.{Coordination, Coordinated => CoordinatedAnnotation}
|
||||
import akka.transactor.{Coordinated, Coordination}
|
||||
import akka.transactor.annotation.{Coordinated => CoordinatedAnnotation}
|
||||
|
||||
import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint}
|
||||
import org.codehaus.aspectwerkz.proxy.Proxy
|
||||
|
|
|
|||
|
|
@ -2,10 +2,8 @@
|
|||
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
|
||||
*/
|
||||
|
||||
package akka.transactor.typed
|
||||
package akka.transactor
|
||||
|
||||
import akka.transactor.{Coordinated => CoordinatedObject}
|
||||
import akka.transactor.Atomically
|
||||
import akka.stm.Atomic
|
||||
|
||||
import scala.util.DynamicVariable
|
||||
|
|
@ -38,12 +36,12 @@ import scala.util.DynamicVariable
|
|||
* }}}
|
||||
*/
|
||||
object Coordination {
|
||||
private[akka] val coordinated = new DynamicVariable[CoordinatedObject](null)
|
||||
private[akka] val coordinated = new DynamicVariable[Coordinated](null)
|
||||
private[akka] val firstParty = new DynamicVariable[Boolean](false)
|
||||
|
||||
/**
|
||||
* For creating a coordination between typed actors that use
|
||||
* the [[akka.transactor.typed.Coordinated]] annotation.
|
||||
* the [[akka.transactor.annotation.Coordinated]] annotation.
|
||||
* Coordinated transactions will wait for all other transactions in the coordination
|
||||
* before committing. The timeout is specified by the default transaction factory.
|
||||
* It's possible to specify whether or not this `coordinate` block waits for all of
|
||||
|
|
@ -51,7 +49,7 @@ object Coordination {
|
|||
*/
|
||||
def coordinate[U](wait: Boolean = true)(body: => U): Unit = {
|
||||
firstParty.value = !wait
|
||||
coordinated.withValue(CoordinatedObject()) {
|
||||
coordinated.withValue(Coordinated()) {
|
||||
body
|
||||
if (wait) coordinated.value.await
|
||||
}
|
||||
|
|
@ -60,7 +58,7 @@ object Coordination {
|
|||
|
||||
/**
|
||||
* For creating a coordination between typed actors that use
|
||||
* the [[akka.transactor.typed.Coordinated]] annotation.
|
||||
* the [[akka.transactor.annotation.Coordinated]] annotation.
|
||||
* Coordinated transactions will wait for all other transactions in the coordination
|
||||
* before committing. The timeout is specified by the default transaction factory.
|
||||
*/
|
||||
|
|
@ -69,7 +67,7 @@ object Coordination {
|
|||
/**
|
||||
* Java API: coordinate that accepts an [[akka.transactor.Atomically]].
|
||||
* For creating a coordination between typed actors that use
|
||||
* the [[akka.transactor.typed.Coordinated]] annotation.
|
||||
* the [[akka.transactor.annotation.Coordinated]] annotation.
|
||||
* Coordinated transactions will wait for all other transactions in the coordination
|
||||
* before committing. The timeout is specified by the default transaction factory.
|
||||
* Use the `wait` parameter to specify whether or not this `coordinate` block
|
||||
|
|
@ -80,7 +78,7 @@ object Coordination {
|
|||
/**
|
||||
* Java API: coordinate that accepts an [[akka.stm.Atomic]].
|
||||
* For creating a coordination between typed actors that use
|
||||
* the [[akka.transactor.typed.Coordinated]] annotation.
|
||||
* the [[akka.transactor.annotation.Coordinated]] annotation.
|
||||
* Coordinated transactions will wait for all other transactions in the coordination
|
||||
* before committing. The timeout is specified by the default transaction factory.
|
||||
* Use the `wait` parameter to specify whether or not this `coordinate` block
|
||||
|
|
@ -6,7 +6,7 @@ import org.junit.Before;
|
|||
import org.junit.After;
|
||||
|
||||
import akka.actor.TypedActor;
|
||||
import akka.transactor.typed.Coordination;
|
||||
import akka.transactor.Coordination;
|
||||
import akka.transactor.Atomically;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
package akka.transactor.test;
|
||||
|
||||
import akka.transactor.typed.Coordinated;
|
||||
import akka.transactor.annotation.Coordinated;
|
||||
|
||||
public interface TypedCounter {
|
||||
@Coordinated public void increment();
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@ import org.scalatest.matchers.MustMatchers
|
|||
|
||||
import akka.actor.TypedActor
|
||||
import akka.stm.Ref
|
||||
import akka.transactor.typed.Coordinated
|
||||
import akka.transactor.typed.Coordination._
|
||||
import akka.transactor.annotation.Coordinated
|
||||
import akka.transactor.Coordination._
|
||||
|
||||
object TypedCoordinatedIncrement {
|
||||
trait Counter {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue