From ca64512a07dc74f241ac8763b566cdb58efe29be Mon Sep 17 00:00:00 2001 From: Peter Vlugter Date: Sun, 14 Nov 2010 09:42:29 +1300 Subject: [PATCH] Move transactor.typed to other packages --- .../src/main/scala/transactor/Atomically.scala | 2 +- .../{typed => annotation}/Coordinated.java | 2 +- .../src/main/scala/actor/TypedActor.scala | 4 ++-- .../transactor/{typed => }/Coordination.scala | 16 +++++++--------- .../test/TypedCoordinatedIncrementTest.java | 2 +- .../java/akka/transactor/test/TypedCounter.java | 2 +- .../TypedCoordinatedIncrementSpec.scala | 4 ++-- 7 files changed, 15 insertions(+), 17 deletions(-) rename akka-typed-actor/src/main/java/akka/transactor/{typed => annotation}/Coordinated.java (78%) rename akka-typed-actor/src/main/scala/transactor/{typed => }/Coordination.scala (87%) diff --git a/akka-stm/src/main/scala/transactor/Atomically.scala b/akka-stm/src/main/scala/transactor/Atomically.scala index ea8162e380..e20c85d4b4 100644 --- a/akka-stm/src/main/scala/transactor/Atomically.scala +++ b/akka-stm/src/main/scala/transactor/Atomically.scala @@ -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) diff --git a/akka-typed-actor/src/main/java/akka/transactor/typed/Coordinated.java b/akka-typed-actor/src/main/java/akka/transactor/annotation/Coordinated.java similarity index 78% rename from akka-typed-actor/src/main/java/akka/transactor/typed/Coordinated.java rename to akka-typed-actor/src/main/java/akka/transactor/annotation/Coordinated.java index d64fb443b2..326f45ae71 100644 --- a/akka-typed-actor/src/main/java/akka/transactor/typed/Coordinated.java +++ b/akka-typed-actor/src/main/java/akka/transactor/annotation/Coordinated.java @@ -1,4 +1,4 @@ -package akka.transactor.typed; +package akka.transactor.annotation; import java.lang.annotation.*; diff --git a/akka-typed-actor/src/main/scala/actor/TypedActor.scala b/akka-typed-actor/src/main/scala/actor/TypedActor.scala index c3a10141d8..1a39eab01d 100644 --- a/akka-typed-actor/src/main/scala/actor/TypedActor.scala +++ b/akka-typed-actor/src/main/scala/actor/TypedActor.scala @@ -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 diff --git a/akka-typed-actor/src/main/scala/transactor/typed/Coordination.scala b/akka-typed-actor/src/main/scala/transactor/Coordination.scala similarity index 87% rename from akka-typed-actor/src/main/scala/transactor/typed/Coordination.scala rename to akka-typed-actor/src/main/scala/transactor/Coordination.scala index ceda4e640c..7bdf440fb5 100644 --- a/akka-typed-actor/src/main/scala/transactor/typed/Coordination.scala +++ b/akka-typed-actor/src/main/scala/transactor/Coordination.scala @@ -2,10 +2,8 @@ * Copyright (C) 2009-2010 Scalable Solutions AB */ -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 diff --git a/akka-typed-actor/src/test/java/akka/transactor/test/TypedCoordinatedIncrementTest.java b/akka-typed-actor/src/test/java/akka/transactor/test/TypedCoordinatedIncrementTest.java index e39031d54c..4a838b2aa4 100644 --- a/akka-typed-actor/src/test/java/akka/transactor/test/TypedCoordinatedIncrementTest.java +++ b/akka-typed-actor/src/test/java/akka/transactor/test/TypedCoordinatedIncrementTest.java @@ -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; diff --git a/akka-typed-actor/src/test/java/akka/transactor/test/TypedCounter.java b/akka-typed-actor/src/test/java/akka/transactor/test/TypedCounter.java index f9fd4c0bb6..b1de7020f0 100644 --- a/akka-typed-actor/src/test/java/akka/transactor/test/TypedCounter.java +++ b/akka-typed-actor/src/test/java/akka/transactor/test/TypedCounter.java @@ -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(); diff --git a/akka-typed-actor/src/test/scala/transactor/TypedCoordinatedIncrementSpec.scala b/akka-typed-actor/src/test/scala/transactor/TypedCoordinatedIncrementSpec.scala index d5a9bb3769..77d9d0ef59 100644 --- a/akka-typed-actor/src/test/scala/transactor/TypedCoordinatedIncrementSpec.scala +++ b/akka-typed-actor/src/test/scala/transactor/TypedCoordinatedIncrementSpec.scala @@ -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 {