diff --git a/akka-actor-tests/src/test/java/akka/actor/JavaExtension.java b/akka-actor-tests/src/test/java/akka/actor/JavaExtension.java index 218dcc90d8..0a994b93d6 100644 --- a/akka-actor-tests/src/test/java/akka/actor/JavaExtension.java +++ b/akka-actor-tests/src/test/java/akka/actor/JavaExtension.java @@ -14,7 +14,7 @@ import com.typesafe.config.Config; import static org.junit.Assert.*; -public class JavaExtension extends JavaExtensionSuite { +public class JavaExtension { static class Provider implements ExtensionIdProvider { public ExtensionId lookup() { diff --git a/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala b/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala index ef13ed71d5..6f8c364ff8 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/ActorSystemSpec.scala @@ -7,8 +7,7 @@ import akka.testkit._ import org.scalatest.junit.JUnitSuite import com.typesafe.config.ConfigFactory -//FIXME SOME BUG WITH COMPILER? -//class JavaExtensionSpec extends JavaExtension with JUnitSuite +class JavaExtensionSpec extends JavaExtension with JUnitSuite object TestExtension extends ExtensionId[TestExtension] with ExtensionIdProvider { def lookup = this diff --git a/akka-actor-tests/src/test/scala/akka/actor/JavaAPISpec.scala b/akka-actor-tests/src/test/scala/akka/actor/JavaAPISpec.scala index c90de6c4bf..49fcc6d638 100644 --- a/akka-actor-tests/src/test/scala/akka/actor/JavaAPISpec.scala +++ b/akka-actor-tests/src/test/scala/akka/actor/JavaAPISpec.scala @@ -5,5 +5,4 @@ package akka.actor import org.scalatest.junit.JUnitSuite -//FIXME SOME BUG WITH COMPILER? -//class JavaAPISpec extends akka.actor.JavaAPI with JUnitSuite +class JavaAPISpec extends JavaAPI with JUnitSuite diff --git a/akka-actor/src/main/scala/akka/dispatch/Future.scala b/akka-actor/src/main/scala/akka/dispatch/Future.scala index 241c00ee65..494a387a98 100644 --- a/akka-actor/src/main/scala/akka/dispatch/Future.scala +++ b/akka-actor/src/main/scala/akka/dispatch/Future.scala @@ -407,14 +407,6 @@ sealed trait Future[+T] extends japi.Future[T] with Block.Blockable[T] { */ def value: Option[Either[Throwable, T]] - /** - * Returns the successful result of this Future if it exists. - */ - final def result: Option[T] = value match { - case Some(Right(r)) ⇒ Some(r) - case _ ⇒ None - } - /** * When this Future is completed, apply the provided function to the * Future. If the Future has already been completed, this will apply diff --git a/akka-stm/src/main/scala/akka/agent/Agent.scala b/akka-stm/src/main/scala/akka/agent/Agent.scala index 33530c8406..25c0d6f188 100644 --- a/akka-stm/src/main/scala/akka/agent/Agent.scala +++ b/akka-stm/src/main/scala/akka/agent/Agent.scala @@ -186,7 +186,7 @@ class Agent[T](initialValue: T, system: ActorSystem) { /** * Gets this agent's value after all currently queued updates have completed. */ - def await(implicit timeout: Timeout): T = Block.on(future, timeout.duration).result.get + def await(implicit timeout: Timeout): T = Block.sync(future, timeout.duration) /** * Map this agent to a new agent, applying the function to the internal state. diff --git a/akka-stm/src/test/java/akka/transactor/example/UntypedTransactorExample.java b/akka-stm/src/test/java/akka/transactor/example/UntypedTransactorExample.java index 2c6a5b5e7b..65ec9e1dae 100644 --- a/akka-stm/src/test/java/akka/transactor/example/UntypedTransactorExample.java +++ b/akka-stm/src/test/java/akka/transactor/example/UntypedTransactorExample.java @@ -13,10 +13,10 @@ import java.util.concurrent.TimeUnit; public class UntypedTransactorExample { public static void main(String[] args) throws InterruptedException { - ActorSystem application = ActorSystem.create("UntypedTransactorExample", AkkaSpec.testConf()); + ActorSystem app = ActorSystem.create("UntypedTransactorExample", AkkaSpec.testConf()); - ActorRef counter1 = application.actorOf(new Props().withCreator(UntypedCounter.class)); - ActorRef counter2 = application.actorOf(new Props().withCreator(UntypedCounter.class)); + ActorRef counter1 = app.actorOf(new Props().withCreator(UntypedCounter.class)); + ActorRef counter2 = app.actorOf(new Props().withCreator(UntypedCounter.class)); counter1.tell(new Increment(counter2)); @@ -28,25 +28,11 @@ public class UntypedTransactorExample { Future future1 = counter1.ask("GetCount", timeout); Future future2 = counter2.ask("GetCount", timeout); - Block.on(future1, d); - if (future1.isCompleted()) { - if (future1.result().isDefined()) { - int result = (Integer) future1.result().get(); - System.out.println("counter 1: " + result); - } - } + int count1 = (Integer)Block.sync(future1, d); + System.out.println("counter 1: " + count1); + int count2 = (Integer)Block.sync(future2, d); + System.out.println("counter 1: " + count2); - Block.on(future2, d); - if (future2.isCompleted()) { - if (future2.result().isDefined()) { - int result = (Integer) future2.result().get(); - System.out.println("counter 2: " + result); - } - } - - counter1.stop(); - counter2.stop(); - - application.stop(); + app.stop(); } } diff --git a/akka-stm/src/test/java/akka/transactor/test/UntypedTransactorTest.java b/akka-stm/src/test/java/akka/transactor/test/UntypedTransactorTest.java index d93b1d2389..b2db2e387a 100644 --- a/akka-stm/src/test/java/akka/transactor/test/UntypedTransactorTest.java +++ b/akka-stm/src/test/java/akka/transactor/test/UntypedTransactorTest.java @@ -79,16 +79,9 @@ public class UntypedTransactorTest { } catch (InterruptedException exception) { } for (ActorRef counter : counters) { - Future future = counter.ask("GetCount", askTimeout); - Block.on(future, Duration.create(askTimeout, TimeUnit.MILLISECONDS)); - if (future.isCompleted()) { - Option resultOption = future.result(); - if (resultOption.isDefined()) { - Object result = resultOption.get(); - int count = (Integer) result; - assertEquals(1, count); - } - } + Future future = counter.ask("GetCount", askTimeout); + int count = (Integer)Block.sync(future, Duration.create(askTimeout, TimeUnit.MILLISECONDS)); + assertEquals(1, count); } } @@ -109,15 +102,8 @@ public class UntypedTransactorTest { } for (ActorRef counter : counters) { Future future = counter.ask("GetCount", askTimeout); - Block.on(future, Duration.create(askTimeout, TimeUnit.MILLISECONDS)); - if (future.isCompleted()) { - Option resultOption = future.result(); - if (resultOption.isDefined()) { - Object result = resultOption.get(); - int count = (Integer) result; - assertEquals(0, count); - } - } + int count = (Integer)Block.sync(future, Duration.create(askTimeout, TimeUnit.MILLISECONDS)); + assertEquals(0, count); } }