From 8ede1f55e988c50e71f57c689efe40d75d774f33 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 29 Jun 2012 16:40:36 +0200 Subject: [PATCH] Moving to s.c.EC and s.c.A, compiles but tests aren't passing --- akka-agent/src/main/scala/akka/agent/Agent.scala | 1 + .../src/main/scala/akka/cluster/Cluster.scala | 3 ++- .../code/docs/actor/TypedActorDocTestBase.java | 1 + .../code/docs/actor/UntypedActorDocTestBase.java | 8 ++++---- .../java/code/docs/future/FutureDocTestBase.java | 15 ++++++++------- .../scala/code/docs/actor/TypedActorDocSpec.scala | 3 ++- .../scala/code/docs/future/FutureDocSpec.scala | 3 ++- .../scala/akka/remote/testconductor/Player.scala | 3 ++- .../scala/akka/remote/testkit/MultiNodeSpec.scala | 3 +-- .../akka/remote/RemoteCommunicationSpec.scala | 3 ++- .../akka/remote/Ticket1978CommunicationSpec.scala | 3 ++- .../main/scala/akka/zeromq/ZeroMQExtension.scala | 2 +- 12 files changed, 28 insertions(+), 20 deletions(-) diff --git a/akka-agent/src/main/scala/akka/agent/Agent.scala b/akka-agent/src/main/scala/akka/agent/Agent.scala index ea3d8719cd..30c146dda8 100644 --- a/akka-agent/src/main/scala/akka/agent/Agent.scala +++ b/akka-agent/src/main/scala/akka/agent/Agent.scala @@ -10,6 +10,7 @@ import akka.dispatch._ import akka.pattern.ask import akka.util.Timeout import scala.concurrent.stm._ +import scala.concurrent.Await /** * Used internally to send functions. diff --git a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala index 3e7ace6c0f..2d66120f41 100644 --- a/akka-cluster/src/main/scala/akka/cluster/Cluster.scala +++ b/akka-cluster/src/main/scala/akka/cluster/Cluster.scala @@ -9,13 +9,14 @@ import language.implicitConversions import akka.actor._ import akka.actor.Status._ import akka.ConfigurationException -import akka.dispatch.{ Await, MonitorableThreadFactory } +import akka.dispatch.MonitorableThreadFactory import akka.event.Logging import scala.concurrent.forkjoin.ThreadLocalRandom import akka.pattern._ import akka.remote._ import akka.routing._ import akka.util._ +import scala.concurrent.Await import scala.concurrent.util.duration._ import scala.concurrent.util.{ Duration, Deadline } import akka.util.internal.HashedWheelTimer diff --git a/akka-docs/java/code/docs/actor/TypedActorDocTestBase.java b/akka-docs/java/code/docs/actor/TypedActorDocTestBase.java index 58ace7f6c6..4136063b19 100644 --- a/akka-docs/java/code/docs/actor/TypedActorDocTestBase.java +++ b/akka-docs/java/code/docs/actor/TypedActorDocTestBase.java @@ -9,6 +9,7 @@ import akka.actor.TypedActor; import akka.dispatch.*; import akka.actor.*; import akka.japi.*; +import scala.concurrent.Await; import scala.concurrent.util.Duration; import java.util.concurrent.TimeUnit; diff --git a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java b/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java index ea225b46e8..9b91336800 100644 --- a/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java +++ b/akka-docs/java/code/docs/actor/UntypedActorDocTestBase.java @@ -202,14 +202,14 @@ public class UntypedActorDocTestBase { ActorSystem system = ActorSystem.create("MySystem"); ActorRef actorRef = system.actorOf(new Props(MyUntypedActor.class)); //#gracefulStop - - try { + //FIXME URGENT Await.result should have a @throws clause + //try { Future stopped = gracefulStop(actorRef, Duration.create(5, TimeUnit.SECONDS), system); Await.result(stopped, Duration.create(6, TimeUnit.SECONDS)); // the actor has been stopped - } catch (AskTimeoutException e) { + //} catch (AskTimeoutException e) { // the actor wasn't stopped within 5 seconds - } + //} //#gracefulStop system.shutdown(); } diff --git a/akka-docs/java/code/docs/future/FutureDocTestBase.java b/akka-docs/java/code/docs/future/FutureDocTestBase.java index b0d4d32050..6012cc715e 100644 --- a/akka-docs/java/code/docs/future/FutureDocTestBase.java +++ b/akka-docs/java/code/docs/future/FutureDocTestBase.java @@ -5,6 +5,7 @@ package docs.future; //#imports1 import akka.dispatch.*; +import scala.concurrent.Await; import akka.util.Timeout; //#imports1 @@ -40,8 +41,8 @@ import static akka.dispatch.Futures.reduce; //#imports6 //#imports7 -import scala.concurrent.ExecutionContexts; -import scala.concurrent.ExecutionContextExecutorService; +import scala.concurrent.ExecutionContext; +import scala.concurrent.ExecutionContext$; //#imports7 @@ -79,17 +80,17 @@ public class FutureDocTestBase { system.shutdown(); } - @Test public void useCustomExecutionContext() throws Exception { + @SuppressWarnings("unchecked") @Test public void useCustomExecutionContext() throws Exception { ExecutorService yourExecutorServiceGoesHere = Executors.newSingleThreadExecutor(); //#diy-execution-context - ExecutionContextExecutorService ec = - ExecutionContexts.fromExecutorService(yourExecutorServiceGoesHere); + ExecutionContext ec = + ExecutionContext$.MODULE$.fromExecutorService(yourExecutorServiceGoesHere, (scala.Function1)(ExecutionContext$.MODULE$.fromExecutorService$default$2())); //Use ec with your Futures Future f1 = Futures.successful("foo", ec); - // Then you shut the ec down somewhere at the end of your program/application. - ec.shutdown(); + // Then you shut the ExecutorService down somewhere at the end of your program/application. + yourExecutorServiceGoesHere.shutdown(); //#diy-execution-context } diff --git a/akka-docs/scala/code/docs/actor/TypedActorDocSpec.scala b/akka-docs/scala/code/docs/actor/TypedActorDocSpec.scala index 90d54c954f..1e58f9531e 100644 --- a/akka-docs/scala/code/docs/actor/TypedActorDocSpec.scala +++ b/akka-docs/scala/code/docs/actor/TypedActorDocSpec.scala @@ -6,7 +6,8 @@ package docs.actor import language.postfixOps //#imports -import akka.dispatch.{ Promise, Future, Await } +import akka.dispatch.{ Promise, Future } +import scala.concurrent.Await import scala.concurrent.util.duration._ import akka.actor.{ ActorContext, TypedActor, TypedProps } diff --git a/akka-docs/scala/code/docs/future/FutureDocSpec.scala b/akka-docs/scala/code/docs/future/FutureDocSpec.scala index a6c43d3da4..6f13a7a1f1 100644 --- a/akka-docs/scala/code/docs/future/FutureDocSpec.scala +++ b/akka-docs/scala/code/docs/future/FutureDocSpec.scala @@ -14,7 +14,8 @@ import akka.actor.Status.Failure import akka.util.Timeout import scala.concurrent.util.duration._ import java.lang.IllegalStateException -import akka.dispatch.{ ExecutionContext, Future, Await, Promise } +import akka.dispatch.{ Future, Promise } +import scala.concurrent.{ Await, ExecutionContext } object FutureDocSpec { diff --git a/akka-remote-tests/src/main/scala/akka/remote/testconductor/Player.scala b/akka-remote-tests/src/main/scala/akka/remote/testconductor/Player.scala index eecc0e882a..f50df526f1 100644 --- a/akka-remote-tests/src/main/scala/akka/remote/testconductor/Player.scala +++ b/akka-remote-tests/src/main/scala/akka/remote/testconductor/Player.scala @@ -8,6 +8,7 @@ import language.postfixOps import akka.actor.{ Actor, ActorRef, ActorSystem, LoggingFSM, Props, PoisonPill, Status, Address, Scheduler } import RemoteConnection.getAddrString import scala.concurrent.util.{ Duration, Deadline } +import scala.concurrent.Await import scala.concurrent.util.duration._ import akka.util.Timeout import org.jboss.netty.channel.{ Channel, SimpleChannelUpstreamHandler, ChannelHandlerContext, ChannelStateEvent, MessageEvent, WriteCompletionEvent, ExceptionEvent } @@ -15,7 +16,7 @@ import com.typesafe.config.ConfigFactory import java.util.concurrent.TimeUnit.MILLISECONDS import java.util.concurrent.TimeoutException import akka.pattern.{ ask, pipe, AskTimeoutException } -import akka.dispatch.{ Await, Future } +import akka.dispatch.Future import scala.util.control.NoStackTrace import akka.event.{ LoggingAdapter, Logging } import java.net.{ InetSocketAddress, ConnectException } diff --git a/akka-remote-tests/src/test/scala/akka/remote/testkit/MultiNodeSpec.scala b/akka-remote-tests/src/test/scala/akka/remote/testkit/MultiNodeSpec.scala index 61dd57478b..511fd117c4 100644 --- a/akka-remote-tests/src/test/scala/akka/remote/testkit/MultiNodeSpec.scala +++ b/akka-remote-tests/src/test/scala/akka/remote/testkit/MultiNodeSpec.scala @@ -8,8 +8,7 @@ import language.implicitConversions import java.net.InetSocketAddress import com.typesafe.config.{ ConfigObject, ConfigFactory, Config } import akka.actor.{ RootActorPath, ActorPath, ActorSystem, ExtendedActorSystem } -import scala.concurrent.Await -import scala.concurrent.Await.Awaitable +import scala.concurrent.{ Await, Awaitable } import akka.util.{ Timeout, NonFatal } import akka.remote.testconductor.{ TestConductorExt, TestConductor, RoleName } import akka.testkit.AkkaSpec diff --git a/akka-remote/src/test/scala/akka/remote/RemoteCommunicationSpec.scala b/akka-remote/src/test/scala/akka/remote/RemoteCommunicationSpec.scala index 7f92e3089b..24d3084c88 100644 --- a/akka-remote/src/test/scala/akka/remote/RemoteCommunicationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/RemoteCommunicationSpec.scala @@ -6,7 +6,8 @@ package akka.remote import akka.testkit._ import akka.actor._ import com.typesafe.config._ -import akka.dispatch.{ Await, Future } +import akka.dispatch.Future +import scala.concurrent.Await import akka.pattern.ask object RemoteCommunicationSpec { diff --git a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala index e44c4fbc8d..5abf12d6cf 100644 --- a/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala +++ b/akka-remote/src/test/scala/akka/remote/Ticket1978CommunicationSpec.scala @@ -8,13 +8,14 @@ import language.postfixOps import akka.testkit._ import akka.actor._ import com.typesafe.config._ -import akka.dispatch.{ Await, Future } +import akka.dispatch.Future import akka.pattern.ask import java.io.File import java.security.{ NoSuchAlgorithmException, SecureRandom, PrivilegedAction, AccessController } import akka.remote.netty.{ NettySettings, NettySSLSupport } import javax.net.ssl.SSLException import akka.util.Timeout +import scala.concurrent.Await import scala.concurrent.util.duration._ import scala.concurrent.util.Duration import akka.event.{ Logging, NoLogging, LoggingAdapter } diff --git a/akka-zeromq/src/main/scala/akka/zeromq/ZeroMQExtension.scala b/akka-zeromq/src/main/scala/akka/zeromq/ZeroMQExtension.scala index 7ee29837b1..6db90d5dd1 100644 --- a/akka-zeromq/src/main/scala/akka/zeromq/ZeroMQExtension.scala +++ b/akka-zeromq/src/main/scala/akka/zeromq/ZeroMQExtension.scala @@ -5,8 +5,8 @@ package akka.zeromq import org.zeromq.{ ZMQ ⇒ JZMQ } import akka.actor._ -import akka.dispatch.{ Await } import akka.pattern.ask +import scala.concurrent.Await import scala.concurrent.util.Duration import java.util.concurrent.TimeUnit import akka.util.Timeout