Moving to s.c.EC and s.c.A, compiles but tests aren't passing

This commit is contained in:
Viktor Klang 2012-06-29 16:40:36 +02:00
parent e62a0eee1c
commit 8ede1f55e9
12 changed files with 28 additions and 20 deletions

View file

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

View file

@ -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

View file

@ -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;

View file

@ -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<Boolean> 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();
}

View file

@ -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<java.lang.Throwable,scala.runtime.BoxedUnit>)(ExecutionContext$.MODULE$.fromExecutorService$default$2()));
//Use ec with your Futures
Future<String> 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
}

View file

@ -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 }

View file

@ -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 {

View file

@ -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 }

View file

@ -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

View file

@ -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 {

View file

@ -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 }

View file

@ -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