diff --git a/akka-actor/src/main/scala/akka/dispatch/Future.scala b/akka-actor/src/main/scala/akka/dispatch/Future.scala index 71bb644926..5cef4de971 100644 --- a/akka-actor/src/main/scala/akka/dispatch/Future.scala +++ b/akka-actor/src/main/scala/akka/dispatch/Future.scala @@ -138,6 +138,14 @@ object Futures { }.map(_.result) } +object Future { + def apply[T](body: => T, timeout: Long = Actor.TIMEOUT)(implicit dispatcher: MessageDispatcher): Future[T] = { + val f = new DefaultCompletableFuture[T](timeout) + dispatcher.dispatchFuture(FutureInvocation(f.asInstanceOf[CompletableFuture[Any]], () => body)) + f + } +} + sealed trait Future[T] { /** * Blocks the current thread until the Future has been completed or the