Rename address to name or path where appropriate

- TypedActor: address -> name
- TestActorRef, TestFSMRef: address -> name
- Props.randomAddress -> randomName
- Remote protocol: address -> name
- Address.validate moved to ActorPath
This commit is contained in:
Peter Vlugter 2011-11-08 14:30:33 +01:00
parent 3f7cff141d
commit 7b8a865c00
20 changed files with 284 additions and 287 deletions

View file

@ -441,23 +441,3 @@ trait Actor {
private val processingBehavior = receive //ProcessingBehavior is the original behavior private val processingBehavior = receive //ProcessingBehavior is the original behavior
} }
/**
* Helper methods and fields for working with actor addresses.
* Meant for internal use.
*
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/
object Address {
val clusterActorRefPrefix = "cluster-actor-ref.".intern
private val validAddressPattern = java.util.regex.Pattern.compile("[0-9a-zA-Z\\-\\_\\$\\.]+")
def validate(address: String) {
if (!validAddressPattern.matcher(address).matches) {
val e = new IllegalArgumentException("Address [" + address + "] is not valid, need to follow pattern: " + validAddressPattern.pattern)
throw e
}
}
}

View file

@ -220,7 +220,7 @@ private[akka] class ActorCell(
def terminate() { def terminate() {
receiveTimeout = None receiveTimeout = None
cancelReceiveTimeout cancelReceiveTimeout
app.provider.evict(self.address) app.provider.evict(self.path.toString)
dispatcher.detach(this) dispatcher.detach(this)
try { try {

View file

@ -9,6 +9,8 @@ import akka.AkkaApplication
object ActorPath { object ActorPath {
final val separator = "/" final val separator = "/"
val pattern = """(/[0-9a-zA-Z\-\_\$\.]+)+""".r.pattern
/** /**
* Create an actor path from a string. * Create an actor path from a string.
*/ */
@ -35,6 +37,21 @@ object ActorPath {
*/ */
def join(path: Iterable[String]): String = def join(path: Iterable[String]): String =
path.mkString(separator, separator, "") path.mkString(separator, separator, "")
/**
* Is this string representation of a path valid?
*/
def valid(path: String): Boolean =
pattern.matcher(path).matches
/**
* Validate a path. Moved here from Address.validate.
* Throws an IllegalArgumentException if the path is invalid.
*/
def validate(path: String): Unit = {
if (!valid(path))
throw new IllegalArgumentException("Path [" + path + "] is not valid. Needs to follow this pattern: " + pattern)
}
} }
/** /**

View file

@ -65,7 +65,7 @@ trait ActorRefFactory {
*/ */
protected def guardian: ActorRef protected def guardian: ActorRef
def actorOf(props: Props): ActorRef = actorOf(props, Props.randomAddress) def actorOf(props: Props): ActorRef = actorOf(props, Props.randomName)
/* /*
* TODO this will have to go at some point, because creating two actors with * TODO this will have to go at some point, because creating two actors with
@ -85,7 +85,7 @@ trait ActorRefFactory {
def actorOf(creator: UntypedActorFactory): ActorRef = actorOf(Props(() creator.create())) def actorOf(creator: UntypedActorFactory): ActorRef = actorOf(Props(() creator.create()))
def actorOf(props: RoutedProps): ActorRef = actorOf(props, Props.randomAddress) def actorOf(props: RoutedProps): ActorRef = actorOf(props, Props.randomName)
def actorOf(props: RoutedProps, name: String): ActorRef = provider.actorOf(props, guardian, name) def actorOf(props: RoutedProps, name: String): ActorRef = provider.actorOf(props, guardian, name)
@ -178,7 +178,7 @@ class LocalActorRefProvider(val app: AkkaApplication) extends ActorRefProvider {
private[akka] def actorOf(props: Props, supervisor: ActorRef, path: ActorPath, systemService: Boolean): ActorRef = { private[akka] def actorOf(props: Props, supervisor: ActorRef, path: ActorPath, systemService: Boolean): ActorRef = {
val name = path.name val name = path.name
if ((name eq null) || name == Props.randomAddress) { if ((name eq null) || name == Props.randomName) {
val randomName: String = newUuid.toString val randomName: String = newUuid.toString
val newPath = path.parent / randomName val newPath = path.parent / randomName
val actor = new LocalActorRef(app, props, supervisor, newPath, systemService = true) val actor = new LocalActorRef(app, props, supervisor, newPath, systemService = true)

View file

@ -21,7 +21,7 @@ trait ActorDeployer {
private[akka] def deploy(deployment: Deploy): Unit private[akka] def deploy(deployment: Deploy): Unit
private[akka] def lookupDeploymentFor(address: String): Option[Deploy] private[akka] def lookupDeploymentFor(address: String): Option[Deploy]
def lookupDeployment(address: String): Option[Deploy] = address match { def lookupDeployment(address: String): Option[Deploy] = address match {
case null | Props.`randomAddress` None case null | Props.`randomName` None
case some lookupDeploymentFor(some) case some lookupDeploymentFor(some)
} }
private[akka] def deploy(deployment: Seq[Deploy]): Unit = deployment foreach (deploy(_)) private[akka] def deploy(deployment: Seq[Deploy]): Unit = deployment foreach (deploy(_))

View file

@ -30,7 +30,7 @@ object Props {
final val defaultFaultHandler: FaultHandlingStrategy = OneForOneStrategy(defaultDecider, None, None) final val defaultFaultHandler: FaultHandlingStrategy = OneForOneStrategy(defaultDecider, None, None)
final val noHotSwap: Stack[Actor.Receive] = Stack.empty final val noHotSwap: Stack[Actor.Receive] = Stack.empty
final val randomAddress: String = "" final val randomName: String = ""
/** /**
* The default Props instance, uses the settings from the Props object starting with default* * The default Props instance, uses the settings from the Props object starting with default*

View file

@ -130,15 +130,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props): R =
typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomAddress, interface.getClassLoader) typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomName, interface.getClassLoader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, address: String): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, name: String): R =
typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, address, interface.getClassLoader) typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, name, interface.getClassLoader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
@ -146,15 +146,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props): R =
typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomAddress, interface.getClassLoader) typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomName, interface.getClassLoader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, address: String): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, name: String): R =
typedActor.createProxyAndTypedActor(this, interface, impl.create, props, address, interface.getClassLoader) typedActor.createProxyAndTypedActor(this, interface, impl.create, props, name, interface.getClassLoader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
@ -162,15 +162,15 @@ trait TypedActorFactory { this: ActorRefFactory ⇒
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomAddress, loader) typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, Props.randomName, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, address: String, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Class[T], props: Props, name: String, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, address, loader) typedActor.createProxyAndTypedActor(this, interface, impl.newInstance, props, name, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
@ -178,73 +178,73 @@ trait TypedActorFactory { this: ActorRefFactory ⇒
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomAddress, loader) typedActor.createProxyAndTypedActor(this, interface, impl.create, props, Props.randomName, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or * the interfaces usable by the returned proxy is the supplied interface class (if the class represents an interface) or
* all interfaces (Class.getInterfaces) if it's not an interface class * all interfaces (Class.getInterfaces) if it's not an interface class
*/ */
def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, address: String, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](interface: Class[R], impl: Creator[T], props: Props, name: String, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, interface, impl.create, props, address, loader) typedActor.createProxyAndTypedActor(this, interface, impl.create, props, name, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces)
*/ */
def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, Props.randomAddress, loader) typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, Props.randomName, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces)
*/ */
def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, address: String, loader: ClassLoader): R = def typedActorOf[R <: AnyRef, T <: R](impl: Class[T], props: Props, name: String, loader: ClassLoader): R =
typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, address, loader) typedActor.createProxyAndTypedActor(this, impl, impl.newInstance, props, name, loader)
/** /**
* Creates a new TypedActor proxy using the supplied Props, * Creates a new TypedActor proxy using the supplied Props,
* the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces) * the interfaces usable by the returned proxy is the supplied implementation class' interfaces (Class.getInterfaces)
*/ */
def typedActorOf[R <: AnyRef, T <: R](props: Props = Props(), address: String = Props.randomAddress, loader: ClassLoader = null)(implicit m: Manifest[T]): R = { def typedActorOf[R <: AnyRef, T <: R](props: Props = Props(), name: String = Props.randomName, loader: ClassLoader = null)(implicit m: Manifest[T]): R = {
val clazz = m.erasure.asInstanceOf[Class[T]] val clazz = m.erasure.asInstanceOf[Class[T]]
typedActor.createProxyAndTypedActor(this, clazz, clazz.newInstance, props, address, if (loader eq null) clazz.getClassLoader else loader) typedActor.createProxyAndTypedActor(this, clazz, clazz.newInstance, props, name, if (loader eq null) clazz.getClassLoader else loader)
} }
/** /**
* Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself,
* to create TypedActor proxies, use typedActorOf * to create TypedActor proxies, use typedActorOf
*/ */
def createProxy[R <: AnyRef](constructor: Actor, props: Props = Props(), address: String = Props.randomAddress, loader: ClassLoader = null)(implicit m: Manifest[R]): R = def createProxy[R <: AnyRef](constructor: Actor, props: Props = Props(), name: String = Props.randomName, loader: ClassLoader = null)(implicit m: Manifest[R]): R =
typedActor.createProxy[R](this, typedActor.extractInterfaces(m.erasure), (ref: AtomVar[R]) constructor, props, Props.randomAddress, if (loader eq null) m.erasure.getClassLoader else loader) typedActor.createProxy[R](this, typedActor.extractInterfaces(m.erasure), (ref: AtomVar[R]) constructor, props, Props.randomName, if (loader eq null) m.erasure.getClassLoader else loader)
/** /**
* Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself,
* to create TypedActor proxies, use typedActorOf * to create TypedActor proxies, use typedActorOf
*/ */
def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, loader: ClassLoader): R = def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, loader: ClassLoader): R =
typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) constructor.create, props, Props.randomAddress, loader) typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) constructor.create, props, Props.randomName, loader)
/** /**
* Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself,
* to create TypedActor proxies, use typedActorOf * to create TypedActor proxies, use typedActorOf
*/ */
def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, address: String, loader: ClassLoader): R = def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Creator[Actor], props: Props, name: String, loader: ClassLoader): R =
typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) constructor.create, props, address, loader) typedActor.createProxy(this, interfaces, (ref: AtomVar[R]) constructor.create, props, name, loader)
/** /**
* Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself,
* to create TypedActor proxies, use typedActorOf * to create TypedActor proxies, use typedActorOf
*/ */
def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Actor, props: Props, loader: ClassLoader): R = def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Actor, props: Props, loader: ClassLoader): R =
typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) constructor, props, Props.randomAddress, loader) typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) constructor, props, Props.randomName, loader)
/** /**
* Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself, * Creates a proxy given the supplied Props, this is not a TypedActor, so you'll need to implement the MethodCall handling yourself,
* to create TypedActor proxies, use typedActorOf * to create TypedActor proxies, use typedActorOf
*/ */
def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Actor, props: Props, address: String, loader: ClassLoader): R = def createProxy[R <: AnyRef](interfaces: Array[Class[_]], constructor: Actor, props: Props, name: String, loader: ClassLoader): R =
typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) constructor, props, address, loader) typedActor.createProxy[R](this, interfaces, (ref: AtomVar[R]) constructor, props, name, loader)
} }
@ -302,15 +302,15 @@ class TypedActor(val app: AkkaApplication) {
} }
else null else null
private[akka] def createProxy[R <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], constructor: (AtomVar[R]) Actor, props: Props, address: String, loader: ClassLoader): R = { private[akka] def createProxy[R <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], constructor: (AtomVar[R]) Actor, props: Props, name: String, loader: ClassLoader): R = {
val proxyVar = new AtomVar[R] val proxyVar = new AtomVar[R]
configureAndProxyLocalActorRef[R](supervisor, interfaces, proxyVar, props.withCreator(constructor(proxyVar)), address, loader) configureAndProxyLocalActorRef[R](supervisor, interfaces, proxyVar, props.withCreator(constructor(proxyVar)), name, loader)
} }
private[akka] def createProxyAndTypedActor[R <: AnyRef, T <: R](supervisor: ActorRefFactory, interface: Class[_], constructor: T, props: Props, address: String, loader: ClassLoader): R = private[akka] def createProxyAndTypedActor[R <: AnyRef, T <: R](supervisor: ActorRefFactory, interface: Class[_], constructor: T, props: Props, name: String, loader: ClassLoader): R =
createProxy[R](supervisor, extractInterfaces(interface), (ref: AtomVar[R]) new TypedActor[R, T](ref, constructor), props, address, loader) createProxy[R](supervisor, extractInterfaces(interface), (ref: AtomVar[R]) new TypedActor[R, T](ref, constructor), props, name, loader)
private[akka] def configureAndProxyLocalActorRef[T <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], proxyVar: AtomVar[T], props: Props, address: String, loader: ClassLoader): T = { private[akka] def configureAndProxyLocalActorRef[T <: AnyRef](supervisor: ActorRefFactory, interfaces: Array[Class[_]], proxyVar: AtomVar[T], props: Props, name: String, loader: ClassLoader): T = {
//Warning, do not change order of the following statements, it's some elaborate chicken-n-egg handling //Warning, do not change order of the following statements, it's some elaborate chicken-n-egg handling
val actorVar = new AtomVar[ActorRef](null) val actorVar = new AtomVar[ActorRef](null)
val timeout = props.timeout match { val timeout = props.timeout match {
@ -319,7 +319,7 @@ class TypedActor(val app: AkkaApplication) {
} }
val proxy: T = Proxy.newProxyInstance(loader, interfaces, new TypedActorInvocationHandler(actorVar, timeout)).asInstanceOf[T] val proxy: T = Proxy.newProxyInstance(loader, interfaces, new TypedActorInvocationHandler(actorVar, timeout)).asInstanceOf[T]
proxyVar.set(proxy) // Chicken and egg situation we needed to solve, set the proxy so that we can set the self-reference inside each receive proxyVar.set(proxy) // Chicken and egg situation we needed to solve, set the proxy so that we can set the self-reference inside each receive
val ref = supervisor.actorOf(props, address) val ref = supervisor.actorOf(props, name)
actorVar.set(ref) //Make sure the InvocationHandler gets ahold of the actor reference, this is not a problem since the proxy hasn't escaped this method yet actorVar.set(ref) //Make sure the InvocationHandler gets ahold of the actor reference, this is not a problem since the proxy hasn't escaped this method yet
proxyVar.get proxyVar.get
} }

View file

@ -129,7 +129,7 @@ trait LoggingBus extends ActorEventBus {
} }
private def addLogger(app: AkkaApplication, clazz: Class[_ <: Actor], level: LogLevel): ActorRef = { private def addLogger(app: AkkaApplication, clazz: Class[_ <: Actor], level: LogLevel): ActorRef = {
val actor = app.systemActorOf(Props(clazz), Props.randomAddress) val actor = app.systemActorOf(Props(clazz), Props.randomName)
actor ! InitializeLogger(this) actor ! InitializeLogger(this)
AllLogLevels filter (level >= _) foreach (l subscribe(actor, classFor(l))) AllLogLevels filter (level >= _) foreach (l subscribe(actor, classFor(l)))
publish(Info(this, "logger " + clazz.getName + " started")) publish(Info(this, "logger " + clazz.getName + " started"))

View file

@ -32,8 +32,8 @@ private[camel] object TypedCamel {
* and re-uses the <code>activationTracker</code> of <code>service</code>. * and re-uses the <code>activationTracker</code> of <code>service</code>.
*/ */
def onCamelServiceStart(service: CamelService) { def onCamelServiceStart(service: CamelService) {
consumerPublisher = new LocalActorRef(Props(new TypedConsumerPublisher(service.activationTracker)), Props.randomAddress, true) consumerPublisher = new LocalActorRef(Props(new TypedConsumerPublisher(service.activationTracker)), Props.randomName, true)
publishRequestor = new LocalActorRef(Props(new TypedConsumerPublishRequestor), Props.randomAddress, true) publishRequestor = new LocalActorRef(Props(new TypedConsumerPublishRequestor), Props.randomName, true)
registerPublishRequestor registerPublishRequestor

View file

@ -26,9 +26,9 @@ import TypedCamelAccess._
* @author Martin Krasser * @author Martin Krasser
*/ */
trait CamelService extends Bootable { trait CamelService extends Bootable {
private[camel] val activationTracker = new LocalActorRef(Props[ActivationTracker], Props.randomAddress, true) private[camel] val activationTracker = new LocalActorRef(Props[ActivationTracker], Props.randomName, true)
private[camel] val consumerPublisher = new LocalActorRef(Props(new ConsumerPublisher(activationTracker)), Props.randomAddress, true) private[camel] val consumerPublisher = new LocalActorRef(Props(new ConsumerPublisher(activationTracker)), Props.randomName, true)
private[camel] val publishRequestor = new LocalActorRef(Props(new ConsumerPublishRequestor), Props.randomAddress, true) private[camel] val publishRequestor = new LocalActorRef(Props(new ConsumerPublishRequestor), Props.randomName, true)
private val serviceEnabled = config.getList("akka.enabled-modules").exists(_ == "camel") private val serviceEnabled = config.getList("akka.enabled-modules").exists(_ == "camel")

View file

@ -1860,7 +1860,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
Props( Props(
self { self {
case f: Function0[_] try { f() } finally { self.stop() } case f: Function0[_] try { f() } finally { self.stop() }
}).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) ! payloadFor(message, classOf[Function0[Unit]])
} }
def handle_fun0_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { def handle_fun0_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) {
@ -1868,7 +1868,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
Props( Props(
self { self {
case f: Function0[_] try { self.reply(f()) } finally { self.stop() } case f: Function0[_] try { self.reply(f()) } finally { self.stop() }
}).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) forward payloadFor(message, classOf[Function0[Any]])
} }
def handle_fun1_arg_unit(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { def handle_fun1_arg_unit(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) {
@ -1876,7 +1876,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
Props( Props(
self { self {
case (fun: Function[_, _], param: Any) try { fun.asInstanceOf[Any Unit].apply(param) } finally { self.stop() } case (fun: Function[_, _], param: Any) try { fun.asInstanceOf[Any Unit].apply(param) } finally { self.stop() }
}).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]])
} }
def handle_fun1_arg_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { def handle_fun1_arg_any(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) {
@ -1884,7 +1884,7 @@ class RemoteClusterDaemon(cluster: ClusterNode) extends Actor {
Props( Props(
self { self {
case (fun: Function[_, _], param: Any) try { self.reply(fun.asInstanceOf[Any Any](param)) } finally { self.stop() } case (fun: Function[_, _], param: Any) try { self.reply(fun.asInstanceOf[Any Any](param)) } finally { self.stop() }
}).copy(dispatcher = computeGridDispatcher), Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) }).copy(dispatcher = computeGridDispatcher), Props.randomName, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]])
} }
def handleFailover(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) { def handleFailover(message: RemoteProtocol.RemoteSystemDaemonMessageProtocol) {

View file

@ -31,7 +31,7 @@ abstract class DurableMailboxSpec(val backendName: String, val storage: DurableM
"should handle reply to ! for 1 message" in { "should handle reply to ! for 1 message" in {
val latch = new CountDownLatch(1) val latch = new CountDownLatch(1)
val queueActor = createMailboxTestActor(backendName + " should handle reply to !") val queueActor = createMailboxTestActor(backendName + " should handle reply to !")
val sender = new LocalActorRef(Props(self { case "sum" latch.countDown }), Props.randomAddress, true) val sender = new LocalActorRef(Props(self { case "sum" latch.countDown }), Props.randomName, true)
queueActor.!("sum")(Some(sender)) queueActor.!("sum")(Some(sender))
latch.await(10, TimeUnit.SECONDS) must be(true) latch.await(10, TimeUnit.SECONDS) must be(true)
@ -40,7 +40,7 @@ abstract class DurableMailboxSpec(val backendName: String, val storage: DurableM
"should handle reply to ! for multiple messages" in { "should handle reply to ! for multiple messages" in {
val latch = new CountDownLatch(5) val latch = new CountDownLatch(5)
val queueActor = createMailboxTestActor(backendName + " should handle reply to !") val queueActor = createMailboxTestActor(backendName + " should handle reply to !")
val sender = new LocalActorRef(Props(self { case "sum" latch.countDown }), Props.randomAddress, true) val sender = new LocalActorRef(Props(self { case "sum" latch.countDown }), Props.randomName, true)
for (i 1 to 5) queueActor.!("sum")(Some(sender)) for (i 1 to 5) queueActor.!("sum")(Some(sender))

View file

@ -2711,17 +2711,17 @@ public final class RemoteProtocol {
public interface ActorRefProtocolOrBuilder public interface ActorRefProtocolOrBuilder
extends com.google.protobuf.MessageOrBuilder { extends com.google.protobuf.MessageOrBuilder {
// required string address = 1; // required string host = 1;
boolean hasAddress();
String getAddress();
// required string host = 2;
boolean hasHost(); boolean hasHost();
String getHost(); String getHost();
// required uint32 port = 3; // required uint32 port = 2;
boolean hasPort(); boolean hasPort();
int getPort(); int getPort();
// required string path = 3;
boolean hasPath();
String getPath();
} }
public static final class ActorRefProtocol extends public static final class ActorRefProtocol extends
com.google.protobuf.GeneratedMessage com.google.protobuf.GeneratedMessage
@ -2752,43 +2752,11 @@ public final class RemoteProtocol {
} }
private int bitField0_; private int bitField0_;
// required string address = 1; // required string host = 1;
public static final int ADDRESS_FIELD_NUMBER = 1; public static final int HOST_FIELD_NUMBER = 1;
private java.lang.Object address_;
public boolean hasAddress() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
public String getAddress() {
java.lang.Object ref = address_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (com.google.protobuf.Internal.isValidUtf8(bs)) {
address_ = s;
}
return s;
}
}
private com.google.protobuf.ByteString getAddressBytes() {
java.lang.Object ref = address_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((String) ref);
address_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
// required string host = 2;
public static final int HOST_FIELD_NUMBER = 2;
private java.lang.Object host_; private java.lang.Object host_;
public boolean hasHost() { public boolean hasHost() {
return ((bitField0_ & 0x00000002) == 0x00000002); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
public String getHost() { public String getHost() {
java.lang.Object ref = host_; java.lang.Object ref = host_;
@ -2816,30 +2784,58 @@ public final class RemoteProtocol {
} }
} }
// required uint32 port = 3; // required uint32 port = 2;
public static final int PORT_FIELD_NUMBER = 3; public static final int PORT_FIELD_NUMBER = 2;
private int port_; private int port_;
public boolean hasPort() { public boolean hasPort() {
return ((bitField0_ & 0x00000004) == 0x00000004); return ((bitField0_ & 0x00000002) == 0x00000002);
} }
public int getPort() { public int getPort() {
return port_; return port_;
} }
// required string path = 3;
public static final int PATH_FIELD_NUMBER = 3;
private java.lang.Object path_;
public boolean hasPath() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
public String getPath() {
java.lang.Object ref = path_;
if (ref instanceof String) {
return (String) ref;
} else {
com.google.protobuf.ByteString bs =
(com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8();
if (com.google.protobuf.Internal.isValidUtf8(bs)) {
path_ = s;
}
return s;
}
}
private com.google.protobuf.ByteString getPathBytes() {
java.lang.Object ref = path_;
if (ref instanceof String) {
com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((String) ref);
path_ = b;
return b;
} else {
return (com.google.protobuf.ByteString) ref;
}
}
private void initFields() { private void initFields() {
address_ = "";
host_ = ""; host_ = "";
port_ = 0; port_ = 0;
path_ = "";
} }
private byte memoizedIsInitialized = -1; private byte memoizedIsInitialized = -1;
public final boolean isInitialized() { public final boolean isInitialized() {
byte isInitialized = memoizedIsInitialized; byte isInitialized = memoizedIsInitialized;
if (isInitialized != -1) return isInitialized == 1; if (isInitialized != -1) return isInitialized == 1;
if (!hasAddress()) {
memoizedIsInitialized = 0;
return false;
}
if (!hasHost()) { if (!hasHost()) {
memoizedIsInitialized = 0; memoizedIsInitialized = 0;
return false; return false;
@ -2848,6 +2844,10 @@ public final class RemoteProtocol {
memoizedIsInitialized = 0; memoizedIsInitialized = 0;
return false; return false;
} }
if (!hasPath()) {
memoizedIsInitialized = 0;
return false;
}
memoizedIsInitialized = 1; memoizedIsInitialized = 1;
return true; return true;
} }
@ -2856,13 +2856,13 @@ public final class RemoteProtocol {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
output.writeBytes(1, getAddressBytes()); output.writeBytes(1, getHostBytes());
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getHostBytes()); output.writeUInt32(2, port_);
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeUInt32(3, port_); output.writeBytes(3, getPathBytes());
} }
getUnknownFields().writeTo(output); getUnknownFields().writeTo(output);
} }
@ -2875,15 +2875,15 @@ public final class RemoteProtocol {
size = 0; size = 0;
if (((bitField0_ & 0x00000001) == 0x00000001)) { if (((bitField0_ & 0x00000001) == 0x00000001)) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBytesSize(1, getAddressBytes()); .computeBytesSize(1, getHostBytes());
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getHostBytes()); .computeUInt32Size(2, port_);
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt32Size(3, port_); .computeBytesSize(3, getPathBytes());
} }
size += getUnknownFields().getSerializedSize(); size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size; memoizedSerializedSize = size;
@ -3009,11 +3009,11 @@ public final class RemoteProtocol {
public Builder clear() { public Builder clear() {
super.clear(); super.clear();
address_ = "";
bitField0_ = (bitField0_ & ~0x00000001);
host_ = ""; host_ = "";
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000001);
port_ = 0; port_ = 0;
bitField0_ = (bitField0_ & ~0x00000002);
path_ = "";
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
return this; return this;
} }
@ -3056,15 +3056,15 @@ public final class RemoteProtocol {
if (((from_bitField0_ & 0x00000001) == 0x00000001)) { if (((from_bitField0_ & 0x00000001) == 0x00000001)) {
to_bitField0_ |= 0x00000001; to_bitField0_ |= 0x00000001;
} }
result.address_ = address_; result.host_ = host_;
if (((from_bitField0_ & 0x00000002) == 0x00000002)) { if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002; to_bitField0_ |= 0x00000002;
} }
result.host_ = host_; result.port_ = port_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) { if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004; to_bitField0_ |= 0x00000004;
} }
result.port_ = port_; result.path_ = path_;
result.bitField0_ = to_bitField0_; result.bitField0_ = to_bitField0_;
onBuilt(); onBuilt();
return result; return result;
@ -3081,24 +3081,20 @@ public final class RemoteProtocol {
public Builder mergeFrom(akka.remote.RemoteProtocol.ActorRefProtocol other) { public Builder mergeFrom(akka.remote.RemoteProtocol.ActorRefProtocol other) {
if (other == akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) return this; if (other == akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) return this;
if (other.hasAddress()) {
setAddress(other.getAddress());
}
if (other.hasHost()) { if (other.hasHost()) {
setHost(other.getHost()); setHost(other.getHost());
} }
if (other.hasPort()) { if (other.hasPort()) {
setPort(other.getPort()); setPort(other.getPort());
} }
if (other.hasPath()) {
setPath(other.getPath());
}
this.mergeUnknownFields(other.getUnknownFields()); this.mergeUnknownFields(other.getUnknownFields());
return this; return this;
} }
public final boolean isInitialized() { public final boolean isInitialized() {
if (!hasAddress()) {
return false;
}
if (!hasHost()) { if (!hasHost()) {
return false; return false;
@ -3107,6 +3103,10 @@ public final class RemoteProtocol {
return false; return false;
} }
if (!hasPath()) {
return false;
}
return true; return true;
} }
@ -3135,65 +3135,29 @@ public final class RemoteProtocol {
} }
case 10: { case 10: {
bitField0_ |= 0x00000001; bitField0_ |= 0x00000001;
address_ = input.readBytes();
break;
}
case 18: {
bitField0_ |= 0x00000002;
host_ = input.readBytes(); host_ = input.readBytes();
break; break;
} }
case 24: { case 16: {
bitField0_ |= 0x00000004; bitField0_ |= 0x00000002;
port_ = input.readUInt32(); port_ = input.readUInt32();
break; break;
} }
case 26: {
bitField0_ |= 0x00000004;
path_ = input.readBytes();
break;
}
} }
} }
} }
private int bitField0_; private int bitField0_;
// required string address = 1; // required string host = 1;
private java.lang.Object address_ = "";
public boolean hasAddress() {
return ((bitField0_ & 0x00000001) == 0x00000001);
}
public String getAddress() {
java.lang.Object ref = address_;
if (!(ref instanceof String)) {
String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
address_ = s;
return s;
} else {
return (String) ref;
}
}
public Builder setAddress(String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000001;
address_ = value;
onChanged();
return this;
}
public Builder clearAddress() {
bitField0_ = (bitField0_ & ~0x00000001);
address_ = getDefaultInstance().getAddress();
onChanged();
return this;
}
void setAddress(com.google.protobuf.ByteString value) {
bitField0_ |= 0x00000001;
address_ = value;
onChanged();
}
// required string host = 2;
private java.lang.Object host_ = ""; private java.lang.Object host_ = "";
public boolean hasHost() { public boolean hasHost() {
return ((bitField0_ & 0x00000002) == 0x00000002); return ((bitField0_ & 0x00000001) == 0x00000001);
} }
public String getHost() { public String getHost() {
java.lang.Object ref = host_; java.lang.Object ref = host_;
@ -3209,44 +3173,80 @@ public final class RemoteProtocol {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
bitField0_ |= 0x00000002; bitField0_ |= 0x00000001;
host_ = value; host_ = value;
onChanged(); onChanged();
return this; return this;
} }
public Builder clearHost() { public Builder clearHost() {
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000001);
host_ = getDefaultInstance().getHost(); host_ = getDefaultInstance().getHost();
onChanged(); onChanged();
return this; return this;
} }
void setHost(com.google.protobuf.ByteString value) { void setHost(com.google.protobuf.ByteString value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000001;
host_ = value; host_ = value;
onChanged(); onChanged();
} }
// required uint32 port = 3; // required uint32 port = 2;
private int port_ ; private int port_ ;
public boolean hasPort() { public boolean hasPort() {
return ((bitField0_ & 0x00000004) == 0x00000004); return ((bitField0_ & 0x00000002) == 0x00000002);
} }
public int getPort() { public int getPort() {
return port_; return port_;
} }
public Builder setPort(int value) { public Builder setPort(int value) {
bitField0_ |= 0x00000004; bitField0_ |= 0x00000002;
port_ = value; port_ = value;
onChanged(); onChanged();
return this; return this;
} }
public Builder clearPort() { public Builder clearPort() {
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000002);
port_ = 0; port_ = 0;
onChanged(); onChanged();
return this; return this;
} }
// required string path = 3;
private java.lang.Object path_ = "";
public boolean hasPath() {
return ((bitField0_ & 0x00000004) == 0x00000004);
}
public String getPath() {
java.lang.Object ref = path_;
if (!(ref instanceof String)) {
String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
path_ = s;
return s;
} else {
return (String) ref;
}
}
public Builder setPath(String value) {
if (value == null) {
throw new NullPointerException();
}
bitField0_ |= 0x00000004;
path_ = value;
onChanged();
return this;
}
public Builder clearPath() {
bitField0_ = (bitField0_ & ~0x00000004);
path_ = getDefaultInstance().getPath();
onChanged();
return this;
}
void setPath(com.google.protobuf.ByteString value) {
bitField0_ |= 0x00000004;
path_ = value;
onChanged();
}
// @@protoc_insertion_point(builder_scope:ActorRefProtocol) // @@protoc_insertion_point(builder_scope:ActorRefProtocol)
} }
@ -5469,9 +5469,9 @@ public final class RemoteProtocol {
boolean hasMessageType(); boolean hasMessageType();
akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType getMessageType(); akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType getMessageType();
// optional string actorAddress = 2; // optional string actorPath = 2;
boolean hasActorAddress(); boolean hasActorPath();
String getActorAddress(); String getActorPath();
// optional bytes payload = 3; // optional bytes payload = 3;
boolean hasPayload(); boolean hasPayload();
@ -5521,14 +5521,14 @@ public final class RemoteProtocol {
return messageType_; return messageType_;
} }
// optional string actorAddress = 2; // optional string actorPath = 2;
public static final int ACTORADDRESS_FIELD_NUMBER = 2; public static final int ACTORPATH_FIELD_NUMBER = 2;
private java.lang.Object actorAddress_; private java.lang.Object actorPath_;
public boolean hasActorAddress() { public boolean hasActorPath() {
return ((bitField0_ & 0x00000002) == 0x00000002); return ((bitField0_ & 0x00000002) == 0x00000002);
} }
public String getActorAddress() { public String getActorPath() {
java.lang.Object ref = actorAddress_; java.lang.Object ref = actorPath_;
if (ref instanceof String) { if (ref instanceof String) {
return (String) ref; return (String) ref;
} else { } else {
@ -5536,17 +5536,17 @@ public final class RemoteProtocol {
(com.google.protobuf.ByteString) ref; (com.google.protobuf.ByteString) ref;
String s = bs.toStringUtf8(); String s = bs.toStringUtf8();
if (com.google.protobuf.Internal.isValidUtf8(bs)) { if (com.google.protobuf.Internal.isValidUtf8(bs)) {
actorAddress_ = s; actorPath_ = s;
} }
return s; return s;
} }
} }
private com.google.protobuf.ByteString getActorAddressBytes() { private com.google.protobuf.ByteString getActorPathBytes() {
java.lang.Object ref = actorAddress_; java.lang.Object ref = actorPath_;
if (ref instanceof String) { if (ref instanceof String) {
com.google.protobuf.ByteString b = com.google.protobuf.ByteString b =
com.google.protobuf.ByteString.copyFromUtf8((String) ref); com.google.protobuf.ByteString.copyFromUtf8((String) ref);
actorAddress_ = b; actorPath_ = b;
return b; return b;
} else { } else {
return (com.google.protobuf.ByteString) ref; return (com.google.protobuf.ByteString) ref;
@ -5578,7 +5578,7 @@ public final class RemoteProtocol {
private void initFields() { private void initFields() {
messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP; messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP;
actorAddress_ = ""; actorPath_ = "";
payload_ = com.google.protobuf.ByteString.EMPTY; payload_ = com.google.protobuf.ByteString.EMPTY;
replicateActorFromUuid_ = akka.remote.RemoteProtocol.UuidProtocol.getDefaultInstance(); replicateActorFromUuid_ = akka.remote.RemoteProtocol.UuidProtocol.getDefaultInstance();
} }
@ -5608,7 +5608,7 @@ public final class RemoteProtocol {
output.writeEnum(1, messageType_.getNumber()); output.writeEnum(1, messageType_.getNumber());
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
output.writeBytes(2, getActorAddressBytes()); output.writeBytes(2, getActorPathBytes());
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
output.writeBytes(3, payload_); output.writeBytes(3, payload_);
@ -5631,7 +5631,7 @@ public final class RemoteProtocol {
} }
if (((bitField0_ & 0x00000002) == 0x00000002)) { if (((bitField0_ & 0x00000002) == 0x00000002)) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeBytesSize(2, getActorAddressBytes()); .computeBytesSize(2, getActorPathBytes());
} }
if (((bitField0_ & 0x00000004) == 0x00000004)) { if (((bitField0_ & 0x00000004) == 0x00000004)) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -5768,7 +5768,7 @@ public final class RemoteProtocol {
super.clear(); super.clear();
messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP; messageType_ = akka.remote.RemoteProtocol.RemoteSystemDaemonMessageType.STOP;
bitField0_ = (bitField0_ & ~0x00000001); bitField0_ = (bitField0_ & ~0x00000001);
actorAddress_ = ""; actorPath_ = "";
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
payload_ = com.google.protobuf.ByteString.EMPTY; payload_ = com.google.protobuf.ByteString.EMPTY;
bitField0_ = (bitField0_ & ~0x00000004); bitField0_ = (bitField0_ & ~0x00000004);
@ -5823,7 +5823,7 @@ public final class RemoteProtocol {
if (((from_bitField0_ & 0x00000002) == 0x00000002)) { if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
to_bitField0_ |= 0x00000002; to_bitField0_ |= 0x00000002;
} }
result.actorAddress_ = actorAddress_; result.actorPath_ = actorPath_;
if (((from_bitField0_ & 0x00000004) == 0x00000004)) { if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
to_bitField0_ |= 0x00000004; to_bitField0_ |= 0x00000004;
} }
@ -5855,8 +5855,8 @@ public final class RemoteProtocol {
if (other.hasMessageType()) { if (other.hasMessageType()) {
setMessageType(other.getMessageType()); setMessageType(other.getMessageType());
} }
if (other.hasActorAddress()) { if (other.hasActorPath()) {
setActorAddress(other.getActorAddress()); setActorPath(other.getActorPath());
} }
if (other.hasPayload()) { if (other.hasPayload()) {
setPayload(other.getPayload()); setPayload(other.getPayload());
@ -5918,7 +5918,7 @@ public final class RemoteProtocol {
} }
case 18: { case 18: {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
actorAddress_ = input.readBytes(); actorPath_ = input.readBytes();
break; break;
} }
case 26: { case 26: {
@ -5965,39 +5965,39 @@ public final class RemoteProtocol {
return this; return this;
} }
// optional string actorAddress = 2; // optional string actorPath = 2;
private java.lang.Object actorAddress_ = ""; private java.lang.Object actorPath_ = "";
public boolean hasActorAddress() { public boolean hasActorPath() {
return ((bitField0_ & 0x00000002) == 0x00000002); return ((bitField0_ & 0x00000002) == 0x00000002);
} }
public String getActorAddress() { public String getActorPath() {
java.lang.Object ref = actorAddress_; java.lang.Object ref = actorPath_;
if (!(ref instanceof String)) { if (!(ref instanceof String)) {
String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); String s = ((com.google.protobuf.ByteString) ref).toStringUtf8();
actorAddress_ = s; actorPath_ = s;
return s; return s;
} else { } else {
return (String) ref; return (String) ref;
} }
} }
public Builder setActorAddress(String value) { public Builder setActorPath(String value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
actorAddress_ = value; actorPath_ = value;
onChanged(); onChanged();
return this; return this;
} }
public Builder clearActorAddress() { public Builder clearActorPath() {
bitField0_ = (bitField0_ & ~0x00000002); bitField0_ = (bitField0_ & ~0x00000002);
actorAddress_ = getDefaultInstance().getActorAddress(); actorPath_ = getDefaultInstance().getActorPath();
onChanged(); onChanged();
return this; return this;
} }
void setActorAddress(com.google.protobuf.ByteString value) { void setActorPath(com.google.protobuf.ByteString value) {
bitField0_ |= 0x00000002; bitField0_ |= 0x00000002;
actorAddress_ = value; actorPath_ = value;
onChanged(); onChanged();
} }
@ -6864,35 +6864,35 @@ public final class RemoteProtocol {
"\0132\026.MetadataEntryProtocol\"l\n\025RemoteContr" + "\0132\026.MetadataEntryProtocol\"l\n\025RemoteContr" +
"olProtocol\022!\n\013commandType\030\001 \002(\0162\014.Comman", "olProtocol\022!\n\013commandType\030\001 \002(\0162\014.Comman",
"dType\022\016\n\006cookie\030\002 \001(\t\022 \n\006origin\030\003 \001(\0132\020." + "dType\022\016\n\006cookie\030\002 \001(\t\022 \n\006origin\030\003 \001(\0132\020." +
"AddressProtocol\"?\n\020ActorRefProtocol\022\017\n\007a" + "AddressProtocol\"<\n\020ActorRefProtocol\022\014\n\004h" +
"ddress\030\001 \002(\t\022\014\n\004host\030\002 \002(\t\022\014\n\004port\030\003 \002(\r" + "ost\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\022\014\n\004path\030\003 \002(\t\";\n" +
"\";\n\017MessageProtocol\022\017\n\007message\030\001 \002(\014\022\027\n\017" + "\017MessageProtocol\022\017\n\007message\030\001 \002(\014\022\027\n\017mes" +
"messageManifest\030\002 \001(\014\")\n\014UuidProtocol\022\014\n" + "sageManifest\030\002 \001(\014\")\n\014UuidProtocol\022\014\n\004hi" +
"\004high\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025MetadataEntr" + "gh\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025MetadataEntryPr" +
"yProtocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\014\"1\n" + "otocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\014\"1\n\017Ad" +
"\017AddressProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004po" + "dressProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030" +
"rt\030\002 \002(\r\"7\n\021ExceptionProtocol\022\021\n\tclassna" + "\002 \002(\r\"7\n\021ExceptionProtocol\022\021\n\tclassname\030" +
"me\030\001 \002(\t\022\017\n\007message\030\002 \002(\t\"\256\001\n!RemoteSyst", "\001 \002(\t\022\017\n\007message\030\002 \002(\t\"\253\001\n!RemoteSystemD",
"emDaemonMessageProtocol\0223\n\013messageType\030\001" + "aemonMessageProtocol\0223\n\013messageType\030\001 \002(" +
" \002(\0162\036.RemoteSystemDaemonMessageType\022\024\n\014" + "\0162\036.RemoteSystemDaemonMessageType\022\021\n\tact" +
"actorAddress\030\002 \001(\t\022\017\n\007payload\030\003 \001(\014\022-\n\026r" + "orPath\030\002 \001(\t\022\017\n\007payload\030\003 \001(\014\022-\n\026replica" +
"eplicateActorFromUuid\030\004 \001(\0132\r.UuidProtoc" + "teActorFromUuid\030\004 \001(\0132\r.UuidProtocol\"y\n\035" +
"ol\"y\n\035DurableMailboxMessageProtocol\022$\n\tr" + "DurableMailboxMessageProtocol\022$\n\trecipie" +
"ecipient\030\001 \002(\0132\021.ActorRefProtocol\022!\n\006sen" + "nt\030\001 \002(\0132\021.ActorRefProtocol\022!\n\006sender\030\002 " +
"der\030\002 \001(\0132\021.ActorRefProtocol\022\017\n\007message\030" + "\001(\0132\021.ActorRefProtocol\022\017\n\007message\030\003 \002(\014*" +
"\003 \002(\014*(\n\013CommandType\022\013\n\007CONNECT\020\001\022\014\n\010SHU" + "(\n\013CommandType\022\013\n\007CONNECT\020\001\022\014\n\010SHUTDOWN\020" +
"TDOWN\020\002*K\n\026ReplicationStorageType\022\r\n\tTRA" + "\002*K\n\026ReplicationStorageType\022\r\n\tTRANSIENT" +
"NSIENT\020\001\022\023\n\017TRANSACTION_LOG\020\002\022\r\n\tDATA_GR", "\020\001\022\023\n\017TRANSACTION_LOG\020\002\022\r\n\tDATA_GRID\020\003*>",
"ID\020\003*>\n\027ReplicationStrategyType\022\021\n\rWRITE" + "\n\027ReplicationStrategyType\022\021\n\rWRITE_THROU" +
"_THROUGH\020\001\022\020\n\014WRITE_BEHIND\020\002*\241\002\n\035RemoteS" + "GH\020\001\022\020\n\014WRITE_BEHIND\020\002*\241\002\n\035RemoteSystemD" +
"ystemDaemonMessageType\022\010\n\004STOP\020\001\022\007\n\003USE\020" + "aemonMessageType\022\010\n\004STOP\020\001\022\007\n\003USE\020\002\022\013\n\007R" +
"\002\022\013\n\007RELEASE\020\003\022\022\n\016MAKE_AVAILABLE\020\004\022\024\n\020MA" + "ELEASE\020\003\022\022\n\016MAKE_AVAILABLE\020\004\022\024\n\020MAKE_UNA" +
"KE_UNAVAILABLE\020\005\022\016\n\nDISCONNECT\020\006\022\r\n\tRECO" + "VAILABLE\020\005\022\016\n\nDISCONNECT\020\006\022\r\n\tRECONNECT\020" +
"NNECT\020\007\022\n\n\006RESIGN\020\010\022\n\n\006GOSSIP\020\t\022\031\n\025FAIL_" + "\007\022\n\n\006RESIGN\020\010\022\n\n\006GOSSIP\020\t\022\031\n\025FAIL_OVER_C" +
"OVER_CONNECTIONS\020\024\022\026\n\022FUNCTION_FUN0_UNIT" + "ONNECTIONS\020\024\022\026\n\022FUNCTION_FUN0_UNIT\020\025\022\025\n\021" +
"\020\025\022\025\n\021FUNCTION_FUN0_ANY\020\026\022\032\n\026FUNCTION_FU" + "FUNCTION_FUN0_ANY\020\026\022\032\n\026FUNCTION_FUN1_ARG" +
"N1_ARG_UNIT\020\027\022\031\n\025FUNCTION_FUN1_ARG_ANY\020\030" + "_UNIT\020\027\022\031\n\025FUNCTION_FUN1_ARG_ANY\020\030B\017\n\013ak" +
"B\017\n\013akka.remoteH\001" "ka.remoteH\001"
}; };
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@ -6928,7 +6928,7 @@ public final class RemoteProtocol {
internal_static_ActorRefProtocol_fieldAccessorTable = new internal_static_ActorRefProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ActorRefProtocol_descriptor, internal_static_ActorRefProtocol_descriptor,
new java.lang.String[] { "Address", "Host", "Port", }, new java.lang.String[] { "Host", "Port", "Path", },
akka.remote.RemoteProtocol.ActorRefProtocol.class, akka.remote.RemoteProtocol.ActorRefProtocol.class,
akka.remote.RemoteProtocol.ActorRefProtocol.Builder.class); akka.remote.RemoteProtocol.ActorRefProtocol.Builder.class);
internal_static_MessageProtocol_descriptor = internal_static_MessageProtocol_descriptor =
@ -6976,7 +6976,7 @@ public final class RemoteProtocol {
internal_static_RemoteSystemDaemonMessageProtocol_fieldAccessorTable = new internal_static_RemoteSystemDaemonMessageProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteSystemDaemonMessageProtocol_descriptor, internal_static_RemoteSystemDaemonMessageProtocol_descriptor,
new java.lang.String[] { "MessageType", "ActorAddress", "Payload", "ReplicateActorFromUuid", }, new java.lang.String[] { "MessageType", "ActorPath", "Payload", "ReplicateActorFromUuid", },
akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.class, akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.class,
akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.Builder.class); akka.remote.RemoteProtocol.RemoteSystemDaemonMessageProtocol.Builder.class);
internal_static_DurableMailboxMessageProtocol_descriptor = internal_static_DurableMailboxMessageProtocol_descriptor =

View file

@ -66,9 +66,9 @@ enum ReplicationStrategyType {
* on the original node. * on the original node.
*/ */
message ActorRefProtocol { message ActorRefProtocol {
required string address = 1; required string host = 1;
required string host = 2; required uint32 port = 2;
required uint32 port = 3; required string path = 3;
} }
/** /**
@ -116,7 +116,7 @@ message ExceptionProtocol {
*/ */
message RemoteSystemDaemonMessageProtocol { message RemoteSystemDaemonMessageProtocol {
required RemoteSystemDaemonMessageType messageType = 1; required RemoteSystemDaemonMessageType messageType = 1;
optional string actorAddress = 2; optional string actorPath = 2;
optional bytes payload = 3; optional bytes payload = 3;
optional UuidProtocol replicateActorFromUuid = 4; optional UuidProtocol replicateActorFromUuid = 4;
} }

View file

@ -310,7 +310,7 @@ class Gossiper(remote: Remote) {
RemoteSystemDaemonMessageProtocol.newBuilder RemoteSystemDaemonMessageProtocol.newBuilder
.setMessageType(GOSSIP) .setMessageType(GOSSIP)
.setActorAddress(remote.remoteDaemon.path.toString) .setActorPath(remote.remoteDaemon.path.toString)
.setPayload(ByteString.copyFrom(gossipAsBytes)) .setPayload(ByteString.copyFrom(gossipAsBytes))
.build() .build()
} }

View file

@ -67,7 +67,7 @@ class NetworkEventStream(val app: AkkaApplication) {
// FIXME: check that this supervision is correct // FIXME: check that this supervision is correct
private[akka] val sender = app.provider.actorOf( private[akka] val sender = app.provider.actorOf(
Props[Channel].copy(dispatcher = app.dispatcherFactory.newPinnedDispatcher("NetworkEventStream")), Props[Channel].copy(dispatcher = app.dispatcherFactory.newPinnedDispatcher("NetworkEventStream")),
app.guardian, Props.randomAddress, systemService = true) app.guardian, Props.randomName, systemService = true)
/** /**
* Registers a network event stream listener (asyncronously). * Registers a network event stream listener (asyncronously).

View file

@ -129,7 +129,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
def handleUse(message: RemoteSystemDaemonMessageProtocol) { def handleUse(message: RemoteSystemDaemonMessageProtocol) {
try { try {
if (message.hasActorAddress) { if (message.hasActorPath) {
val actorFactoryBytes = val actorFactoryBytes =
if (shouldCompressData) LZF.uncompress(message.getPayload.toByteArray) else message.getPayload.toByteArray if (shouldCompressData) LZF.uncompress(message.getPayload.toByteArray) else message.getPayload.toByteArray
@ -140,7 +140,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
case Right(instance) instance.asInstanceOf[() Actor] case Right(instance) instance.asInstanceOf[() Actor]
} }
val actorPath = ActorPath(remote.app, message.getActorAddress) val actorPath = ActorPath(remote.app, message.getActorPath)
val parent = actorPath.parent.ref val parent = actorPath.parent.ref
if (parent.isDefined) { if (parent.isDefined) {
@ -188,7 +188,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
Props( Props(
context { context {
case f: Function0[_] try { f() } finally { context.self.stop() } case f: Function0[_] try { f() } finally { context.self.stop() }
}).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Function0[Unit]]) }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) ! payloadFor(message, classOf[Function0[Unit]])
} }
// FIXME: handle real remote supervision // FIXME: handle real remote supervision
@ -197,7 +197,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
Props( Props(
context { context {
case f: Function0[_] try { sender ! f() } finally { context.self.stop() } case f: Function0[_] try { sender ! f() } finally { context.self.stop() }
}).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Function0[Any]]) }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) forward payloadFor(message, classOf[Function0[Any]])
} }
// FIXME: handle real remote supervision // FIXME: handle real remote supervision
@ -206,7 +206,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
Props( Props(
context { context {
case (fun: Function[_, _], param: Any) try { fun.asInstanceOf[Any Unit].apply(param) } finally { context.self.stop() } case (fun: Function[_, _], param: Any) try { fun.asInstanceOf[Any Unit].apply(param) } finally { context.self.stop() }
}).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]]) }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) ! payloadFor(message, classOf[Tuple2[Function1[Any, Unit], Any]])
} }
// FIXME: handle real remote supervision // FIXME: handle real remote supervision
@ -215,7 +215,7 @@ class RemoteSystemDaemon(remote: Remote) extends Actor {
Props( Props(
context { context {
case (fun: Function[_, _], param: Any) try { sender ! fun.asInstanceOf[Any Any](param) } finally { context.self.stop() } case (fun: Function[_, _], param: Any) try { sender ! fun.asInstanceOf[Any Any](param) } finally { context.self.stop() }
}).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomAddress, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]]) }).copy(dispatcher = computeGridDispatcher), app.guardian, app.guardian.path / Props.randomName, systemService = true) forward payloadFor(message, classOf[Tuple2[Function1[Any, Any], Any]])
} }
def handleFailover(message: RemoteSystemDaemonMessageProtocol) { def handleFailover(message: RemoteSystemDaemonMessageProtocol) {
@ -235,11 +235,11 @@ class RemoteMessage(input: RemoteMessageProtocol, remote: RemoteSupport, classLo
lazy val sender: ActorRef = lazy val sender: ActorRef =
if (input.hasSender) if (input.hasSender)
remote.app.provider.deserialize( remote.app.provider.deserialize(
SerializedActorRef(input.getSender.getHost, input.getSender.getPort, input.getSender.getAddress)).getOrElse(throw new IllegalStateException("OHNOES")) SerializedActorRef(input.getSender.getHost, input.getSender.getPort, input.getSender.getPath)).getOrElse(throw new IllegalStateException("OHNOES"))
else else
remote.app.deadLetters remote.app.deadLetters
lazy val recipient: ActorRef = remote.app.actorFor(input.getRecipient.getAddress).getOrElse(remote.app.deadLetters) lazy val recipient: ActorRef = remote.app.actorFor(input.getRecipient.getPath).getOrElse(remote.app.deadLetters)
lazy val payload: Either[Throwable, AnyRef] = lazy val payload: Either[Throwable, AnyRef] =
if (input.hasException) Left(parseException()) if (input.hasException) Left(parseException())
@ -261,7 +261,7 @@ class RemoteMessage(input: RemoteMessageProtocol, remote: RemoteSupport, classLo
} }
} }
override def toString = "RemoteMessage: " + recipient + "(" + input.getRecipient.getAddress + ") from " + sender override def toString = "RemoteMessage: " + recipient + "(" + input.getRecipient.getPath + ") from " + sender
} }
trait RemoteMarshallingOps { trait RemoteMarshallingOps {
@ -285,7 +285,7 @@ trait RemoteMarshallingOps {
*/ */
def toRemoteActorRefProtocol(actor: ActorRef): ActorRefProtocol = { def toRemoteActorRefProtocol(actor: ActorRef): ActorRefProtocol = {
val rep = app.provider.serialize(actor) val rep = app.provider.serialize(actor)
ActorRefProtocol.newBuilder.setHost(rep.hostname).setPort(rep.port).setAddress(rep.path).build ActorRefProtocol.newBuilder.setHost(rep.hostname).setPort(rep.port).setPath(rep.path).build
} }
def createRemoteMessageProtocolBuilder( def createRemoteMessageProtocolBuilder(

View file

@ -198,7 +198,7 @@ class RemoteActorRefProvider(val app: AkkaApplication) extends ActorRefProvider
val command = RemoteSystemDaemonMessageProtocol.newBuilder val command = RemoteSystemDaemonMessageProtocol.newBuilder
.setMessageType(USE) .setMessageType(USE)
.setActorAddress(actorPath) .setActorPath(actorPath)
.setPayload(ByteString.copyFrom(actorFactoryBytes)) .setPayload(ByteString.copyFrom(actorFactoryBytes))
.build() .build()

View file

@ -41,25 +41,25 @@ class TestActorRef[T <: Actor](_app: AkkaApplication, _props: Props, _supervisor
object TestActorRef { object TestActorRef {
def apply[T <: Actor](factory: T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomAddress) def apply[T <: Actor](factory: T)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), Props.randomName)
def apply[T <: Actor](factory: T, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), address) def apply[T <: Actor](factory: T, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](Props(factory), name)
def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomAddress) def apply[T <: Actor](props: Props)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, Props.randomName)
def apply[T <: Actor](props: Props, address: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, address) def apply[T <: Actor](props: Props, name: String)(implicit app: AkkaApplication): TestActorRef[T] = apply[T](props, app.guardian, name)
def apply[T <: Actor](props: Props, supervisor: ActorRef, address: String)(implicit app: AkkaApplication): TestActorRef[T] = { def apply[T <: Actor](props: Props, supervisor: ActorRef, givenName: String)(implicit app: AkkaApplication): TestActorRef[T] = {
val name: String = address match { val name: String = givenName match {
case null | Props.randomAddress newUuid.toString case null | Props.randomName newUuid.toString
case given given case given given
} }
new TestActorRef(app, props, supervisor, name) new TestActorRef(app, props, supervisor, name)
} }
def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomAddress) def apply[T <: Actor](implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props.randomName)
def apply[T <: Actor](address: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({ def apply[T <: Actor](name: String)(implicit m: Manifest[T], app: AkkaApplication): TestActorRef[T] = apply[T](Props({
import ReflectiveAccess.{ createInstance, noParams, noArgs } import ReflectiveAccess.{ createInstance, noParams, noArgs }
createInstance[T](m.erasure, noParams, noArgs) match { createInstance[T](m.erasure, noParams, noArgs) match {
case Right(value) value case Right(value) value
@ -69,5 +69,5 @@ object TestActorRef {
"\nif so put it outside the class/trait, f.e. in a companion object," + "\nif so put it outside the class/trait, f.e. in a companion object," +
"\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'.", exception) "\nOR try to change: 'actorOf[MyActor]' to 'actorOf(new MyActor)'.", exception)
} }
}), address) }), name)
} }

View file

@ -34,8 +34,8 @@ import akka.AkkaApplication
* @author Roland Kuhn * @author Roland Kuhn
* @since 1.2 * @since 1.2
*/ */
class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, supervisor: ActorRef, address: String)(implicit ev: T <:< FSM[S, D]) class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, supervisor: ActorRef, name: String)(implicit ev: T <:< FSM[S, D])
extends TestActorRef(app, props, supervisor, address) { extends TestActorRef(app, props, supervisor, name) {
private def fsm: T = underlyingActor private def fsm: T = underlyingActor
@ -81,8 +81,8 @@ class TestFSMRef[S, D, T <: Actor](app: AkkaApplication, props: Props, superviso
object TestFSMRef { object TestFSMRef {
def apply[S, D, T <: Actor](factory: T)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = def apply[S, D, T <: Actor](factory: T)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] =
new TestFSMRef(app, Props(creator = () factory), app.guardian, Props.randomAddress) new TestFSMRef(app, Props(creator = () factory), app.guardian, Props.randomName)
def apply[S, D, T <: Actor](factory: T, address: String)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] = def apply[S, D, T <: Actor](factory: T, name: String)(implicit ev: T <:< FSM[S, D], app: AkkaApplication): TestFSMRef[S, D, T] =
new TestFSMRef(app, Props(creator = () factory), app.guardian, address) new TestFSMRef(app, Props(creator = () factory), app.guardian, name)
} }