Aaaaalmost there...

This commit is contained in:
Viktor Klang 2010-09-17 16:04:25 +02:00
parent f9203d99f4
commit 8464fd5251
24 changed files with 448 additions and 296 deletions

View file

@ -67,7 +67,7 @@ trait ActorRef extends
java.lang.Comparable[ActorRef] { scalaRef: ScalaActorRef => java.lang.Comparable[ActorRef] { scalaRef: ScalaActorRef =>
// Only mutable for RemoteServer in order to maintain identity across nodes // Only mutable for RemoteServer in order to maintain identity across nodes
@volatile protected[akka] var _uuid = UUID.newUuid.toString @volatile protected[akka] var _uuid = newUuid
@volatile protected[this] var _isRunning = false @volatile protected[this] var _isRunning = false
@volatile protected[this] var _isShutDown = false @volatile protected[this] var _isShutDown = false
@volatile protected[akka] var _isBeingRestarted = false @volatile protected[akka] var _isBeingRestarted = false
@ -86,7 +86,7 @@ trait ActorRef extends
* that you can use a custom name to be able to retrieve the "correct" persisted state * that you can use a custom name to be able to retrieve the "correct" persisted state
* upon restart, remote restart etc. * upon restart, remote restart etc.
*/ */
@BeanProperty @volatile var id: String = _uuid @BeanProperty @volatile var id: String = _uuid.toString
/** /**
* User overridable callback/setting. * User overridable callback/setting.
@ -204,7 +204,7 @@ trait ActorRef extends
/** /**
* Comparison only takes uuid into account. * Comparison only takes uuid into account.
*/ */
def compareTo(other: ActorRef) = this.uuid.compareTo(other.uuid) def compareTo(other: ActorRef) = this.uuid compareTo other.uuid
/** /**
* Returns the uuid for the actor. * Returns the uuid for the actor.
@ -249,7 +249,7 @@ trait ActorRef extends
/** /**
* Only for internal use. UUID is effectively final. * Only for internal use. UUID is effectively final.
*/ */
protected[akka] def uuid_=(uid: String) = _uuid = uid protected[akka] def uuid_=(uid: Uuid) = _uuid = uid
/** /**
* Akka Java API * Akka Java API
@ -605,9 +605,9 @@ trait ActorRef extends
protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit
protected[akka] def registerSupervisorAsRemoteActor: Option[String] protected[akka] def registerSupervisorAsRemoteActor: Option[Uuid]
protected[akka] def linkedActors: JMap[String, ActorRef] protected[akka] def linkedActors: JMap[Uuid, ActorRef]
protected[akka] def linkedActorsAsList: List[ActorRef] protected[akka] def linkedActorsAsList: List[ActorRef]
@ -648,7 +648,7 @@ class LocalActorRef private[akka](
extends ActorRef with ScalaActorRef { extends ActorRef with ScalaActorRef {
@volatile private[akka] var _remoteAddress: Option[InetSocketAddress] = None // only mutable to maintain identity across nodes @volatile private[akka] var _remoteAddress: Option[InetSocketAddress] = None // only mutable to maintain identity across nodes
@volatile private[akka] var _linkedActors: Option[ConcurrentHashMap[String, ActorRef]] = None @volatile private[akka] var _linkedActors: Option[ConcurrentHashMap[Uuid, ActorRef]] = None
@volatile private[akka] var _supervisor: Option[ActorRef] = None @volatile private[akka] var _supervisor: Option[ActorRef] = None
@volatile private var isInInitialization = false @volatile private var isInInitialization = false
@volatile private var runActorInitialization = false @volatile private var runActorInitialization = false
@ -670,7 +670,7 @@ class LocalActorRef private[akka](
private[akka] def this(factory: () => Actor) = this(Right(Some(factory))) private[akka] def this(factory: () => Actor) = this(Right(Some(factory)))
// used only for deserialization // used only for deserialization
private[akka] def this(__uuid: String, private[akka] def this(__uuid: Uuid,
__id: String, __id: String,
__hostname: String, __hostname: String,
__port: Int, __port: Int,
@ -1096,7 +1096,7 @@ class LocalActorRef private[akka](
} }
} }
protected[akka] def registerSupervisorAsRemoteActor: Option[String] = guard.withGuard { protected[akka] def registerSupervisorAsRemoteActor: Option[Uuid] = guard.withGuard {
ensureRemotingEnabled ensureRemotingEnabled
if (_supervisor.isDefined) { if (_supervisor.isDefined) {
remoteAddress.foreach(address => RemoteClientModule.registerSupervisorForActor(address, this)) remoteAddress.foreach(address => RemoteClientModule.registerSupervisorForActor(address, this))
@ -1104,9 +1104,9 @@ class LocalActorRef private[akka](
} else None } else None
} }
protected[akka] def linkedActors: JMap[String, ActorRef] = guard.withGuard { protected[akka] def linkedActors: JMap[Uuid, ActorRef] = guard.withGuard {
if (_linkedActors.isEmpty) { if (_linkedActors.isEmpty) {
val actors = new ConcurrentHashMap[String, ActorRef] val actors = new ConcurrentHashMap[Uuid, ActorRef]
_linkedActors = Some(actors) _linkedActors = Some(actors)
actors actors
} else _linkedActors.get } else _linkedActors.get
@ -1391,7 +1391,7 @@ private[akka] case class RemoteActorRef private[akka] (
*/ */
def actorClassName: String = className def actorClassName: String = className
protected[akka] def registerSupervisorAsRemoteActor: Option[String] = None protected[akka] def registerSupervisorAsRemoteActor: Option[Uuid] = None
val remoteAddress: Option[InetSocketAddress] = Some(new InetSocketAddress(hostname, port)) val remoteAddress: Option[InetSocketAddress] = Some(new InetSocketAddress(hostname, port))
@ -1420,7 +1420,7 @@ private[akka] case class RemoteActorRef private[akka] (
protected[akka] def handleTrapExit(dead: ActorRef, reason: Throwable): Unit = unsupported protected[akka] def handleTrapExit(dead: ActorRef, reason: Throwable): Unit = unsupported
protected[akka] def restart(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported protected[akka] def restart(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported
protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported
protected[akka] def linkedActors: JMap[String, ActorRef] = unsupported protected[akka] def linkedActors: JMap[Uuid, ActorRef] = unsupported
protected[akka] def linkedActorsAsList: List[ActorRef] = unsupported protected[akka] def linkedActorsAsList: List[ActorRef] = unsupported
protected[akka] def invoke(messageHandle: MessageInvocation): Unit = unsupported protected[akka] def invoke(messageHandle: MessageInvocation): Unit = unsupported
protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported
@ -1443,7 +1443,7 @@ trait ActorRefShared {
/** /**
* Returns the uuid for the actor. * Returns the uuid for the actor.
*/ */
def uuid: String def uuid: Uuid
/** /**
* Shuts down and removes all linked actors. * Shuts down and removes all linked actors.

View file

@ -35,7 +35,7 @@ case class ActorUnregistered(actor: ActorRef) extends ActorRegistryEvent
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a> * @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/ */
object ActorRegistry extends ListenerManagement { object ActorRegistry extends ListenerManagement {
private val actorsByUUID = new ConcurrentHashMap[String, ActorRef] private val actorsByUUID = new ConcurrentHashMap[Uuid, ActorRef]
private val actorsById = new Index[String,ActorRef] private val actorsById = new Index[String,ActorRef]
/** /**
@ -112,7 +112,7 @@ object ActorRegistry extends ListenerManagement {
/** /**
* Finds the actor that has a specific UUID. * Finds the actor that has a specific UUID.
*/ */
def actorFor(uuid: String): Option[ActorRef] = Option(actorsByUUID get uuid) def actorFor(uuid: Uuid): Option[ActorRef] = Option(actorsByUUID get uuid)
/** /**
* Registers an actor in the ActorRegistry. * Registers an actor in the ActorRegistry.

View file

@ -12,4 +12,9 @@ package object actor {
implicit def scala2ActorRef(ref: ScalaActorRef): ActorRef = implicit def scala2ActorRef(ref: ScalaActorRef): ActorRef =
ref.asInstanceOf[ActorRef] ref.asInstanceOf[ActorRef]
type Uuid = com.eaio.uuid.UUID
def newUuid(): Uuid = new Uuid()
def uuidFrom(time: Long, clockSeqAndNode: Long): Uuid = new Uuid(time,clockSeqAndNode)
def uuidFrom(uuid: String) = new Uuid(uuid)
} }

View file

@ -9,7 +9,8 @@ import se.scalablesolutions.akka.config.Config.config
import net.lag.configgy.ConfigMap import net.lag.configgy.ConfigMap
import java.util.concurrent.ThreadPoolExecutor.{AbortPolicy, CallerRunsPolicy, DiscardOldestPolicy, DiscardPolicy} import java.util.concurrent.ThreadPoolExecutor.{AbortPolicy, CallerRunsPolicy, DiscardOldestPolicy, DiscardPolicy}
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import se.scalablesolutions.akka.util.{Duration, Logging, UUID} import se.scalablesolutions.akka.util.{Duration, Logging}
import se.scalablesolutions.akka.actor.newUuid
/** /**
* Scala API. Dispatcher factory. * Scala API. Dispatcher factory.
@ -171,7 +172,7 @@ object Dispatchers extends Logging {
* Throws: IllegalArgumentException if the value of "type" is not valid * Throws: IllegalArgumentException if the value of "type" is not valid
*/ */
def from(cfg: ConfigMap): Option[MessageDispatcher] = { def from(cfg: ConfigMap): Option[MessageDispatcher] = {
lazy val name = cfg.getString("name", UUID.newUuid.toString) lazy val name = cfg.getString("name", newUuid.toString)
def threadPoolConfig(b: ThreadPoolBuilder) { def threadPoolConfig(b: ThreadPoolBuilder) {
b.configureIfPossible( builder => { b.configureIfPossible( builder => {

View file

@ -10,7 +10,7 @@ import org.multiverse.commitbarriers.CountDownCommitBarrier
import se.scalablesolutions.akka.AkkaException import se.scalablesolutions.akka.AkkaException
import java.util.{Queue, List} import java.util.{Queue, List}
import java.util.concurrent._ import java.util.concurrent._
import concurrent.forkjoin.LinkedTransferQueue import se.scalablesolutions.akka.actor.Uuid
import se.scalablesolutions.akka.util.{SimpleLock, Duration, HashCode, Logging} import se.scalablesolutions.akka.util.{SimpleLock, Duration, HashCode, Logging}
/** /**
@ -119,7 +119,7 @@ class DefaultBoundedMessageQueue(capacity: Int, pushTimeOut: Option[Duration], b
* @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a> * @author <a href="http://jonasboner.com">Jonas Bon&#233;r</a>
*/ */
trait MessageDispatcher extends Logging { trait MessageDispatcher extends Logging {
protected val uuids = new ConcurrentSkipListSet[String] protected val uuids = new ConcurrentSkipListSet[Uuid]
def dispatch(invocation: MessageInvocation) def dispatch(invocation: MessageInvocation)

View file

@ -4,7 +4,7 @@
package se.scalablesolutions.akka.stm package se.scalablesolutions.akka.stm
import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.actor.{newUuid, Uuid}
import org.multiverse.transactional.refs.BasicRef import org.multiverse.transactional.refs.BasicRef
@ -34,7 +34,7 @@ class Ref[T](initialValue: T) extends BasicRef[T](initialValue) with Transaction
def this() = this(null.asInstanceOf[T]) def this() = this(null.asInstanceOf[T])
val uuid = UUID.newUuid.toString val uuid = newUuid.toString
def swap(elem: T) = set(elem) def swap(elem: T) = set(elem)

View file

@ -6,7 +6,7 @@ package se.scalablesolutions.akka.stm
import scala.collection.immutable.HashMap import scala.collection.immutable.HashMap
import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.actor.{newUuid}
import org.multiverse.api.ThreadLocalTransaction.getThreadLocalTransaction import org.multiverse.api.ThreadLocalTransaction.getThreadLocalTransaction
@ -24,7 +24,7 @@ object TransactionalMap {
class TransactionalMap[K, V](initialValue: HashMap[K, V]) extends Transactional with scala.collection.mutable.Map[K, V] { class TransactionalMap[K, V](initialValue: HashMap[K, V]) extends Transactional with scala.collection.mutable.Map[K, V] {
def this() = this(HashMap[K, V]()) def this() = this(HashMap[K, V]())
val uuid = UUID.newUuid.toString val uuid = newUuid.toString
private[this] val ref = Ref(initialValue) private[this] val ref = Ref(initialValue)

View file

@ -6,7 +6,7 @@ package se.scalablesolutions.akka.stm
import scala.collection.immutable.Vector import scala.collection.immutable.Vector
import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.actor.newUuid
import org.multiverse.api.ThreadLocalTransaction.getThreadLocalTransaction import org.multiverse.api.ThreadLocalTransaction.getThreadLocalTransaction
@ -24,7 +24,7 @@ object TransactionalVector {
class TransactionalVector[T](initialValue: Vector[T]) extends Transactional with IndexedSeq[T] { class TransactionalVector[T](initialValue: Vector[T]) extends Transactional with IndexedSeq[T] {
def this() = this(Vector[T]()) def this() = this(Vector[T]())
val uuid = UUID.newUuid.toString val uuid = newUuid.toString
private[this] val ref = Ref(initialValue) private[this] val ref = Ref(initialValue)

View file

@ -4,7 +4,8 @@
package se.scalablesolutions.akka package se.scalablesolutions.akka
import se.scalablesolutions.akka.util.{UUID, Logging} import se.scalablesolutions.akka.util.Logging
import se.scalablesolutions.akka.actor.newUuid
import java.io.{StringWriter, PrintWriter} import java.io.{StringWriter, PrintWriter}
import java.net.{InetAddress, UnknownHostException} import java.net.{InetAddress, UnknownHostException}
@ -23,7 +24,7 @@ import java.net.{InetAddress, UnknownHostException}
import AkkaException._ import AkkaException._
val exceptionName = getClass.getName val exceptionName = getClass.getName
val uuid = "%s_%s".format(hostname, UUID.newUuid.toString) val uuid = "%s_%s".format(hostname, newUuid)
override val toString = "%s\n\t[%s]\n\t%s\n\t%s".format(exceptionName, uuid, message, stackTrace) override val toString = "%s\n\t[%s]\n\t%s\n\t%s".format(exceptionName, uuid, message, stackTrace)

View file

@ -7,7 +7,7 @@ package se.scalablesolutions.akka.util
import se.scalablesolutions.akka.actor.{ActorRef, IllegalActorStateException, ActorType} import se.scalablesolutions.akka.actor.{ActorRef, IllegalActorStateException, ActorType}
import se.scalablesolutions.akka.dispatch.{Future, CompletableFuture} import se.scalablesolutions.akka.dispatch.{Future, CompletableFuture}
import se.scalablesolutions.akka.config.{Config, ModuleNotAvailableException} import se.scalablesolutions.akka.config.{Config, ModuleNotAvailableException}
import se.scalablesolutions.akka.actor.Uuid
import java.net.InetSocketAddress import java.net.InetSocketAddress
import se.scalablesolutions.akka.stm.Transaction import se.scalablesolutions.akka.stm.Transaction
import se.scalablesolutions.akka.AkkaException import se.scalablesolutions.akka.AkkaException
@ -51,8 +51,8 @@ object ReflectiveAccess {
} }
type RemoteClientObject = { type RemoteClientObject = {
def register(hostname: String, port: Int, uuid: String): Unit def register(hostname: String, port: Int, uuid: Uuid): Unit
def unregister(hostname: String, port: Int, uuid: String): Unit def unregister(hostname: String, port: Int, uuid: Uuid): Unit
def clientFor(address: InetSocketAddress): RemoteClient def clientFor(address: InetSocketAddress): RemoteClient
def clientFor(hostname: String, port: Int, loader: Option[ClassLoader]): RemoteClient def clientFor(hostname: String, port: Int, loader: Option[ClassLoader]): RemoteClient
} }
@ -65,12 +65,12 @@ object ReflectiveAccess {
val remoteClientObjectInstance: Option[RemoteClientObject] = val remoteClientObjectInstance: Option[RemoteClientObject] =
getObject("se.scalablesolutions.akka.remote.RemoteClient$") getObject("se.scalablesolutions.akka.remote.RemoteClient$")
def register(address: InetSocketAddress, uuid: String) = { def register(address: InetSocketAddress, uuid: Uuid) = {
ensureRemotingEnabled ensureRemotingEnabled
remoteClientObjectInstance.get.register(address.getHostName, address.getPort, uuid) remoteClientObjectInstance.get.register(address.getHostName, address.getPort, uuid)
} }
def unregister(address: InetSocketAddress, uuid: String) = { def unregister(address: InetSocketAddress, uuid: Uuid) = {
ensureRemotingEnabled ensureRemotingEnabled
remoteClientObjectInstance.get.unregister(address.getHostName, address.getPort, uuid) remoteClientObjectInstance.get.unregister(address.getHostName, address.getPort, uuid)
} }
@ -112,7 +112,7 @@ object ReflectiveAccess {
val PORT = Config.config.getInt("akka.remote.server.port", 9999) val PORT = Config.config.getInt("akka.remote.server.port", 9999)
type RemoteServerObject = { type RemoteServerObject = {
def registerActor(address: InetSocketAddress, uuid: String, actor: ActorRef): Unit def registerActor(address: InetSocketAddress, uuid: Uuid, actor: ActorRef): Unit
def registerTypedActor(address: InetSocketAddress, name: String, typedActor: AnyRef): Unit def registerTypedActor(address: InetSocketAddress, name: String, typedActor: AnyRef): Unit
} }
@ -126,7 +126,7 @@ object ReflectiveAccess {
val remoteNodeObjectInstance: Option[RemoteNodeObject] = val remoteNodeObjectInstance: Option[RemoteNodeObject] =
getObject("se.scalablesolutions.akka.remote.RemoteNode$") getObject("se.scalablesolutions.akka.remote.RemoteNode$")
def registerActor(address: InetSocketAddress, uuid: String, actorRef: ActorRef) = { def registerActor(address: InetSocketAddress, uuid: Uuid, actorRef: ActorRef) = {
ensureRemotingEnabled ensureRemotingEnabled
remoteServerObjectInstance.get.registerActor(address, uuid, actorRef) remoteServerObjectInstance.get.registerActor(address, uuid, actorRef)
} }

View file

@ -1,9 +0,0 @@
/**
* Copyright (C) 2009-2010 Scalable Solutions AB <http://scalablesolutions.se>
*/
package se.scalablesolutions.akka.util
object UUID {
def newUuid = new com.eaio.uuid.UUID()
}

View file

@ -10,7 +10,7 @@ import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger}
object ExecutorBasedEventDrivenDispatcherActorSpec { object ExecutorBasedEventDrivenDispatcherActorSpec {
class TestActor extends Actor { class TestActor extends Actor {
self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid) self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid.toString)
def receive = { def receive = {
case "Hello" => case "Hello" =>
self.reply("World") self.reply("World")
@ -23,7 +23,7 @@ object ExecutorBasedEventDrivenDispatcherActorSpec {
val oneWay = new CountDownLatch(1) val oneWay = new CountDownLatch(1)
} }
class OneWayTestActor extends Actor { class OneWayTestActor extends Actor {
self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid) self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid.toString)
def receive = { def receive = {
case "OneWay" => OneWayTestActor.oneWay.countDown case "OneWay" => OneWayTestActor.oneWay.countDown
} }

View file

@ -31,7 +31,7 @@ private[camel] object ConsumerPublisher extends Logging {
* Stops route to the already un-registered consumer actor. * Stops route to the already un-registered consumer actor.
*/ */
def handleConsumerUnregistered(event: ConsumerUnregistered) { def handleConsumerUnregistered(event: ConsumerUnregistered) {
CamelContextManager.context.stopRoute(event.uuid) CamelContextManager.context.stopRoute(event.uuid.toString)
log.info("unpublished actor %s from endpoint %s" format (event.actorRef, event.uri)) log.info("unpublished actor %s from endpoint %s" format (event.actorRef, event.uri))
} }
@ -143,7 +143,7 @@ private[camel] abstract class ConsumerRoute(endpointUri: String, id: String) ext
* *
* @author Martin Krasser * @author Martin Krasser
*/ */
private[camel] class ConsumerActorRoute(endpointUri: String, uuid: String, blocking: Boolean) extends ConsumerRoute(endpointUri, uuid) { private[camel] class ConsumerActorRoute(endpointUri: String, uuid: Uuid, blocking: Boolean) extends ConsumerRoute(endpointUri, uuid.toString) {
protected override def targetUri = "actor:uuid:%s?blocking=%s" format (uuid, blocking) protected override def targetUri = "actor:uuid:%s?blocking=%s" format (uuid, blocking)
} }
@ -229,7 +229,7 @@ private[camel] sealed trait ConsumerEvent
* *
* @author Martin Krasser * @author Martin Krasser
*/ */
private[camel] case class ConsumerRegistered(actorRef: ActorRef, uri: String, uuid: String, blocking: Boolean) extends ConsumerEvent private[camel] case class ConsumerRegistered(actorRef: ActorRef, uri: String, uuid: Uuid, blocking: Boolean) extends ConsumerEvent
/** /**
* Event indicating that a consumer actor has been unregistered from the actor registry. * Event indicating that a consumer actor has been unregistered from the actor registry.
@ -240,7 +240,7 @@ private[camel] case class ConsumerRegistered(actorRef: ActorRef, uri: String, uu
* *
* @author Martin Krasser * @author Martin Krasser
*/ */
private[camel] case class ConsumerUnregistered(actorRef: ActorRef, uri: String, uuid: String) extends ConsumerEvent private[camel] case class ConsumerUnregistered(actorRef: ActorRef, uri: String, uuid: Uuid) extends ConsumerEvent
/** /**
* Event indicating that an typed actor proxy has been created for a typed actor. For each <code>@consume</code> * Event indicating that an typed actor proxy has been created for a typed actor. For each <code>@consume</code>

View file

@ -18,7 +18,7 @@ import se.scalablesolutions.akka.camel.{Failure, CamelMessageConversion, Message
import CamelMessageConversion.toExchangeAdapter import CamelMessageConversion.toExchangeAdapter
import se.scalablesolutions.akka.dispatch.{CompletableFuture, MessageInvocation, MessageDispatcher} import se.scalablesolutions.akka.dispatch.{CompletableFuture, MessageInvocation, MessageDispatcher}
import se.scalablesolutions.akka.stm.TransactionConfig import se.scalablesolutions.akka.stm.TransactionConfig
import se.scalablesolutions.akka.actor.{ScalaActorRef, ActorRegistry, Actor, ActorRef} import se.scalablesolutions.akka.actor.{ScalaActorRef, ActorRegistry, Actor, ActorRef, Uuid, uuidFrom}
import se.scalablesolutions.akka.AkkaException import se.scalablesolutions.akka.AkkaException
import scala.reflect.BeanProperty import scala.reflect.BeanProperty
@ -37,11 +37,11 @@ class ActorComponent extends DefaultComponent {
new ActorEndpoint(uri, this, idAndUuid._1, idAndUuid._2) new ActorEndpoint(uri, this, idAndUuid._1, idAndUuid._2)
} }
private def idAndUuidPair(remaining: String): Tuple2[Option[String], Option[String]] = { private def idAndUuidPair(remaining: String): Tuple2[Option[String], Option[Uuid]] = {
remaining split ":" toList match { remaining split ":" toList match {
case id :: Nil => (Some(id), None) case id :: Nil => (Some(id), None)
case "id" :: id :: Nil => (Some(id), None) case "id" :: id :: Nil => (Some(id), None)
case "uuid" :: uuid :: Nil => (None, Some(uuid)) case "uuid" :: uuid :: Nil => (None, Some(uuidFrom(uuid)))
case _ => throw new IllegalArgumentException( case _ => throw new IllegalArgumentException(
"invalid path format: %s - should be <actorid> or id:<actorid> or uuid:<actoruuid>" format remaining) "invalid path format: %s - should be <actorid> or id:<actorid> or uuid:<actoruuid>" format remaining)
} }
@ -64,7 +64,7 @@ class ActorComponent extends DefaultComponent {
class ActorEndpoint(uri: String, class ActorEndpoint(uri: String,
comp: ActorComponent, comp: ActorComponent,
val id: Option[String], val id: Option[String],
val uuid: Option[String]) extends DefaultEndpoint(uri, comp) { val uuid: Option[Uuid]) extends DefaultEndpoint(uri, comp) {
/** /**
* Blocking of caller thread during two-way message exchanges with consumer actors. This is set * Blocking of caller thread during two-way message exchanges with consumer actors. This is set
@ -151,7 +151,7 @@ class ActorProducer(val ep: ActorEndpoint) extends DefaultProducer(ep) with Asyn
case actors => Some(actors(0)) case actors => Some(actors(0))
} }
private def targetByUuid(uuid: String) = ActorRegistry.actorFor(uuid) private def targetByUuid(uuid: Uuid) = ActorRegistry.actorFor(uuid)
} }
/** /**
@ -250,7 +250,7 @@ private[akka] class AsyncCallbackAdapter(exchange: Exchange, callback: AsyncCall
protected[akka] def restart(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported protected[akka] def restart(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported
protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported protected[akka] def restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): Unit = unsupported
protected[akka] def handleTrapExit(dead: ActorRef, reason: Throwable): Unit = unsupported protected[akka] def handleTrapExit(dead: ActorRef, reason: Throwable): Unit = unsupported
protected[akka] def linkedActors: JavaMap[String, ActorRef] = unsupported protected[akka] def linkedActors: JavaMap[Uuid, ActorRef] = unsupported
protected[akka] def linkedActorsAsList: List[ActorRef] = unsupported protected[akka] def linkedActorsAsList: List[ActorRef] = unsupported
protected[akka] def invoke(messageHandle: MessageInvocation): Unit = unsupported protected[akka] def invoke(messageHandle: MessageInvocation): Unit = unsupported
protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported

View file

@ -4,16 +4,16 @@
package se.scalablesolutions.akka.persistence.cassandra package se.scalablesolutions.akka.persistence.cassandra
import se.scalablesolutions.akka.util.UUID
import se.scalablesolutions.akka.stm._ import se.scalablesolutions.akka.stm._
import se.scalablesolutions.akka.persistence.common._ import se.scalablesolutions.akka.persistence.common._
import se.scalablesolutions.akka.actor.{newUuid}
object CassandraStorage extends Storage { object CassandraStorage extends Storage {
type ElementType = Array[Byte] type ElementType = Array[Byte]
def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString)
def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) def newVector: PersistentVector[ElementType] = newVector(newUuid.toString)
def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) def newRef: PersistentRef[ElementType] = newRef(newUuid.toString)
def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id)
def getVector(id: String): PersistentVector[ElementType] = newVector(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id)

View file

@ -6,14 +6,14 @@ package se.scalablesolutions.akka.persistence.mongo
import se.scalablesolutions.akka.stm._ import se.scalablesolutions.akka.stm._
import se.scalablesolutions.akka.persistence.common._ import se.scalablesolutions.akka.persistence.common._
import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.actor.{newUuid}
object MongoStorage extends Storage { object MongoStorage extends Storage {
type ElementType = Array[Byte] type ElementType = Array[Byte]
def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString)
def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) def newVector: PersistentVector[ElementType] = newVector(newUuid.toString)
def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) def newRef: PersistentRef[ElementType] = newRef(newUuid.toString)
def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id)
def getVector(id: String): PersistentVector[ElementType] = newVector(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id)

View file

@ -4,18 +4,18 @@
package se.scalablesolutions.akka.persistence.redis package se.scalablesolutions.akka.persistence.redis
import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.actor.{newUuid}
import se.scalablesolutions.akka.stm._ import se.scalablesolutions.akka.stm._
import se.scalablesolutions.akka.persistence.common._ import se.scalablesolutions.akka.persistence.common._
object RedisStorage extends Storage { object RedisStorage extends Storage {
type ElementType = Array[Byte] type ElementType = Array[Byte]
def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString)
def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) def newVector: PersistentVector[ElementType] = newVector(newUuid.toString)
def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) def newRef: PersistentRef[ElementType] = newRef(newUuid.toString)
override def newQueue: PersistentQueue[ElementType] = newQueue(UUID.newUuid.toString) override def newQueue: PersistentQueue[ElementType] = newQueue(newUuid.toString)
override def newSortedSet: PersistentSortedSet[ElementType] = newSortedSet(UUID.newUuid.toString) override def newSortedSet: PersistentSortedSet[ElementType] = newSortedSet(newUuid.toString)
def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id)
def getVector(id: String): PersistentVector[ElementType] = newVector(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id)

View file

@ -244,12 +244,12 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteActorRefProtocol_fieldAccessorTable; return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteActorRefProtocol_fieldAccessorTable;
} }
// required string uuid = 1; // required string classOrServiceName = 1;
public static final int UUID_FIELD_NUMBER = 1; public static final int CLASSORSERVICENAME_FIELD_NUMBER = 1;
private boolean hasUuid; private boolean hasClassOrServiceName;
private java.lang.String uuid_ = ""; private java.lang.String classOrServiceName_ = "";
public boolean hasUuid() { return hasUuid; } public boolean hasClassOrServiceName() { return hasClassOrServiceName; }
public java.lang.String getUuid() { return uuid_; } public java.lang.String getClassOrServiceName() { return classOrServiceName_; }
// required string actorClassname = 2; // required string actorClassname = 2;
public static final int ACTORCLASSNAME_FIELD_NUMBER = 2; public static final int ACTORCLASSNAME_FIELD_NUMBER = 2;
@ -276,7 +276,7 @@ public final class RemoteProtocol {
homeAddress_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance(); homeAddress_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance();
} }
public final boolean isInitialized() { public final boolean isInitialized() {
if (!hasUuid) return false; if (!hasClassOrServiceName) return false;
if (!hasActorClassname) return false; if (!hasActorClassname) return false;
if (!hasHomeAddress) return false; if (!hasHomeAddress) return false;
if (!getHomeAddress().isInitialized()) return false; if (!getHomeAddress().isInitialized()) return false;
@ -286,8 +286,8 @@ public final class RemoteProtocol {
public void writeTo(com.google.protobuf.CodedOutputStream output) public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (hasUuid()) { if (hasClassOrServiceName()) {
output.writeString(1, getUuid()); output.writeString(1, getClassOrServiceName());
} }
if (hasActorClassname()) { if (hasActorClassname()) {
output.writeString(2, getActorClassname()); output.writeString(2, getActorClassname());
@ -307,9 +307,9 @@ public final class RemoteProtocol {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (hasUuid()) { if (hasClassOrServiceName()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeStringSize(1, getUuid()); .computeStringSize(1, getClassOrServiceName());
} }
if (hasActorClassname()) { if (hasActorClassname()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -481,8 +481,8 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol other) { public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol other) {
if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance()) return this; if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance()) return this;
if (other.hasUuid()) { if (other.hasClassOrServiceName()) {
setUuid(other.getUuid()); setClassOrServiceName(other.getClassOrServiceName());
} }
if (other.hasActorClassname()) { if (other.hasActorClassname()) {
setActorClassname(other.getActorClassname()); setActorClassname(other.getActorClassname());
@ -519,7 +519,7 @@ public final class RemoteProtocol {
break; break;
} }
case 10: { case 10: {
setUuid(input.readString()); setClassOrServiceName(input.readString());
break; break;
} }
case 18: { case 18: {
@ -544,24 +544,24 @@ public final class RemoteProtocol {
} }
// required string uuid = 1; // required string classOrServiceName = 1;
public boolean hasUuid() { public boolean hasClassOrServiceName() {
return result.hasUuid(); return result.hasClassOrServiceName();
} }
public java.lang.String getUuid() { public java.lang.String getClassOrServiceName() {
return result.getUuid(); return result.getClassOrServiceName();
} }
public Builder setUuid(java.lang.String value) { public Builder setClassOrServiceName(java.lang.String value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
result.hasUuid = true; result.hasClassOrServiceName = true;
result.uuid_ = value; result.classOrServiceName_ = value;
return this; return this;
} }
public Builder clearUuid() { public Builder clearClassOrServiceName() {
result.hasUuid = false; result.hasClassOrServiceName = false;
result.uuid_ = getDefaultInstance().getUuid(); result.classOrServiceName_ = getDefaultInstance().getClassOrServiceName();
return this; return this;
} }
@ -680,12 +680,12 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_SerializedActorRefProtocol_fieldAccessorTable; return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_SerializedActorRefProtocol_fieldAccessorTable;
} }
// required string uuid = 1; // required .UuidProtocol uuid = 1;
public static final int UUID_FIELD_NUMBER = 1; public static final int UUID_FIELD_NUMBER = 1;
private boolean hasUuid; private boolean hasUuid;
private java.lang.String uuid_ = ""; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_;
public boolean hasUuid() { return hasUuid; } public boolean hasUuid() { return hasUuid; }
public java.lang.String getUuid() { return uuid_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; }
// required string id = 2; // required string id = 2;
public static final int ID_FIELD_NUMBER = 2; public static final int ID_FIELD_NUMBER = 2;
@ -777,6 +777,7 @@ public final class RemoteProtocol {
} }
private void initFields() { private void initFields() {
uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
originalAddress_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance(); originalAddress_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance();
lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance(); lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance();
supervisor_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance(); supervisor_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance();
@ -786,6 +787,7 @@ public final class RemoteProtocol {
if (!hasId) return false; if (!hasId) return false;
if (!hasActorClassname) return false; if (!hasActorClassname) return false;
if (!hasOriginalAddress) return false; if (!hasOriginalAddress) return false;
if (!getUuid().isInitialized()) return false;
if (!getOriginalAddress().isInitialized()) return false; if (!getOriginalAddress().isInitialized()) return false;
if (hasLifeCycle()) { if (hasLifeCycle()) {
if (!getLifeCycle().isInitialized()) return false; if (!getLifeCycle().isInitialized()) return false;
@ -803,7 +805,7 @@ public final class RemoteProtocol {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (hasUuid()) { if (hasUuid()) {
output.writeString(1, getUuid()); output.writeMessage(1, getUuid());
} }
if (hasId()) { if (hasId()) {
output.writeString(2, getId()); output.writeString(2, getId());
@ -852,7 +854,7 @@ public final class RemoteProtocol {
size = 0; size = 0;
if (hasUuid()) { if (hasUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeStringSize(1, getUuid()); .computeMessageSize(1, getUuid());
} }
if (hasId()) { if (hasId()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -1065,7 +1067,7 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol other) { public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol other) {
if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol.getDefaultInstance()) return this; if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol.getDefaultInstance()) return this;
if (other.hasUuid()) { if (other.hasUuid()) {
setUuid(other.getUuid()); mergeUuid(other.getUuid());
} }
if (other.hasId()) { if (other.hasId()) {
setId(other.getId()); setId(other.getId());
@ -1132,7 +1134,12 @@ public final class RemoteProtocol {
break; break;
} }
case 10: { case 10: {
setUuid(input.readString()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasUuid()) {
subBuilder.mergeFrom(getUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setUuid(subBuilder.buildPartial());
break; break;
} }
case 18: { case 18: {
@ -1205,24 +1212,40 @@ public final class RemoteProtocol {
} }
// required string uuid = 1; // required .UuidProtocol uuid = 1;
public boolean hasUuid() { public boolean hasUuid() {
return result.hasUuid(); return result.hasUuid();
} }
public java.lang.String getUuid() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() {
return result.getUuid(); return result.getUuid();
} }
public Builder setUuid(java.lang.String value) { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
result.hasUuid = true; result.hasUuid = true;
result.uuid_ = value; result.uuid_ = value;
return this; return this;
} }
public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasUuid = true;
result.uuid_ = builderForValue.build();
return this;
}
public Builder mergeUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasUuid() &&
result.uuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.uuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.uuid_).mergeFrom(value).buildPartial();
} else {
result.uuid_ = value;
}
result.hasUuid = true;
return this;
}
public Builder clearUuid() { public Builder clearUuid() {
result.hasUuid = false; result.hasUuid = false;
result.uuid_ = getDefaultInstance().getUuid(); result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -1966,12 +1989,12 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ActorInfoProtocol_fieldAccessorTable; return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ActorInfoProtocol_fieldAccessorTable;
} }
// required string uuid = 1; // required .UuidProtocol uuid = 1;
public static final int UUID_FIELD_NUMBER = 1; public static final int UUID_FIELD_NUMBER = 1;
private boolean hasUuid; private boolean hasUuid;
private java.lang.String uuid_ = ""; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_;
public boolean hasUuid() { return hasUuid; } public boolean hasUuid() { return hasUuid; }
public java.lang.String getUuid() { return uuid_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; }
// required string target = 2; // required string target = 2;
public static final int TARGET_FIELD_NUMBER = 2; public static final int TARGET_FIELD_NUMBER = 2;
@ -2009,6 +2032,7 @@ public final class RemoteProtocol {
public java.lang.String getId() { return id_; } public java.lang.String getId() { return id_; }
private void initFields() { private void initFields() {
uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
actorType_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.SCALA_ACTOR; actorType_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.SCALA_ACTOR;
typedActorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance(); typedActorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance();
} }
@ -2017,6 +2041,7 @@ public final class RemoteProtocol {
if (!hasTarget) return false; if (!hasTarget) return false;
if (!hasTimeout) return false; if (!hasTimeout) return false;
if (!hasActorType) return false; if (!hasActorType) return false;
if (!getUuid().isInitialized()) return false;
if (hasTypedActorInfo()) { if (hasTypedActorInfo()) {
if (!getTypedActorInfo().isInitialized()) return false; if (!getTypedActorInfo().isInitialized()) return false;
} }
@ -2027,7 +2052,7 @@ public final class RemoteProtocol {
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (hasUuid()) { if (hasUuid()) {
output.writeString(1, getUuid()); output.writeMessage(1, getUuid());
} }
if (hasTarget()) { if (hasTarget()) {
output.writeString(2, getTarget()); output.writeString(2, getTarget());
@ -2055,7 +2080,7 @@ public final class RemoteProtocol {
size = 0; size = 0;
if (hasUuid()) { if (hasUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeStringSize(1, getUuid()); .computeMessageSize(1, getUuid());
} }
if (hasTarget()) { if (hasTarget()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -2236,7 +2261,7 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol other) { public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol other) {
if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance()) return this; if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance()) return this;
if (other.hasUuid()) { if (other.hasUuid()) {
setUuid(other.getUuid()); mergeUuid(other.getUuid());
} }
if (other.hasTarget()) { if (other.hasTarget()) {
setTarget(other.getTarget()); setTarget(other.getTarget());
@ -2279,7 +2304,12 @@ public final class RemoteProtocol {
break; break;
} }
case 10: { case 10: {
setUuid(input.readString()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasUuid()) {
subBuilder.mergeFrom(getUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setUuid(subBuilder.buildPartial());
break; break;
} }
case 18: { case 18: {
@ -2318,24 +2348,40 @@ public final class RemoteProtocol {
} }
// required string uuid = 1; // required .UuidProtocol uuid = 1;
public boolean hasUuid() { public boolean hasUuid() {
return result.hasUuid(); return result.hasUuid();
} }
public java.lang.String getUuid() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() {
return result.getUuid(); return result.getUuid();
} }
public Builder setUuid(java.lang.String value) { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
result.hasUuid = true; result.hasUuid = true;
result.uuid_ = value; result.uuid_ = value;
return this; return this;
} }
public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasUuid = true;
result.uuid_ = builderForValue.build();
return this;
}
public Builder mergeUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasUuid() &&
result.uuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.uuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.uuid_).mergeFrom(value).buildPartial();
} else {
result.uuid_ = value;
}
result.hasUuid = true;
return this;
}
public Builder clearUuid() { public Builder clearUuid() {
result.hasUuid = false; result.hasUuid = false;
result.uuid_ = getDefaultInstance().getUuid(); result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -2827,12 +2873,12 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteRequestProtocol_fieldAccessorTable; return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteRequestProtocol_fieldAccessorTable;
} }
// required uint64 id = 1; // required .UuidProtocol uuid = 1;
public static final int ID_FIELD_NUMBER = 1; public static final int UUID_FIELD_NUMBER = 1;
private boolean hasId; private boolean hasUuid;
private long id_ = 0L; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_;
public boolean hasId() { return hasId; } public boolean hasUuid() { return hasUuid; }
public long getId() { return id_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; }
// required .MessageProtocol message = 2; // required .MessageProtocol message = 2;
public static final int MESSAGE_FIELD_NUMBER = 2; public static final int MESSAGE_FIELD_NUMBER = 2;
@ -2855,12 +2901,12 @@ public final class RemoteProtocol {
public boolean hasIsOneWay() { return hasIsOneWay; } public boolean hasIsOneWay() { return hasIsOneWay; }
public boolean getIsOneWay() { return isOneWay_; } public boolean getIsOneWay() { return isOneWay_; }
// optional string supervisorUuid = 5; // optional .UuidProtocol supervisorUuid = 5;
public static final int SUPERVISORUUID_FIELD_NUMBER = 5; public static final int SUPERVISORUUID_FIELD_NUMBER = 5;
private boolean hasSupervisorUuid; private boolean hasSupervisorUuid;
private java.lang.String supervisorUuid_ = ""; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol supervisorUuid_;
public boolean hasSupervisorUuid() { return hasSupervisorUuid; } public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
public java.lang.String getSupervisorUuid() { return supervisorUuid_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getSupervisorUuid() { return supervisorUuid_; }
// optional .RemoteActorRefProtocol sender = 6; // optional .RemoteActorRefProtocol sender = 6;
public static final int SENDER_FIELD_NUMBER = 6; public static final int SENDER_FIELD_NUMBER = 6;
@ -2882,17 +2928,23 @@ public final class RemoteProtocol {
} }
private void initFields() { private void initFields() {
uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance(); message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance();
actorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance(); actorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance();
supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
sender_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance(); sender_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance();
} }
public final boolean isInitialized() { public final boolean isInitialized() {
if (!hasId) return false; if (!hasUuid) return false;
if (!hasMessage) return false; if (!hasMessage) return false;
if (!hasActorInfo) return false; if (!hasActorInfo) return false;
if (!hasIsOneWay) return false; if (!hasIsOneWay) return false;
if (!getUuid().isInitialized()) return false;
if (!getMessage().isInitialized()) return false; if (!getMessage().isInitialized()) return false;
if (!getActorInfo().isInitialized()) return false; if (!getActorInfo().isInitialized()) return false;
if (hasSupervisorUuid()) {
if (!getSupervisorUuid().isInitialized()) return false;
}
if (hasSender()) { if (hasSender()) {
if (!getSender().isInitialized()) return false; if (!getSender().isInitialized()) return false;
} }
@ -2905,8 +2957,8 @@ public final class RemoteProtocol {
public void writeTo(com.google.protobuf.CodedOutputStream output) public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (hasId()) { if (hasUuid()) {
output.writeUInt64(1, getId()); output.writeMessage(1, getUuid());
} }
if (hasMessage()) { if (hasMessage()) {
output.writeMessage(2, getMessage()); output.writeMessage(2, getMessage());
@ -2918,7 +2970,7 @@ public final class RemoteProtocol {
output.writeBool(4, getIsOneWay()); output.writeBool(4, getIsOneWay());
} }
if (hasSupervisorUuid()) { if (hasSupervisorUuid()) {
output.writeString(5, getSupervisorUuid()); output.writeMessage(5, getSupervisorUuid());
} }
if (hasSender()) { if (hasSender()) {
output.writeMessage(6, getSender()); output.writeMessage(6, getSender());
@ -2935,9 +2987,9 @@ public final class RemoteProtocol {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (hasId()) { if (hasUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(1, getId()); .computeMessageSize(1, getUuid());
} }
if (hasMessage()) { if (hasMessage()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -2953,7 +3005,7 @@ public final class RemoteProtocol {
} }
if (hasSupervisorUuid()) { if (hasSupervisorUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeStringSize(5, getSupervisorUuid()); .computeMessageSize(5, getSupervisorUuid());
} }
if (hasSender()) { if (hasSender()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -3125,8 +3177,8 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol other) { public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol other) {
if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.getDefaultInstance()) return this; if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.getDefaultInstance()) return this;
if (other.hasId()) { if (other.hasUuid()) {
setId(other.getId()); mergeUuid(other.getUuid());
} }
if (other.hasMessage()) { if (other.hasMessage()) {
mergeMessage(other.getMessage()); mergeMessage(other.getMessage());
@ -3138,7 +3190,7 @@ public final class RemoteProtocol {
setIsOneWay(other.getIsOneWay()); setIsOneWay(other.getIsOneWay());
} }
if (other.hasSupervisorUuid()) { if (other.hasSupervisorUuid()) {
setSupervisorUuid(other.getSupervisorUuid()); mergeSupervisorUuid(other.getSupervisorUuid());
} }
if (other.hasSender()) { if (other.hasSender()) {
mergeSender(other.getSender()); mergeSender(other.getSender());
@ -3174,8 +3226,13 @@ public final class RemoteProtocol {
} }
break; break;
} }
case 8: { case 10: {
setId(input.readUInt64()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasUuid()) {
subBuilder.mergeFrom(getUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setUuid(subBuilder.buildPartial());
break; break;
} }
case 18: { case 18: {
@ -3201,7 +3258,12 @@ public final class RemoteProtocol {
break; break;
} }
case 42: { case 42: {
setSupervisorUuid(input.readString()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasSupervisorUuid()) {
subBuilder.mergeFrom(getSupervisorUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setSupervisorUuid(subBuilder.buildPartial());
break; break;
} }
case 50: { case 50: {
@ -3224,21 +3286,40 @@ public final class RemoteProtocol {
} }
// required uint64 id = 1; // required .UuidProtocol uuid = 1;
public boolean hasId() { public boolean hasUuid() {
return result.hasId(); return result.hasUuid();
} }
public long getId() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() {
return result.getId(); return result.getUuid();
} }
public Builder setId(long value) { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
result.hasId = true; if (value == null) {
result.id_ = value; throw new NullPointerException();
}
result.hasUuid = true;
result.uuid_ = value;
return this; return this;
} }
public Builder clearId() { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasId = false; result.hasUuid = true;
result.id_ = 0L; result.uuid_ = builderForValue.build();
return this;
}
public Builder mergeUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasUuid() &&
result.uuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.uuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.uuid_).mergeFrom(value).buildPartial();
} else {
result.uuid_ = value;
}
result.hasUuid = true;
return this;
}
public Builder clearUuid() {
result.hasUuid = false;
result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -3334,24 +3415,40 @@ public final class RemoteProtocol {
return this; return this;
} }
// optional string supervisorUuid = 5; // optional .UuidProtocol supervisorUuid = 5;
public boolean hasSupervisorUuid() { public boolean hasSupervisorUuid() {
return result.hasSupervisorUuid(); return result.hasSupervisorUuid();
} }
public java.lang.String getSupervisorUuid() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getSupervisorUuid() {
return result.getSupervisorUuid(); return result.getSupervisorUuid();
} }
public Builder setSupervisorUuid(java.lang.String value) { public Builder setSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
result.hasSupervisorUuid = true; result.hasSupervisorUuid = true;
result.supervisorUuid_ = value; result.supervisorUuid_ = value;
return this; return this;
} }
public Builder setSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasSupervisorUuid = true;
result.supervisorUuid_ = builderForValue.build();
return this;
}
public Builder mergeSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasSupervisorUuid() &&
result.supervisorUuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.supervisorUuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.supervisorUuid_).mergeFrom(value).buildPartial();
} else {
result.supervisorUuid_ = value;
}
result.hasSupervisorUuid = true;
return this;
}
public Builder clearSupervisorUuid() { public Builder clearSupervisorUuid() {
result.hasSupervisorUuid = false; result.hasSupervisorUuid = false;
result.supervisorUuid_ = getDefaultInstance().getSupervisorUuid(); result.supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -3482,12 +3579,12 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteReplyProtocol_fieldAccessorTable; return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteReplyProtocol_fieldAccessorTable;
} }
// required uint64 id = 1; // required .UuidProtocol uuid = 1;
public static final int ID_FIELD_NUMBER = 1; public static final int UUID_FIELD_NUMBER = 1;
private boolean hasId; private boolean hasUuid;
private long id_ = 0L; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_;
public boolean hasId() { return hasId; } public boolean hasUuid() { return hasUuid; }
public long getId() { return id_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; }
// optional .MessageProtocol message = 2; // optional .MessageProtocol message = 2;
public static final int MESSAGE_FIELD_NUMBER = 2; public static final int MESSAGE_FIELD_NUMBER = 2;
@ -3503,12 +3600,12 @@ public final class RemoteProtocol {
public boolean hasException() { return hasException; } public boolean hasException() { return hasException; }
public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol getException() { return exception_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol getException() { return exception_; }
// optional string supervisorUuid = 4; // optional .UuidProtocol supervisorUuid = 4;
public static final int SUPERVISORUUID_FIELD_NUMBER = 4; public static final int SUPERVISORUUID_FIELD_NUMBER = 4;
private boolean hasSupervisorUuid; private boolean hasSupervisorUuid;
private java.lang.String supervisorUuid_ = ""; private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol supervisorUuid_;
public boolean hasSupervisorUuid() { return hasSupervisorUuid; } public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
public java.lang.String getSupervisorUuid() { return supervisorUuid_; } public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getSupervisorUuid() { return supervisorUuid_; }
// required bool isActor = 5; // required bool isActor = 5;
public static final int ISACTOR_FIELD_NUMBER = 5; public static final int ISACTOR_FIELD_NUMBER = 5;
@ -3537,19 +3634,25 @@ public final class RemoteProtocol {
} }
private void initFields() { private void initFields() {
uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance(); message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance();
exception_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance(); exception_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance();
supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
} }
public final boolean isInitialized() { public final boolean isInitialized() {
if (!hasId) return false; if (!hasUuid) return false;
if (!hasIsActor) return false; if (!hasIsActor) return false;
if (!hasIsSuccessful) return false; if (!hasIsSuccessful) return false;
if (!getUuid().isInitialized()) return false;
if (hasMessage()) { if (hasMessage()) {
if (!getMessage().isInitialized()) return false; if (!getMessage().isInitialized()) return false;
} }
if (hasException()) { if (hasException()) {
if (!getException().isInitialized()) return false; if (!getException().isInitialized()) return false;
} }
if (hasSupervisorUuid()) {
if (!getSupervisorUuid().isInitialized()) return false;
}
for (se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MetadataEntryProtocol element : getMetadataList()) { for (se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MetadataEntryProtocol element : getMetadataList()) {
if (!element.isInitialized()) return false; if (!element.isInitialized()) return false;
} }
@ -3559,8 +3662,8 @@ public final class RemoteProtocol {
public void writeTo(com.google.protobuf.CodedOutputStream output) public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException { throws java.io.IOException {
getSerializedSize(); getSerializedSize();
if (hasId()) { if (hasUuid()) {
output.writeUInt64(1, getId()); output.writeMessage(1, getUuid());
} }
if (hasMessage()) { if (hasMessage()) {
output.writeMessage(2, getMessage()); output.writeMessage(2, getMessage());
@ -3569,7 +3672,7 @@ public final class RemoteProtocol {
output.writeMessage(3, getException()); output.writeMessage(3, getException());
} }
if (hasSupervisorUuid()) { if (hasSupervisorUuid()) {
output.writeString(4, getSupervisorUuid()); output.writeMessage(4, getSupervisorUuid());
} }
if (hasIsActor()) { if (hasIsActor()) {
output.writeBool(5, getIsActor()); output.writeBool(5, getIsActor());
@ -3589,9 +3692,9 @@ public final class RemoteProtocol {
if (size != -1) return size; if (size != -1) return size;
size = 0; size = 0;
if (hasId()) { if (hasUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeUInt64Size(1, getId()); .computeMessageSize(1, getUuid());
} }
if (hasMessage()) { if (hasMessage()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -3603,7 +3706,7 @@ public final class RemoteProtocol {
} }
if (hasSupervisorUuid()) { if (hasSupervisorUuid()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
.computeStringSize(4, getSupervisorUuid()); .computeMessageSize(4, getSupervisorUuid());
} }
if (hasIsActor()) { if (hasIsActor()) {
size += com.google.protobuf.CodedOutputStream size += com.google.protobuf.CodedOutputStream
@ -3779,8 +3882,8 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol other) { public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol other) {
if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.getDefaultInstance()) return this; if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.getDefaultInstance()) return this;
if (other.hasId()) { if (other.hasUuid()) {
setId(other.getId()); mergeUuid(other.getUuid());
} }
if (other.hasMessage()) { if (other.hasMessage()) {
mergeMessage(other.getMessage()); mergeMessage(other.getMessage());
@ -3789,7 +3892,7 @@ public final class RemoteProtocol {
mergeException(other.getException()); mergeException(other.getException());
} }
if (other.hasSupervisorUuid()) { if (other.hasSupervisorUuid()) {
setSupervisorUuid(other.getSupervisorUuid()); mergeSupervisorUuid(other.getSupervisorUuid());
} }
if (other.hasIsActor()) { if (other.hasIsActor()) {
setIsActor(other.getIsActor()); setIsActor(other.getIsActor());
@ -3828,8 +3931,13 @@ public final class RemoteProtocol {
} }
break; break;
} }
case 8: { case 10: {
setId(input.readUInt64()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasUuid()) {
subBuilder.mergeFrom(getUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setUuid(subBuilder.buildPartial());
break; break;
} }
case 18: { case 18: {
@ -3851,7 +3959,12 @@ public final class RemoteProtocol {
break; break;
} }
case 34: { case 34: {
setSupervisorUuid(input.readString()); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder();
if (hasSupervisorUuid()) {
subBuilder.mergeFrom(getSupervisorUuid());
}
input.readMessage(subBuilder, extensionRegistry);
setSupervisorUuid(subBuilder.buildPartial());
break; break;
} }
case 40: { case 40: {
@ -3873,21 +3986,40 @@ public final class RemoteProtocol {
} }
// required uint64 id = 1; // required .UuidProtocol uuid = 1;
public boolean hasId() { public boolean hasUuid() {
return result.hasId(); return result.hasUuid();
} }
public long getId() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() {
return result.getId(); return result.getUuid();
} }
public Builder setId(long value) { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
result.hasId = true; if (value == null) {
result.id_ = value; throw new NullPointerException();
}
result.hasUuid = true;
result.uuid_ = value;
return this; return this;
} }
public Builder clearId() { public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasId = false; result.hasUuid = true;
result.id_ = 0L; result.uuid_ = builderForValue.build();
return this;
}
public Builder mergeUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasUuid() &&
result.uuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.uuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.uuid_).mergeFrom(value).buildPartial();
} else {
result.uuid_ = value;
}
result.hasUuid = true;
return this;
}
public Builder clearUuid() {
result.hasUuid = false;
result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -3965,24 +4097,40 @@ public final class RemoteProtocol {
return this; return this;
} }
// optional string supervisorUuid = 4; // optional .UuidProtocol supervisorUuid = 4;
public boolean hasSupervisorUuid() { public boolean hasSupervisorUuid() {
return result.hasSupervisorUuid(); return result.hasSupervisorUuid();
} }
public java.lang.String getSupervisorUuid() { public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getSupervisorUuid() {
return result.getSupervisorUuid(); return result.getSupervisorUuid();
} }
public Builder setSupervisorUuid(java.lang.String value) { public Builder setSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (value == null) { if (value == null) {
throw new NullPointerException(); throw new NullPointerException();
} }
result.hasSupervisorUuid = true; result.hasSupervisorUuid = true;
result.supervisorUuid_ = value; result.supervisorUuid_ = value;
return this; return this;
} }
public Builder setSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.Builder builderForValue) {
result.hasSupervisorUuid = true;
result.supervisorUuid_ = builderForValue.build();
return this;
}
public Builder mergeSupervisorUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) {
if (result.hasSupervisorUuid() &&
result.supervisorUuid_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance()) {
result.supervisorUuid_ =
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.newBuilder(result.supervisorUuid_).mergeFrom(value).buildPartial();
} else {
result.supervisorUuid_ = value;
}
result.hasSupervisorUuid = true;
return this;
}
public Builder clearSupervisorUuid() { public Builder clearSupervisorUuid() {
result.hasSupervisorUuid = false; result.hasSupervisorUuid = false;
result.supervisorUuid_ = getDefaultInstance().getSupervisorUuid(); result.supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance();
return this; return this;
} }
@ -5764,52 +5912,55 @@ public final class RemoteProtocol {
descriptor; descriptor;
static { static {
java.lang.String[] descriptorData = { java.lang.String[] descriptorData = {
"\n\024RemoteProtocol.proto\"v\n\026RemoteActorRef" + "\n\024RemoteProtocol.proto\"\204\001\n\026RemoteActorRe" +
"Protocol\022\014\n\004uuid\030\001 \002(\t\022\026\n\016actorClassname" + "fProtocol\022\032\n\022classOrServiceName\030\001 \002(\t\022\026\n" +
"\030\002 \002(\t\022%\n\013homeAddress\030\003 \002(\0132\020.AddressPro" + "\016actorClassname\030\002 \002(\t\022%\n\013homeAddress\030\003 \002" +
"tocol\022\017\n\007timeout\030\004 \001(\004\"\200\003\n\032SerializedAct" + "(\0132\020.AddressProtocol\022\017\n\007timeout\030\004 \001(\004\"\217\003" +
"orRefProtocol\022\014\n\004uuid\030\001 \002(\t\022\n\n\002id\030\002 \002(\t\022" + "\n\032SerializedActorRefProtocol\022\033\n\004uuid\030\001 \002" +
"\026\n\016actorClassname\030\003 \002(\t\022)\n\017originalAddre" + "(\0132\r.UuidProtocol\022\n\n\002id\030\002 \002(\t\022\026\n\016actorCl" +
"ss\030\004 \002(\0132\020.AddressProtocol\022\025\n\ractorInsta" + "assname\030\003 \002(\t\022)\n\017originalAddress\030\004 \002(\0132\020" +
"nce\030\005 \001(\014\022\033\n\023serializerClassname\030\006 \001(\t\022\024" + ".AddressProtocol\022\025\n\ractorInstance\030\005 \001(\014\022" +
"\n\014isTransactor\030\007 \001(\010\022\017\n\007timeout\030\010 \001(\004\022\026\n" + "\033\n\023serializerClassname\030\006 \001(\t\022\024\n\014isTransa" +
"\016receiveTimeout\030\t \001(\004\022%\n\tlifeCycle\030\n \001(\013", "ctor\030\007 \001(\010\022\017\n\007timeout\030\010 \001(\004\022\026\n\016receiveTi",
"2\022.LifeCycleProtocol\022+\n\nsupervisor\030\013 \001(\013" + "meout\030\t \001(\004\022%\n\tlifeCycle\030\n \001(\0132\022.LifeCyc" +
"2\027.RemoteActorRefProtocol\022\024\n\014hotswapStac" + "leProtocol\022+\n\nsupervisor\030\013 \001(\0132\027.RemoteA" +
"k\030\014 \001(\014\022(\n\010messages\030\r \003(\0132\026.RemoteReques" + "ctorRefProtocol\022\024\n\014hotswapStack\030\014 \001(\014\022(\n" +
"tProtocol\"r\n\017MessageProtocol\0225\n\023serializ" + "\010messages\030\r \003(\0132\026.RemoteRequestProtocol\"" +
"ationScheme\030\001 \002(\0162\030.SerializationSchemeT" + "r\n\017MessageProtocol\0225\n\023serializationSchem" +
"ype\022\017\n\007message\030\002 \002(\014\022\027\n\017messageManifest\030" + "e\030\001 \002(\0162\030.SerializationSchemeType\022\017\n\007mes" +
"\003 \001(\014\"\236\001\n\021ActorInfoProtocol\022\014\n\004uuid\030\001 \002(" + "sage\030\002 \002(\014\022\027\n\017messageManifest\030\003 \001(\014\"\255\001\n\021" +
"\t\022\016\n\006target\030\002 \002(\t\022\017\n\007timeout\030\003 \002(\004\022\035\n\tac" + "ActorInfoProtocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidPr" +
"torType\030\004 \002(\0162\n.ActorType\022/\n\016typedActorI" + "otocol\022\016\n\006target\030\002 \002(\t\022\017\n\007timeout\030\003 \002(\004\022" +
"nfo\030\005 \001(\0132\027.TypedActorInfoProtocol\022\n\n\002id", "\035\n\tactorType\030\004 \002(\0162\n.ActorType\022/\n\016typedA",
"\030\006 \001(\t\";\n\026TypedActorInfoProtocol\022\021\n\tinte" + "ctorInfo\030\005 \001(\0132\027.TypedActorInfoProtocol\022" +
"rface\030\001 \002(\t\022\016\n\006method\030\002 \002(\t\"\352\001\n\025RemoteRe" + "\n\n\002id\030\006 \001(\t\";\n\026TypedActorInfoProtocol\022\021\n" +
"questProtocol\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \002" + "\tinterface\030\001 \002(\t\022\016\n\006method\030\002 \002(\t\"\212\002\n\025Rem" +
"(\0132\020.MessageProtocol\022%\n\tactorInfo\030\003 \002(\0132" + "oteRequestProtocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidP" +
"\022.ActorInfoProtocol\022\020\n\010isOneWay\030\004 \002(\010\022\026\n" + "rotocol\022!\n\007message\030\002 \002(\0132\020.MessageProtoc" +
"\016supervisorUuid\030\005 \001(\t\022\'\n\006sender\030\006 \001(\0132\027." + "ol\022%\n\tactorInfo\030\003 \002(\0132\022.ActorInfoProtoco" +
"RemoteActorRefProtocol\022(\n\010metadata\030\007 \003(\013" + "l\022\020\n\010isOneWay\030\004 \002(\010\022%\n\016supervisorUuid\030\005 " +
"2\026.MetadataEntryProtocol\"\324\001\n\023RemoteReply" + "\001(\0132\r.UuidProtocol\022\'\n\006sender\030\006 \001(\0132\027.Rem" +
"Protocol\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \001(\0132\020." + "oteActorRefProtocol\022(\n\010metadata\030\007 \003(\0132\026." +
"MessageProtocol\022%\n\texception\030\003 \001(\0132\022.Exc", "MetadataEntryProtocol\"\364\001\n\023RemoteReplyPro",
"eptionProtocol\022\026\n\016supervisorUuid\030\004 \001(\t\022\017" + "tocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidProtocol\022!\n\007me" +
"\n\007isActor\030\005 \002(\010\022\024\n\014isSuccessful\030\006 \002(\010\022(\n" + "ssage\030\002 \001(\0132\020.MessageProtocol\022%\n\texcepti" +
"\010metadata\030\007 \003(\0132\026.MetadataEntryProtocol\"" + "on\030\003 \001(\0132\022.ExceptionProtocol\022%\n\016supervis" +
")\n\014UuidProtocol\022\014\n\004high\030\001 \002(\004\022\013\n\003low\030\002 \002" + "orUuid\030\004 \001(\0132\r.UuidProtocol\022\017\n\007isActor\030\005" +
"(\004\"3\n\025MetadataEntryProtocol\022\013\n\003key\030\001 \002(\t" + " \002(\010\022\024\n\014isSuccessful\030\006 \002(\010\022(\n\010metadata\030\007" +
"\022\r\n\005value\030\002 \002(\014\"6\n\021LifeCycleProtocol\022!\n\t" + " \003(\0132\026.MetadataEntryProtocol\")\n\014UuidProt" +
"lifeCycle\030\001 \002(\0162\016.LifeCycleType\"1\n\017Addre" + "ocol\022\014\n\004high\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025Metad" +
"ssProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 \002" + "ataEntryProtocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002" +
"(\r\"7\n\021ExceptionProtocol\022\021\n\tclassname\030\001 \002" + " \002(\014\"6\n\021LifeCycleProtocol\022!\n\tlifeCycle\030\001" +
"(\t\022\017\n\007message\030\002 \002(\t*=\n\tActorType\022\017\n\013SCAL", " \002(\0162\016.LifeCycleType\"1\n\017AddressProtocol\022",
"A_ACTOR\020\001\022\016\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACTOR" + "\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\"7\n\021Excep" +
"\020\003*]\n\027SerializationSchemeType\022\010\n\004JAVA\020\001\022" + "tionProtocol\022\021\n\tclassname\030\001 \002(\t\022\017\n\007messa" +
"\013\n\007SBINARY\020\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JSO" + "ge\030\002 \002(\t*=\n\tActorType\022\017\n\013SCALA_ACTOR\020\001\022\016" +
"N\020\004\022\014\n\010PROTOBUF\020\005*-\n\rLifeCycleType\022\r\n\tPE" + "\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACTOR\020\003*]\n\027Seria" +
"RMANENT\020\001\022\r\n\tTEMPORARY\020\002B-\n)se.scalables" + "lizationSchemeType\022\010\n\004JAVA\020\001\022\013\n\007SBINARY\020" +
"olutions.akka.remote.protocolH\001" "\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JSON\020\004\022\014\n\010PROT" +
"OBUF\020\005*-\n\rLifeCycleType\022\r\n\tPERMANENT\020\001\022\r" +
"\n\tTEMPORARY\020\002B-\n)se.scalablesolutions.ak" +
"ka.remote.protocolH\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() {
@ -5821,7 +5972,7 @@ public final class RemoteProtocol {
internal_static_RemoteActorRefProtocol_fieldAccessorTable = new internal_static_RemoteActorRefProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteActorRefProtocol_descriptor, internal_static_RemoteActorRefProtocol_descriptor,
new java.lang.String[] { "Uuid", "ActorClassname", "HomeAddress", "Timeout", }, new java.lang.String[] { "ClassOrServiceName", "ActorClassname", "HomeAddress", "Timeout", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.Builder.class); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.Builder.class);
internal_static_SerializedActorRefProtocol_descriptor = internal_static_SerializedActorRefProtocol_descriptor =
@ -5861,7 +6012,7 @@ public final class RemoteProtocol {
internal_static_RemoteRequestProtocol_fieldAccessorTable = new internal_static_RemoteRequestProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteRequestProtocol_descriptor, internal_static_RemoteRequestProtocol_descriptor,
new java.lang.String[] { "Id", "Message", "ActorInfo", "IsOneWay", "SupervisorUuid", "Sender", "Metadata", }, new java.lang.String[] { "Uuid", "Message", "ActorInfo", "IsOneWay", "SupervisorUuid", "Sender", "Metadata", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.Builder.class); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.Builder.class);
internal_static_RemoteReplyProtocol_descriptor = internal_static_RemoteReplyProtocol_descriptor =
@ -5869,7 +6020,7 @@ public final class RemoteProtocol {
internal_static_RemoteReplyProtocol_fieldAccessorTable = new internal_static_RemoteReplyProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable( com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteReplyProtocol_descriptor, internal_static_RemoteReplyProtocol_descriptor,
new java.lang.String[] { "Id", "Message", "Exception", "SupervisorUuid", "IsActor", "IsSuccessful", "Metadata", }, new java.lang.String[] { "Uuid", "Message", "Exception", "SupervisorUuid", "IsActor", "IsSuccessful", "Metadata", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.Builder.class); se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.Builder.class);
internal_static_UuidProtocol_descriptor = internal_static_UuidProtocol_descriptor =

View file

@ -16,7 +16,7 @@ option optimize_for = SPEED;
* on the original node. * on the original node.
*/ */
message RemoteActorRefProtocol { message RemoteActorRefProtocol {
required UuidProtocol uuid = 1; required string classOrServiceName = 1;
required string actorClassname = 2; required string actorClassname = 2;
required AddressProtocol homeAddress = 3; required AddressProtocol homeAddress = 3;
optional uint64 timeout = 4; optional uint64 timeout = 4;
@ -80,7 +80,7 @@ message RemoteRequestProtocol {
required MessageProtocol message = 2; required MessageProtocol message = 2;
required ActorInfoProtocol actorInfo = 3; required ActorInfoProtocol actorInfo = 3;
required bool isOneWay = 4; required bool isOneWay = 4;
optional string supervisorUuid = 5; optional UuidProtocol supervisorUuid = 5;
optional RemoteActorRefProtocol sender = 6; optional RemoteActorRefProtocol sender = 6;
repeated MetadataEntryProtocol metadata = 7; repeated MetadataEntryProtocol metadata = 7;
} }
@ -92,7 +92,7 @@ message RemoteReplyProtocol {
required UuidProtocol uuid = 1; required UuidProtocol uuid = 1;
optional MessageProtocol message = 2; optional MessageProtocol message = 2;
optional ExceptionProtocol exception = 3; optional ExceptionProtocol exception = 3;
optional string supervisorUuid = 4; optional UuidProtocol supervisorUuid = 4;
required bool isActor = 5; required bool isActor = 5;
required bool isSuccessful = 6; required bool isSuccessful = 6;
repeated MetadataEntryProtocol metadata = 7; repeated MetadataEntryProtocol metadata = 7;

View file

@ -7,12 +7,12 @@ package se.scalablesolutions.akka.remote
import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => ActorTypeProtocol, _} import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => ActorTypeProtocol, _}
import se.scalablesolutions.akka.actor.{Exit, Actor, ActorRef, ActorType, RemoteActorRef, IllegalActorStateException} import se.scalablesolutions.akka.actor.{Exit, Actor, ActorRef, ActorType, RemoteActorRef, IllegalActorStateException}
import se.scalablesolutions.akka.dispatch.{DefaultCompletableFuture, CompletableFuture} import se.scalablesolutions.akka.dispatch.{DefaultCompletableFuture, CompletableFuture}
import se.scalablesolutions.akka.util.{ListenerManagement, UUID, Logging, Duration} import se.scalablesolutions.akka.util.{ListenerManagement, Logging, Duration}
import se.scalablesolutions.akka.actor.{Uuid,newUuid,uuidFrom}
import se.scalablesolutions.akka.config.Config._ import se.scalablesolutions.akka.config.Config._
import se.scalablesolutions.akka.serialization.RemoteActorSerialization._ import se.scalablesolutions.akka.serialization.RemoteActorSerialization._
import se.scalablesolutions.akka.AkkaException import se.scalablesolutions.akka.AkkaException
import Actor._ import Actor._
import org.jboss.netty.channel._ import org.jboss.netty.channel._
import group.DefaultChannelGroup import group.DefaultChannelGroup
import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory
@ -63,7 +63,7 @@ object RemoteClient extends Logging {
val RECONNECT_DELAY = Duration(config.getInt("akka.remote.client.reconnect-delay", 5), TIME_UNIT) val RECONNECT_DELAY = Duration(config.getInt("akka.remote.client.reconnect-delay", 5), TIME_UNIT)
private val remoteClients = new HashMap[String, RemoteClient] private val remoteClients = new HashMap[String, RemoteClient]
private val remoteActors = new HashMap[RemoteServer.Address, HashSet[String]] private val remoteActors = new HashMap[RemoteServer.Address, HashSet[Uuid]]
def actorFor(classNameOrServiceId: String, hostname: String, port: Int): ActorRef = def actorFor(classNameOrServiceId: String, hostname: String, port: Int): ActorRef =
actorFor(classNameOrServiceId, classNameOrServiceId, 5000L, hostname, port, None) actorFor(classNameOrServiceId, classNameOrServiceId, 5000L, hostname, port, None)
@ -162,21 +162,21 @@ object RemoteClient extends Logging {
remoteClients.clear remoteClients.clear
} }
def register(hostname: String, port: Int, uuid: String) = synchronized { def register(hostname: String, port: Int, uuid: Uuid) = synchronized {
actorsFor(RemoteServer.Address(hostname, port)) += uuid actorsFor(RemoteServer.Address(hostname, port)) += uuid
} }
private[akka] def unregister(hostname: String, port: Int, uuid: String) = synchronized { private[akka] def unregister(hostname: String, port: Int, uuid: Uuid) = synchronized {
val set = actorsFor(RemoteServer.Address(hostname, port)) val set = actorsFor(RemoteServer.Address(hostname, port))
set -= uuid set -= uuid
if (set.isEmpty) shutdownClientFor(new InetSocketAddress(hostname, port)) if (set.isEmpty) shutdownClientFor(new InetSocketAddress(hostname, port))
} }
private[akka] def actorsFor(remoteServerAddress: RemoteServer.Address): HashSet[String] = { private[akka] def actorsFor(remoteServerAddress: RemoteServer.Address): HashSet[Uuid] = {
val set = remoteActors.get(remoteServerAddress) val set = remoteActors.get(remoteServerAddress)
if (set.isDefined && (set.get ne null)) set.get if (set.isDefined && (set.get ne null)) set.get
else { else {
val remoteActorSet = new HashSet[String] val remoteActorSet = new HashSet[Uuid]
remoteActors.put(remoteServerAddress, remoteActorSet) remoteActors.put(remoteServerAddress, remoteActorSet)
remoteActorSet remoteActorSet
} }
@ -194,8 +194,8 @@ class RemoteClient private[akka] (
val name = "RemoteClient@" + hostname + "::" + port val name = "RemoteClient@" + hostname + "::" + port
//FIXME Should these be clear:ed on postStop? //FIXME Should these be clear:ed on postStop?
private val futures = new ConcurrentHashMap[Long, CompletableFuture[_]] private val futures = new ConcurrentHashMap[Uuid, CompletableFuture[_]]
private val supervisors = new ConcurrentHashMap[String, ActorRef] private val supervisors = new ConcurrentHashMap[Uuid, ActorRef]
private val remoteAddress = new InetSocketAddress(hostname, port) private val remoteAddress = new InetSocketAddress(hostname, port)
@ -287,7 +287,7 @@ class RemoteClient private[akka] (
futures.synchronized { futures.synchronized {
val futureResult = if (senderFuture.isDefined) senderFuture.get val futureResult = if (senderFuture.isDefined) senderFuture.get
else new DefaultCompletableFuture[T](request.getActorInfo.getTimeout) else new DefaultCompletableFuture[T](request.getActorInfo.getTimeout)
futures.put(request.getId, futureResult) futures.put(uuidFrom(request.getUuid.getHigh,request.getUuid.getLow), futureResult)
connection.getChannel.write(request) connection.getChannel.write(request)
Some(futureResult) Some(futureResult)
} }
@ -330,8 +330,8 @@ class RemoteClient private[akka] (
*/ */
class RemoteClientPipelineFactory( class RemoteClientPipelineFactory(
name: String, name: String,
futures: ConcurrentMap[Long, CompletableFuture[_]], futures: ConcurrentMap[Uuid, CompletableFuture[_]],
supervisors: ConcurrentMap[String, ActorRef], supervisors: ConcurrentMap[Uuid, ActorRef],
bootstrap: ClientBootstrap, bootstrap: ClientBootstrap,
remoteAddress: SocketAddress, remoteAddress: SocketAddress,
timer: HashedWheelTimer, timer: HashedWheelTimer,
@ -370,8 +370,8 @@ class RemoteClientPipelineFactory(
@ChannelHandler.Sharable @ChannelHandler.Sharable
class RemoteClientHandler( class RemoteClientHandler(
val name: String, val name: String,
val futures: ConcurrentMap[Long, CompletableFuture[_]], val futures: ConcurrentMap[Uuid, CompletableFuture[_]],
val supervisors: ConcurrentMap[String, ActorRef], val supervisors: ConcurrentMap[Uuid, ActorRef],
val bootstrap: ClientBootstrap, val bootstrap: ClientBootstrap,
val remoteAddress: SocketAddress, val remoteAddress: SocketAddress,
val timer: HashedWheelTimer, val timer: HashedWheelTimer,
@ -391,14 +391,15 @@ class RemoteClientHandler(
val result = event.getMessage val result = event.getMessage
if (result.isInstanceOf[RemoteReplyProtocol]) { if (result.isInstanceOf[RemoteReplyProtocol]) {
val reply = result.asInstanceOf[RemoteReplyProtocol] val reply = result.asInstanceOf[RemoteReplyProtocol]
val replyUuid = uuidFrom(reply.getUuid.getHigh,reply.getUuid.getLow)
log.debug("Remote client received RemoteReplyProtocol[\n%s]", reply.toString) log.debug("Remote client received RemoteReplyProtocol[\n%s]", reply.toString)
val future = futures.get(reply.getId).asInstanceOf[CompletableFuture[Any]] val future = futures.get(replyUuid).asInstanceOf[CompletableFuture[Any]]
if (reply.getIsSuccessful) { if (reply.getIsSuccessful) {
val message = MessageSerializer.deserialize(reply.getMessage) val message = MessageSerializer.deserialize(reply.getMessage)
future.completeWithResult(message) future.completeWithResult(message)
} else { } else {
if (reply.hasSupervisorUuid()) { if (reply.hasSupervisorUuid()) {
val supervisorUuid = reply.getSupervisorUuid val supervisorUuid = uuidFrom(reply.getSupervisorUuid.getHigh,reply.getSupervisorUuid.getLow)
if (!supervisors.containsKey(supervisorUuid)) throw new IllegalActorStateException( if (!supervisors.containsKey(supervisorUuid)) throw new IllegalActorStateException(
"Expected a registered supervisor for UUID [" + supervisorUuid + "] but none was found") "Expected a registered supervisor for UUID [" + supervisorUuid + "] but none was found")
val supervisedActor = supervisors.get(supervisorUuid) val supervisedActor = supervisors.get(supervisorUuid)
@ -408,7 +409,7 @@ class RemoteClientHandler(
} }
future.completeWithException(parseException(reply, client.loader)) future.completeWithException(parseException(reply, client.loader))
} }
futures.remove(reply.getId) futures remove replyUuid
} else { } else {
val exception = new RemoteClientException("Unknown message received in remote client handler: " + result, client) val exception = new RemoteClientException("Unknown message received in remote client handler: " + result, client)
client.notifyListeners(RemoteClientError(exception, client)) client.notifyListeners(RemoteClientError(exception, client))

View file

@ -11,6 +11,7 @@ import java.util.{Map => JMap}
import se.scalablesolutions.akka.actor.{ import se.scalablesolutions.akka.actor.{
Actor, TypedActor, ActorRef, IllegalActorStateException, RemoteActorSystemMessage} Actor, TypedActor, ActorRef, IllegalActorStateException, RemoteActorSystemMessage}
import se.scalablesolutions.akka.actor.{Uuid,uuidFrom}
import se.scalablesolutions.akka.actor.Actor._ import se.scalablesolutions.akka.actor.Actor._
import se.scalablesolutions.akka.util._ import se.scalablesolutions.akka.util._
import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._ import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._
@ -122,19 +123,19 @@ object RemoteServer {
} }
private class RemoteActorSet { private class RemoteActorSet {
private[RemoteServer] val actors = new ConcurrentHashMap[String, ActorRef] private[RemoteServer] val actors = new ConcurrentHashMap[Object, ActorRef]
private[RemoteServer] val typedActors = new ConcurrentHashMap[String, AnyRef] private[RemoteServer] val typedActors = new ConcurrentHashMap[Object, AnyRef]
} }
private val guard = new ReadWriteGuard private val guard = new ReadWriteGuard
private val remoteActorSets = Map[Address, RemoteActorSet]() private val remoteActorSets = Map[Address, RemoteActorSet]()
private val remoteServers = Map[Address, RemoteServer]() private val remoteServers = Map[Address, RemoteServer]()
private[akka] def registerActor(address: InetSocketAddress, uuid: String, actor: ActorRef) = guard.withWriteGuard { private[akka] def registerActor(address: InetSocketAddress, uuid: Uuid, actor: ActorRef) = guard.withWriteGuard {
actorsFor(RemoteServer.Address(address.getHostName, address.getPort)).actors.put(uuid, actor) actorsFor(RemoteServer.Address(address.getHostName, address.getPort)).actors.put(uuid, actor)
} }
private[akka] def registerTypedActor(address: InetSocketAddress, uuid: String, typedActor: AnyRef) = guard.withWriteGuard { private[akka] def registerTypedActor(address: InetSocketAddress, uuid: Uuid, typedActor: AnyRef) = guard.withWriteGuard {
actorsFor(RemoteServer.Address(address.getHostName, address.getPort)).typedActors.put(uuid, typedActor) actorsFor(RemoteServer.Address(address.getHostName, address.getPort)).typedActors.put(uuid, typedActor)
} }
@ -504,7 +505,7 @@ class RemoteServerHandler(
override def onComplete(result: AnyRef) { override def onComplete(result: AnyRef) {
log.debug("Returning result from actor invocation [%s]", result) log.debug("Returning result from actor invocation [%s]", result)
val replyBuilder = RemoteReplyProtocol.newBuilder val replyBuilder = RemoteReplyProtocol.newBuilder
.setId(request.getId) .setUuid(request.getUuid)
.setMessage(MessageSerializer.serialize(result)) .setMessage(MessageSerializer.serialize(result))
.setIsSuccessful(true) .setIsSuccessful(true)
.setIsActor(true) .setIsActor(true)
@ -548,7 +549,7 @@ class RemoteServerHandler(
val result = messageReceiver.invoke(typedActor, args: _*) val result = messageReceiver.invoke(typedActor, args: _*)
log.debug("Returning result from remote typed actor invocation [%s]", result) log.debug("Returning result from remote typed actor invocation [%s]", result)
val replyBuilder = RemoteReplyProtocol.newBuilder val replyBuilder = RemoteReplyProtocol.newBuilder
.setId(request.getId) .setUuid(request.getUuid)
.setMessage(MessageSerializer.serialize(result)) .setMessage(MessageSerializer.serialize(result))
.setIsSuccessful(true) .setIsSuccessful(true)
.setIsActor(false) .setIsActor(false)
@ -569,7 +570,7 @@ class RemoteServerHandler(
* Find a registered actor by ID (default) or UUID. * Find a registered actor by ID (default) or UUID.
* Actors are registered by id apart from registering during serialization see SerializationProtocol. * Actors are registered by id apart from registering during serialization see SerializationProtocol.
*/ */
private def findActorByIdOrUuid(id: String, uuid: String) : ActorRef = { private def findActorByIdOrUuid(id: String, uuid: Uuid) : ActorRef = {
val registeredActors = server.actors() val registeredActors = server.actors()
var actorRefOrNull = registeredActors get id var actorRefOrNull = registeredActors get id
if (actorRefOrNull eq null) { if (actorRefOrNull eq null) {
@ -582,7 +583,7 @@ class RemoteServerHandler(
* Find a registered typed actor by ID (default) or UUID. * Find a registered typed actor by ID (default) or UUID.
* Actors are registered by id apart from registering during serialization see SerializationProtocol. * Actors are registered by id apart from registering during serialization see SerializationProtocol.
*/ */
private def findTypedActorByIdOrUUid(id: String, uuid: String) : AnyRef = { private def findTypedActorByIdOrUUid(id: String, uuid: Uuid) : AnyRef = {
val registeredActors = server.typedActors() val registeredActors = server.typedActors()
var actorRefOrNull = registeredActors get id var actorRefOrNull = registeredActors get id
if (actorRefOrNull eq null) { if (actorRefOrNull eq null) {
@ -599,7 +600,7 @@ class RemoteServerHandler(
* Does not start the actor. * Does not start the actor.
*/ */
private def createActor(actorInfo: ActorInfoProtocol): ActorRef = { private def createActor(actorInfo: ActorInfoProtocol): ActorRef = {
val uuid = actorInfo.getUuid val uuid = uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow)
val id = actorInfo.getId val id = actorInfo.getId
val name = actorInfo.getTarget val name = actorInfo.getTarget
@ -629,7 +630,7 @@ class RemoteServerHandler(
} }
private def createTypedActor(actorInfo: ActorInfoProtocol): AnyRef = { private def createTypedActor(actorInfo: ActorInfoProtocol): AnyRef = {
val uuid = actorInfo.getUuid val uuid = uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow)
val id = actorInfo.getId val id = actorInfo.getId
val typedActorOrNull = findTypedActorByIdOrUUid(id, uuid) val typedActorOrNull = findTypedActorByIdOrUUid(id, uuid)
@ -664,7 +665,7 @@ class RemoteServerHandler(
val actorInfo = request.getActorInfo val actorInfo = request.getActorInfo
log.error(e, "Could not invoke remote typed actor [%s :: %s]", actorInfo.getTypedActorInfo.getMethod, actorInfo.getTarget) log.error(e, "Could not invoke remote typed actor [%s :: %s]", actorInfo.getTypedActorInfo.getMethod, actorInfo.getTarget)
val replyBuilder = RemoteReplyProtocol.newBuilder val replyBuilder = RemoteReplyProtocol.newBuilder
.setId(request.getId) .setUuid(request.getUuid)
.setException(ExceptionProtocol.newBuilder.setClassname(e.getClass.getName).setMessage(e.getMessage).build) .setException(ExceptionProtocol.newBuilder.setClassname(e.getClass.getName).setMessage(e.getMessage).build)
.setIsSuccessful(false) .setIsSuccessful(false)
.setIsActor(isActor) .setIsActor(isActor)

View file

@ -14,9 +14,8 @@ import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => Ac
import ActorTypeProtocol._ import ActorTypeProtocol._
import se.scalablesolutions.akka.config.{AllForOneStrategy, OneForOneStrategy, FaultHandlingStrategy} import se.scalablesolutions.akka.config.{AllForOneStrategy, OneForOneStrategy, FaultHandlingStrategy}
import se.scalablesolutions.akka.config.ScalaConfig._ import se.scalablesolutions.akka.config.ScalaConfig._
import se.scalablesolutions.akka.actor.{uuidFrom,newUuid}
import com.google.protobuf.ByteString import com.google.protobuf.ByteString
import se.scalablesolutions.akka.util.UUID
/** /**
* Type class definition for Actor Serialization * Type class definition for Actor Serialization
@ -109,7 +108,7 @@ object ActorSerialization {
.build .build
val builder = SerializedActorRefProtocol.newBuilder val builder = SerializedActorRefProtocol.newBuilder
.setUuid(actorRef.uuid) .setUuid(UuidProtocol.newBuilder.setHigh(actorRef.uuid.getTime).setLow(actorRef.uuid.getClockSeqAndNode).build)
.setId(actorRef.id) .setId(actorRef.id)
.setActorClassname(actorRef.actorClass.getName) .setActorClassname(actorRef.actorClass.getName)
.setOriginalAddress(originalAddress) .setOriginalAddress(originalAddress)
@ -167,7 +166,7 @@ object ActorSerialization {
} }
val ar = new LocalActorRef( val ar = new LocalActorRef(
protocol.getUuid, uuidFrom(protocol.getUuid.getHigh,protocol.getUuid.getLow),
protocol.getId, protocol.getId,
protocol.getOriginalAddress.getHostname, protocol.getOriginalAddress.getHostname,
protocol.getOriginalAddress.getPort, protocol.getOriginalAddress.getPort,
@ -208,7 +207,7 @@ object RemoteActorSerialization {
private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = { private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = {
Actor.log.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n" + protocol) Actor.log.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n" + protocol)
RemoteActorRef( RemoteActorRef(
protocol.getUuid, protocol.getClassOrServiceName,
protocol.getActorClassname, protocol.getActorClassname,
protocol.getHomeAddress.getHostname, protocol.getHomeAddress.getHostname,
protocol.getHomeAddress.getPort, protocol.getHomeAddress.getPort,
@ -232,7 +231,7 @@ object RemoteActorSerialization {
} }
RemoteActorRefProtocol.newBuilder RemoteActorRefProtocol.newBuilder
.setUuid(uuid) .setClassOrServiceName(id)
.setActorClassname(actorClass.getName) .setActorClassname(actorClass.getName)
.setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build)
.setTimeout(timeout) .setTimeout(timeout)
@ -250,7 +249,7 @@ object RemoteActorSerialization {
import actorRef._ import actorRef._
val actorInfoBuilder = ActorInfoProtocol.newBuilder val actorInfoBuilder = ActorInfoProtocol.newBuilder
.setUuid(uuid) .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build)
.setId(actorRef.id) .setId(actorRef.id)
.setTarget(actorClassName) .setTarget(actorClassName)
.setTimeout(timeout) .setTimeout(timeout)
@ -270,16 +269,16 @@ object RemoteActorSerialization {
val actorInfo = actorInfoBuilder.build val actorInfo = actorInfoBuilder.build
val requestBuilder = RemoteRequestProtocol.newBuilder val requestBuilder = RemoteRequestProtocol.newBuilder
.setId(UUID.newUuid) .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build)
.setMessage(MessageSerializer.serialize(message)) .setMessage(MessageSerializer.serialize(message))
.setActorInfo(actorInfo) .setActorInfo(actorInfo)
.setIsOneWay(isOneWay) .setIsOneWay(isOneWay)
val id = registerSupervisorAsRemoteActor val id = registerSupervisorAsRemoteActor
if (id.isDefined) requestBuilder.setSupervisorUuid(id.get) if (id.isDefined) requestBuilder.setSupervisorUuid(UuidProtocol.newBuilder.setHigh(id.get.getTime).setLow(id.get.getClockSeqAndNode).build)
senderOption.foreach { sender => senderOption.foreach { sender =>
RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid, sender) RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid.toString, sender)
requestBuilder.setSender(toRemoteActorRefProtocol(sender)) requestBuilder.setSender(toRemoteActorRefProtocol(sender))
} }
requestBuilder requestBuilder

View file

@ -6,6 +6,7 @@ package se.scalablesolutions.akka.actor.ticket
import org.scalatest.Spec import org.scalatest.Spec
import org.scalatest.matchers.ShouldMatchers import org.scalatest.matchers.ShouldMatchers
import se.scalablesolutions.akka.actor.Actor._ import se.scalablesolutions.akka.actor.Actor._
import se.scalablesolutions.akka.actor.{Uuid,newUuid,uuidFrom}
import se.scalablesolutions.akka.actor.remote.ServerInitiatedRemoteActorSpec.RemoteActorSpecActorUnidirectional import se.scalablesolutions.akka.actor.remote.ServerInitiatedRemoteActorSpec.RemoteActorSpecActorUnidirectional
import java.util.concurrent.TimeUnit import java.util.concurrent.TimeUnit
import se.scalablesolutions.akka.remote.{RemoteClient, RemoteServer} import se.scalablesolutions.akka.remote.{RemoteClient, RemoteServer}
@ -32,14 +33,15 @@ class Ticket434Spec extends Spec with ShouldMatchers {
describe("The ActorInfoProtocol") { describe("The ActorInfoProtocol") {
it("should be possible to set the acor id and uuuid") { it("should be possible to set the acor id and uuuid") {
val uuid = newUuid
val actorInfoBuilder = ActorInfoProtocol.newBuilder val actorInfoBuilder = ActorInfoProtocol.newBuilder
.setUuid("unique-id") .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build)
.setId("some-id") .setId("some-id")
.setTarget("actorClassName") .setTarget("actorClassName")
.setTimeout(5000L) .setTimeout(5000L)
.setActorType(ActorType.SCALA_ACTOR) .setActorType(ActorType.SCALA_ACTOR)
val actorInfo = actorInfoBuilder.build val actorInfo = actorInfoBuilder.build
assert(actorInfo.getUuid === "unique-id") assert(uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow) === uuid)
assert(actorInfo.getId === "some-id") assert(actorInfo.getId === "some-id")
} }
} }

View file

@ -622,7 +622,7 @@ private[akka] abstract class ActorAspect {
protected var typedActor: TypedActor = _ protected var typedActor: TypedActor = _
protected var actorRef: ActorRef = _ protected var actorRef: ActorRef = _
protected var timeout: Long = _ protected var timeout: Long = _
protected var uuid: String = _ protected var uuid: Uuid = _
protected var remoteAddress: Option[InetSocketAddress] = _ protected var remoteAddress: Option[InetSocketAddress] = _
protected def localDispatch(joinPoint: JoinPoint): AnyRef = { protected def localDispatch(joinPoint: JoinPoint): AnyRef = {