polish “ask” pattern, see #1581

- move package objects into their respective package.scala file in the
  right directories
- make implicit conversion as well as explicit facility available under
  the same name akka.patterns.ask for easy import
- revert the logic to produce the Promise for the PromiseActorRef within
  the ActorRefProvider; supporting wrapping of external Promises does
  not seem to justify doing needless extra allocations in case of
  failure
- add scaladocs
- factor out “def provider” into trait ActorRefWithProvider, as it
  didn’t feel right attaching this information “by exception” to
  MinimalActorRef
This commit is contained in:
Roland 2012-01-17 17:04:20 +01:00
parent ce1d2f4721
commit 9c762dec20
11 changed files with 268 additions and 176 deletions

View file

@ -138,7 +138,7 @@ class RemoteActorRefProvider(
def actorFor(ref: InternalActorRef, path: Iterable[String]): InternalActorRef = local.actorFor(ref, path)
def ask(result: Promise[Any], within: Timeout): Option[ActorRef] = local.ask(result, within)
def ask(within: Timeout): Option[PromiseActorRef] = local.ask(within)
/**
* Using (checking out) actor on a specific node.
@ -160,12 +160,12 @@ trait RemoteRef extends ActorRefScope {
* This reference is network-aware (remembers its origin) and immutable.
*/
private[akka] class RemoteActorRef private[akka] (
override val provider: RemoteActorRefProvider,
val provider: RemoteActorRefProvider,
remote: RemoteSupport[ParsedTransportAddress],
val path: ActorPath,
val getParent: InternalActorRef,
loader: Option[ClassLoader])
extends InternalActorRef with RemoteRef {
extends InternalActorRef with RemoteRef with ActorRefWithProvider {
def getChild(name: Iterator[String]): InternalActorRef = {
val s = name.toStream