re #281: Made akka-core compile and test after breaking changes introduced by removing the type parameter from ActorRef.!!.
This commit is contained in:
parent
5668337975
commit
2128dcda3b
10 changed files with 24 additions and 32 deletions
|
|
@ -4,6 +4,7 @@
|
|||
|
||||
package se.scalablesolutions.akka.actor
|
||||
|
||||
import Actor._
|
||||
import se.scalablesolutions.akka.config.FaultHandlingStrategy
|
||||
import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol
|
||||
import se.scalablesolutions.akka.remote.{RemoteProtocolBuilder, RemoteClient, RemoteRequestProtocolIdFactory}
|
||||
|
|
@ -11,7 +12,6 @@ import se.scalablesolutions.akka.dispatch.{MessageDispatcher, Future, Completabl
|
|||
import se.scalablesolutions.akka.config.ScalaConfig._
|
||||
import se.scalablesolutions.akka.serialization.Serializer
|
||||
import se.scalablesolutions.akka.util._
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
|
||||
import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint}
|
||||
import org.codehaus.aspectwerkz.proxy.Proxy
|
||||
|
|
@ -549,7 +549,7 @@ private[akka] sealed class ActiveObjectAspect {
|
|||
actorRef ! Invocation(joinPoint, true, true, sender, senderFuture)
|
||||
null.asInstanceOf[AnyRef]
|
||||
} else {
|
||||
val result = narrow[AnyRef](actorRef !! (Invocation(joinPoint, false, isOneWay, sender, senderFuture), timeout))
|
||||
val result = (actorRef !! (Invocation(joinPoint, false, isOneWay, sender, senderFuture), timeout)).as[AnyRef]
|
||||
if (result.isDefined) result.get
|
||||
else throw new IllegalStateException("No result defined for invocation [" + joinPoint + "]")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,7 +10,6 @@ import java.util.concurrent.{ConcurrentLinkedQueue, LinkedBlockingQueue}
|
|||
import se.scalablesolutions.akka.actor.{Actor, ActorRef}
|
||||
import se.scalablesolutions.akka.actor.Actor._
|
||||
import se.scalablesolutions.akka.dispatch.CompletableFuture
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
|
||||
/**
|
||||
* Implements Oz-style dataflow (single assignment) variables.
|
||||
|
|
@ -103,7 +102,7 @@ import se.scalablesolutions.akka.dispatch.CompletableFuture
|
|||
else {
|
||||
val out = actorOf(new Out(this)).start
|
||||
blockedReaders.offer(out)
|
||||
val result = narrow[T](out !! Get)
|
||||
val result = (out !! Get).as[T]
|
||||
out ! Exit
|
||||
if (result.isDefined) result.get
|
||||
else throw new DataFlowVariableException("Timed out (after " + TIME_OUT + " milliseconds) while waiting for result")
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ import java.util.concurrent.{ConcurrentHashMap, Executors}
|
|||
import java.util.{Map => JMap}
|
||||
|
||||
import se.scalablesolutions.akka.actor._
|
||||
import se.scalablesolutions.akka.actor.Actor._
|
||||
import se.scalablesolutions.akka.util._
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._
|
||||
import se.scalablesolutions.akka.config.Config.config
|
||||
|
||||
|
|
@ -370,7 +370,7 @@ class RemoteServerHandler(
|
|||
if (request.getIsOneWay) actorRef.!(message)(sender)
|
||||
else {
|
||||
try {
|
||||
val resultOrNone = narrow[AnyRef](actorRef.!!(message)(sender))
|
||||
val resultOrNone = (actorRef.!!(message)(sender)).as[AnyRef]
|
||||
val result = if (resultOrNone.isDefined) resultOrNone.get else null
|
||||
log.debug("Returning result from actor invocation [%s]", result)
|
||||
val replyBuilder = RemoteReplyProtocol.newBuilder
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import se.scalablesolutions.akka.config.ScalaConfig._
|
|||
import se.scalablesolutions.akka.actor.Actor
|
||||
import se.scalablesolutions.akka.actor.Actor._
|
||||
import se.scalablesolutions.akka.util.Logging
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
|
||||
import org.scalatest.Suite
|
||||
import org.junit.runner.RunWith
|
||||
|
|
@ -40,9 +39,9 @@ class ActorPatternsTest extends junit.framework.TestCase with Suite with MustMat
|
|||
}.start
|
||||
|
||||
val result = for {
|
||||
a <- narrow[Int](d !! (testMsg1,5000))
|
||||
b <- narrow[Int](d !! (testMsg2,5000))
|
||||
c <- narrow[Int](d !! (testMsg3,5000))
|
||||
a <- (d !! (testMsg1,5000)).as[Int]
|
||||
b <- (d !! (testMsg2,5000)).as[Int]
|
||||
c <- (d !! (testMsg3,5000)).as[Int]
|
||||
} yield a + b + c
|
||||
|
||||
result.get must be(21)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,6 @@ import java.util.concurrent.{CountDownLatch, TimeUnit}
|
|||
import org.scalatest.junit.JUnitSuite
|
||||
import org.junit.Test
|
||||
import se.scalablesolutions.akka.dispatch.Dispatchers
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import Actor._
|
||||
|
||||
object ExecutorBasedEventDrivenDispatcherActorSpec {
|
||||
|
|
@ -42,7 +41,7 @@ class ExecutorBasedEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = actorOf[TestActor].start
|
||||
val result = narrow[String](actor !! ("Hello", 10000))
|
||||
val result = (actor !! ("Hello", 10000)).as[String]
|
||||
assert("World" === result.get)
|
||||
actor.stop
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.scalatest.junit.JUnitSuite
|
|||
import org.junit.Test
|
||||
|
||||
import se.scalablesolutions.akka.stm.{Ref, TransactionalMap, TransactionalVector}
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import Actor._
|
||||
|
||||
object InMemoryActorSpec {
|
||||
|
|
@ -117,7 +116,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
stateful.start
|
||||
stateful ! SetMapStateOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init") // set init state
|
||||
stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert("new state" === (stateful !! GetMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess")).get)
|
||||
}
|
||||
|
|
@ -139,7 +138,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
failer.start
|
||||
stateful ! SetMapStateOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init") // set init state
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert("init" === (stateful !! GetMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure")).get) // check that state is == init state
|
||||
}
|
||||
|
|
@ -164,7 +163,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
stateful.start
|
||||
stateful ! SetVectorStateOneWay("init") // set init state
|
||||
stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert(2 === (stateful !! GetVectorSize).get)
|
||||
}
|
||||
|
|
@ -187,7 +186,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert(1 === (stateful !! GetVectorSize).get)
|
||||
}
|
||||
|
|
@ -212,7 +211,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
stateful.start
|
||||
stateful ! SetRefStateOneWay("init") // set init state
|
||||
stateful ! SuccessOneWay("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state") // transactionrequired
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert("new state" === (stateful !! GetRefState).get)
|
||||
}
|
||||
|
|
@ -235,7 +234,7 @@ class InMemoryActorSpec extends JUnitSuite {
|
|||
val failer = actorOf[InMemFailerActor]
|
||||
failer.start
|
||||
stateful ! FailureOneWay("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer) // call failing transactionrequired method
|
||||
val notifier = narrow[CountDownLatch](stateful !! GetNotifier)
|
||||
val notifier = (stateful !! GetNotifier).as[CountDownLatch]
|
||||
assert(notifier.get.await(1, TimeUnit.SECONDS))
|
||||
assert("init" === (stateful !! (GetRefState, 1000000)).get) // check that state is == init state
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,7 +6,6 @@ import org.junit.Test
|
|||
import Actor._
|
||||
|
||||
import se.scalablesolutions.akka.dispatch.Dispatchers
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
|
||||
object ReactorBasedSingleThreadEventDrivenDispatcherActorSpec {
|
||||
class TestActor extends Actor {
|
||||
|
|
@ -45,7 +44,7 @@ class ReactorBasedSingleThreadEventDrivenDispatcherActorSpec extends JUnitSuite
|
|||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = actorOf[TestActor].start
|
||||
val result = narrow[String](actor !! ("Hello", 10000)).get
|
||||
val result = (actor !! ("Hello", 10000)).as[String].get
|
||||
assert("World" === result)
|
||||
actor.stop
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.scalatest.junit.JUnitSuite
|
|||
import org.junit.Test
|
||||
|
||||
import se.scalablesolutions.akka.dispatch.Dispatchers
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import Actor._
|
||||
|
||||
object ReactorBasedThreadPoolEventDrivenDispatcherActorSpec {
|
||||
|
|
@ -40,7 +39,7 @@ class ReactorBasedThreadPoolEventDrivenDispatcherActorSpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = actorOf[TestActor].start
|
||||
val result = narrow[String](actor !! ("Hello", 10000)).get
|
||||
val result = (actor !! ("Hello", 10000)).as[String].get
|
||||
assert("World" === result)
|
||||
actor.stop
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,6 @@
|
|||
package se.scalablesolutions.akka.stm
|
||||
|
||||
import se.scalablesolutions.akka.actor.{Actor, Transactor}
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import Actor._
|
||||
|
||||
import org.scalatest.Spec
|
||||
|
|
@ -89,10 +88,10 @@ class StmSpec extends
|
|||
try {
|
||||
val actor = actorOf[GlobalTransactionVectorTestActor].start
|
||||
actor !! Add(5)
|
||||
val size1: Int = narrow(actor !! Size).getOrElse(fail("Could not get Vector::size"))
|
||||
val size1 = (actor !! Size).as[Int].getOrElse(fail("Could not get Vector::size"))
|
||||
size1 should equal(2)
|
||||
actor !! Add(2)
|
||||
val size2 = narrow[Int](actor !! Size).getOrElse(fail("Could not get Vector::size"))
|
||||
val size2 = (actor !! Size).as[Int].getOrElse(fail("Could not get Vector::size"))
|
||||
size2 should equal(3)
|
||||
} catch {
|
||||
case e =>
|
||||
|
|
@ -108,18 +107,18 @@ class StmSpec extends
|
|||
try {
|
||||
val actor = actorOf[NestedTransactorLevelOneActor].start
|
||||
actor !! Add(2)
|
||||
val size1: Int = narrow(actor !! Size).getOrElse(fail("Could not get size"))
|
||||
val size1 = (actor !! Size).as[Int].getOrElse(fail("Could not get size"))
|
||||
size1 should equal(2)
|
||||
actor !! Add(7)
|
||||
actor ! "HiLevelOne"
|
||||
val size2: Int = narrow(actor !! Size).getOrElse(fail("Could not get size"))
|
||||
val size2 = (actor !! Size).as[Int].getOrElse(fail("Could not get size"))
|
||||
size2 should equal(7)
|
||||
actor !! Add(0)
|
||||
actor ! "HiLevelTwo"
|
||||
val size3: Int = narrow(actor !! Size).getOrElse(fail("Could not get size"))
|
||||
val size3 = (actor !! Size).as[Int].getOrElse(fail("Could not get size"))
|
||||
size3 should equal(0)
|
||||
actor !! Add(3)
|
||||
val size4: Int = narrow(actor !! Size).getOrElse(fail("Could not get size"))
|
||||
val size4 = (actor !! Size).as[Int].getOrElse(fail("Could not get size"))
|
||||
size4 should equal(3)
|
||||
} catch {
|
||||
case e =>
|
||||
|
|
|
|||
|
|
@ -5,7 +5,6 @@ import org.scalatest.junit.JUnitSuite
|
|||
import org.junit.Test
|
||||
|
||||
import se.scalablesolutions.akka.dispatch.Dispatchers
|
||||
import se.scalablesolutions.akka.util.Helpers.narrow
|
||||
import Actor._
|
||||
|
||||
object ThreadBasedActorSpec {
|
||||
|
|
@ -41,7 +40,7 @@ class ThreadBasedActorSpec extends JUnitSuite {
|
|||
|
||||
@Test def shouldSendReplySync = {
|
||||
val actor = actorOf[TestActor].start
|
||||
val result = narrow[String](actor !! ("Hello", 10000))
|
||||
val result = (actor !! ("Hello", 10000)).as[String]
|
||||
assert("World" === result.get)
|
||||
actor.stop
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue