Making createAsker private, adding docs for 'to', changing Java API to be symmetric to Java

This commit is contained in:
Viktor Klang 2012-02-01 14:54:54 +01:00
parent 75e90cccdf
commit 009a1afe89
5 changed files with 15 additions and 6 deletions

View file

@ -183,7 +183,10 @@ trait AskSupport {
} }
} }
def createAsker(provider: ActorRefProvider, timeout: Timeout): PromiseActorRef = { /**
* INTERNAL AKKA USE ONLY
*/
private[akka] def createAsker(provider: ActorRefProvider, timeout: Timeout): PromiseActorRef = {
val path = provider.tempPath() val path = provider.tempPath()
val result = Promise[Any]()(provider.dispatcher) val result = Promise[Any]()(provider.dispatcher)
val a = new PromiseActorRef(provider, path, provider.tempContainer, result, provider.deathWatch) val a = new PromiseActorRef(provider, path, provider.tempContainer, result, provider.deathWatch)

View file

@ -83,10 +83,10 @@ object Patterns {
* // apply some transformation (i.e. enrich with request info) * // apply some transformation (i.e. enrich with request info)
* final Future<Object> transformed = f.map(new akka.japi.Function<Object, Object>() { ... }); * final Future<Object> transformed = f.map(new akka.japi.Function<Object, Object>() { ... });
* // send it on to the next stage * // send it on to the next stage
* Patterns.pipe(transformed, nextActor); * Patterns.pipe(transformed).to(nextActor);
* }}} * }}}
*/ */
def pipe[T](future: Future[T], recipient: ActorRef): Future[T] = scalaPipe(future) pipeTo recipient def pipe[T](future: Future[T]): PipeableFuture[T] = scalaPipe(future)
/** /**
* Returns a [[akka.dispatch.Future]] that will be completed with success (value `true`) when * Returns a [[akka.dispatch.Future]] that will be completed with success (value `true`) when

View file

@ -25,9 +25,14 @@ trait PipeToSupport {
* Import this implicit conversion to gain the `pipeTo` method on [[akka.dispatch.Future]]: * Import this implicit conversion to gain the `pipeTo` method on [[akka.dispatch.Future]]:
* *
* {{{ * {{{
* import akka.pattern.pipeTo * import akka.pattern.pipe
* *
* Future { doExpensiveCalc() } pipeTo nextActor * Future { doExpensiveCalc() } pipeTo nextActor
*
* or
*
* pipe(someFuture) to nextActor
*
* }}} * }}}
*/ */
implicit def pipe[T](future: Future[T]): PipeableFuture[T] = new PipeableFuture(future) implicit def pipe[T](future: Future[T]): PipeableFuture[T] = new PipeableFuture(future)

View file

@ -247,7 +247,7 @@ public class UntypedActorDocTestBase {
} }
}); });
pipe(transformed, actorC); pipe(transformed).to(actorC);
//#ask-pipe //#ask-pipe
system.shutdown(); system.shutdown();
} }

View file

@ -151,7 +151,8 @@ public class FaultHandlingDocSample {
public Progress apply(CurrentCount c) { public Progress apply(CurrentCount c) {
return new Progress(100.0 * c.count / totalCount); return new Progress(100.0 * c.count / totalCount);
} }
}), progressListener); }))
.to(progressListener);
} else { } else {
unhandled(msg); unhandled(msg);
} }