From 8464fd5251cec964d250fa8f19c3ce6203990b9f Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 17 Sep 2010 16:04:25 +0200 Subject: [PATCH] Aaaaalmost there... --- .../src/main/scala/actor/ActorRef.scala | 28 +- .../src/main/scala/actor/ActorRegistry.scala | 4 +- .../src/main/scala/actor/Implicits.scala | 5 + .../src/main/scala/dispatch/Dispatchers.scala | 5 +- .../main/scala/dispatch/MessageHandling.scala | 4 +- akka-actor/src/main/scala/stm/Ref.scala | 4 +- .../src/main/scala/stm/TransactionalMap.scala | 4 +- .../main/scala/stm/TransactionalVector.scala | 4 +- .../src/main/scala/util/AkkaException.scala | 5 +- .../main/scala/util/ReflectiveAccess.scala | 14 +- akka-actor/src/main/scala/util/UUID.scala | 9 - ...rBasedEventDrivenDispatcherActorSpec.scala | 4 +- .../src/main/scala/ConsumerPublisher.scala | 8 +- .../main/scala/component/ActorComponent.scala | 12 +- .../src/main/scala/CassandraStorage.scala | 8 +- .../src/main/scala/MongoStorage.scala | 8 +- .../src/main/scala/RedisStorage.scala | 12 +- .../akka/remote/protocol/RemoteProtocol.java | 515 +++++++++++------- .../src/main/protocol/RemoteProtocol.proto | 6 +- .../src/main/scala/remote/RemoteClient.scala | 35 +- .../src/main/scala/remote/RemoteServer.scala | 23 +- .../serialization/SerializationProtocol.scala | 19 +- .../src/test/scala/ticket/Ticket434Spec.scala | 6 +- .../src/main/scala/actor/TypedActor.scala | 2 +- 24 files changed, 448 insertions(+), 296 deletions(-) delete mode 100644 akka-actor/src/main/scala/util/UUID.scala diff --git a/akka-actor/src/main/scala/actor/ActorRef.scala b/akka-actor/src/main/scala/actor/ActorRef.scala index 4905e62670..597e6bb1d1 100644 --- a/akka-actor/src/main/scala/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/actor/ActorRef.scala @@ -67,7 +67,7 @@ trait ActorRef extends java.lang.Comparable[ActorRef] { scalaRef: ScalaActorRef => // 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 _isShutDown = 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 * upon restart, remote restart etc. */ - @BeanProperty @volatile var id: String = _uuid + @BeanProperty @volatile var id: String = _uuid.toString /** * User overridable callback/setting. @@ -204,7 +204,7 @@ trait ActorRef extends /** * 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. @@ -249,7 +249,7 @@ trait ActorRef extends /** * 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 @@ -605,9 +605,9 @@ trait ActorRef extends 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] @@ -648,7 +648,7 @@ class LocalActorRef private[akka]( extends ActorRef with ScalaActorRef { @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 var isInInitialization = false @volatile private var runActorInitialization = false @@ -670,7 +670,7 @@ class LocalActorRef private[akka]( private[akka] def this(factory: () => Actor) = this(Right(Some(factory))) // used only for deserialization - private[akka] def this(__uuid: String, + private[akka] def this(__uuid: Uuid, __id: String, __hostname: String, __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 if (_supervisor.isDefined) { remoteAddress.foreach(address => RemoteClientModule.registerSupervisorForActor(address, this)) @@ -1104,9 +1104,9 @@ class LocalActorRef private[akka]( } else None } - protected[akka] def linkedActors: JMap[String, ActorRef] = guard.withGuard { + protected[akka] def linkedActors: JMap[Uuid, ActorRef] = guard.withGuard { if (_linkedActors.isEmpty) { - val actors = new ConcurrentHashMap[String, ActorRef] + val actors = new ConcurrentHashMap[Uuid, ActorRef] _linkedActors = Some(actors) actors } else _linkedActors.get @@ -1391,7 +1391,7 @@ private[akka] case class RemoteActorRef private[akka] ( */ 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)) @@ -1420,7 +1420,7 @@ private[akka] case class RemoteActorRef private[akka] ( 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 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 invoke(messageHandle: MessageInvocation): Unit = unsupported protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported @@ -1443,7 +1443,7 @@ trait ActorRefShared { /** * Returns the uuid for the actor. */ - def uuid: String + def uuid: Uuid /** * Shuts down and removes all linked actors. diff --git a/akka-actor/src/main/scala/actor/ActorRegistry.scala b/akka-actor/src/main/scala/actor/ActorRegistry.scala index 51bbfd3477..e425451470 100644 --- a/akka-actor/src/main/scala/actor/ActorRegistry.scala +++ b/akka-actor/src/main/scala/actor/ActorRegistry.scala @@ -35,7 +35,7 @@ case class ActorUnregistered(actor: ActorRef) extends ActorRegistryEvent * @author Jonas Bonér */ 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] /** @@ -112,7 +112,7 @@ object ActorRegistry extends ListenerManagement { /** * 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. diff --git a/akka-actor/src/main/scala/actor/Implicits.scala b/akka-actor/src/main/scala/actor/Implicits.scala index 604e5189b9..f228d45186 100644 --- a/akka-actor/src/main/scala/actor/Implicits.scala +++ b/akka-actor/src/main/scala/actor/Implicits.scala @@ -12,4 +12,9 @@ package object actor { implicit def scala2ActorRef(ref: ScalaActorRef): 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) } diff --git a/akka-actor/src/main/scala/dispatch/Dispatchers.scala b/akka-actor/src/main/scala/dispatch/Dispatchers.scala index 7e7904ec29..834a356954 100644 --- a/akka-actor/src/main/scala/dispatch/Dispatchers.scala +++ b/akka-actor/src/main/scala/dispatch/Dispatchers.scala @@ -9,7 +9,8 @@ import se.scalablesolutions.akka.config.Config.config import net.lag.configgy.ConfigMap import java.util.concurrent.ThreadPoolExecutor.{AbortPolicy, CallerRunsPolicy, DiscardOldestPolicy, DiscardPolicy} 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. @@ -171,7 +172,7 @@ object Dispatchers extends Logging { * Throws: IllegalArgumentException if the value of "type" is not valid */ 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) { b.configureIfPossible( builder => { diff --git a/akka-actor/src/main/scala/dispatch/MessageHandling.scala b/akka-actor/src/main/scala/dispatch/MessageHandling.scala index 25a02f2603..dd96583dcb 100644 --- a/akka-actor/src/main/scala/dispatch/MessageHandling.scala +++ b/akka-actor/src/main/scala/dispatch/MessageHandling.scala @@ -10,7 +10,7 @@ import org.multiverse.commitbarriers.CountDownCommitBarrier import se.scalablesolutions.akka.AkkaException import java.util.{Queue, List} import java.util.concurrent._ -import concurrent.forkjoin.LinkedTransferQueue +import se.scalablesolutions.akka.actor.Uuid import se.scalablesolutions.akka.util.{SimpleLock, Duration, HashCode, Logging} /** @@ -119,7 +119,7 @@ class DefaultBoundedMessageQueue(capacity: Int, pushTimeOut: Option[Duration], b * @author Jonas Bonér */ trait MessageDispatcher extends Logging { - protected val uuids = new ConcurrentSkipListSet[String] + protected val uuids = new ConcurrentSkipListSet[Uuid] def dispatch(invocation: MessageInvocation) diff --git a/akka-actor/src/main/scala/stm/Ref.scala b/akka-actor/src/main/scala/stm/Ref.scala index b0ae15c957..fc81dbafa9 100644 --- a/akka-actor/src/main/scala/stm/Ref.scala +++ b/akka-actor/src/main/scala/stm/Ref.scala @@ -4,7 +4,7 @@ package se.scalablesolutions.akka.stm -import se.scalablesolutions.akka.util.UUID +import se.scalablesolutions.akka.actor.{newUuid, Uuid} 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]) - val uuid = UUID.newUuid.toString + val uuid = newUuid.toString def swap(elem: T) = set(elem) diff --git a/akka-actor/src/main/scala/stm/TransactionalMap.scala b/akka-actor/src/main/scala/stm/TransactionalMap.scala index d45396ad25..457774f755 100644 --- a/akka-actor/src/main/scala/stm/TransactionalMap.scala +++ b/akka-actor/src/main/scala/stm/TransactionalMap.scala @@ -6,7 +6,7 @@ package se.scalablesolutions.akka.stm import scala.collection.immutable.HashMap -import se.scalablesolutions.akka.util.UUID +import se.scalablesolutions.akka.actor.{newUuid} 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] { def this() = this(HashMap[K, V]()) - val uuid = UUID.newUuid.toString + val uuid = newUuid.toString private[this] val ref = Ref(initialValue) diff --git a/akka-actor/src/main/scala/stm/TransactionalVector.scala b/akka-actor/src/main/scala/stm/TransactionalVector.scala index 2beeeecef0..3004e97db8 100644 --- a/akka-actor/src/main/scala/stm/TransactionalVector.scala +++ b/akka-actor/src/main/scala/stm/TransactionalVector.scala @@ -6,7 +6,7 @@ package se.scalablesolutions.akka.stm import scala.collection.immutable.Vector -import se.scalablesolutions.akka.util.UUID +import se.scalablesolutions.akka.actor.newUuid import org.multiverse.api.ThreadLocalTransaction.getThreadLocalTransaction @@ -24,7 +24,7 @@ object TransactionalVector { class TransactionalVector[T](initialValue: Vector[T]) extends Transactional with IndexedSeq[T] { def this() = this(Vector[T]()) - val uuid = UUID.newUuid.toString + val uuid = newUuid.toString private[this] val ref = Ref(initialValue) diff --git a/akka-actor/src/main/scala/util/AkkaException.scala b/akka-actor/src/main/scala/util/AkkaException.scala index 3e28c17390..0eb06549b4 100644 --- a/akka-actor/src/main/scala/util/AkkaException.scala +++ b/akka-actor/src/main/scala/util/AkkaException.scala @@ -4,7 +4,8 @@ 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.net.{InetAddress, UnknownHostException} @@ -23,7 +24,7 @@ import java.net.{InetAddress, UnknownHostException} import AkkaException._ 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) diff --git a/akka-actor/src/main/scala/util/ReflectiveAccess.scala b/akka-actor/src/main/scala/util/ReflectiveAccess.scala index abccd5d9b0..e5daf2ca5a 100644 --- a/akka-actor/src/main/scala/util/ReflectiveAccess.scala +++ b/akka-actor/src/main/scala/util/ReflectiveAccess.scala @@ -7,7 +7,7 @@ package se.scalablesolutions.akka.util import se.scalablesolutions.akka.actor.{ActorRef, IllegalActorStateException, ActorType} import se.scalablesolutions.akka.dispatch.{Future, CompletableFuture} import se.scalablesolutions.akka.config.{Config, ModuleNotAvailableException} - +import se.scalablesolutions.akka.actor.Uuid import java.net.InetSocketAddress import se.scalablesolutions.akka.stm.Transaction import se.scalablesolutions.akka.AkkaException @@ -51,8 +51,8 @@ object ReflectiveAccess { } type RemoteClientObject = { - def register(hostname: String, port: Int, uuid: String): Unit - def unregister(hostname: String, port: Int, uuid: String): Unit + def register(hostname: String, port: Int, uuid: Uuid): Unit + def unregister(hostname: String, port: Int, uuid: Uuid): Unit def clientFor(address: InetSocketAddress): RemoteClient def clientFor(hostname: String, port: Int, loader: Option[ClassLoader]): RemoteClient } @@ -65,12 +65,12 @@ object ReflectiveAccess { val remoteClientObjectInstance: Option[RemoteClientObject] = getObject("se.scalablesolutions.akka.remote.RemoteClient$") - def register(address: InetSocketAddress, uuid: String) = { + def register(address: InetSocketAddress, uuid: Uuid) = { ensureRemotingEnabled remoteClientObjectInstance.get.register(address.getHostName, address.getPort, uuid) } - def unregister(address: InetSocketAddress, uuid: String) = { + def unregister(address: InetSocketAddress, uuid: Uuid) = { ensureRemotingEnabled remoteClientObjectInstance.get.unregister(address.getHostName, address.getPort, uuid) } @@ -112,7 +112,7 @@ object ReflectiveAccess { val PORT = Config.config.getInt("akka.remote.server.port", 9999) 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 } @@ -126,7 +126,7 @@ object ReflectiveAccess { val remoteNodeObjectInstance: Option[RemoteNodeObject] = getObject("se.scalablesolutions.akka.remote.RemoteNode$") - def registerActor(address: InetSocketAddress, uuid: String, actorRef: ActorRef) = { + def registerActor(address: InetSocketAddress, uuid: Uuid, actorRef: ActorRef) = { ensureRemotingEnabled remoteServerObjectInstance.get.registerActor(address, uuid, actorRef) } diff --git a/akka-actor/src/main/scala/util/UUID.scala b/akka-actor/src/main/scala/util/UUID.scala deleted file mode 100644 index 548f014e58..0000000000 --- a/akka-actor/src/main/scala/util/UUID.scala +++ /dev/null @@ -1,9 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ - -package se.scalablesolutions.akka.util - -object UUID { - def newUuid = new com.eaio.uuid.UUID() -} \ No newline at end of file diff --git a/akka-actor/src/test/scala/dispatch/ExecutorBasedEventDrivenDispatcherActorSpec.scala b/akka-actor/src/test/scala/dispatch/ExecutorBasedEventDrivenDispatcherActorSpec.scala index 3935bc9b0b..95931df98b 100644 --- a/akka-actor/src/test/scala/dispatch/ExecutorBasedEventDrivenDispatcherActorSpec.scala +++ b/akka-actor/src/test/scala/dispatch/ExecutorBasedEventDrivenDispatcherActorSpec.scala @@ -10,7 +10,7 @@ import java.util.concurrent.atomic.{AtomicBoolean, AtomicInteger} object ExecutorBasedEventDrivenDispatcherActorSpec { class TestActor extends Actor { - self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid) + self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid.toString) def receive = { case "Hello" => self.reply("World") @@ -23,7 +23,7 @@ object ExecutorBasedEventDrivenDispatcherActorSpec { val oneWay = new CountDownLatch(1) } class OneWayTestActor extends Actor { - self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid) + self.dispatcher = Dispatchers.newExecutorBasedEventDrivenDispatcher(self.uuid.toString) def receive = { case "OneWay" => OneWayTestActor.oneWay.countDown } diff --git a/akka-camel/src/main/scala/ConsumerPublisher.scala b/akka-camel/src/main/scala/ConsumerPublisher.scala index c0b64021af..472d7d6dad 100644 --- a/akka-camel/src/main/scala/ConsumerPublisher.scala +++ b/akka-camel/src/main/scala/ConsumerPublisher.scala @@ -31,7 +31,7 @@ private[camel] object ConsumerPublisher extends Logging { * Stops route to the already un-registered consumer actor. */ 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)) } @@ -143,7 +143,7 @@ private[camel] abstract class ConsumerRoute(endpointUri: String, id: String) ext * * @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) } @@ -229,7 +229,7 @@ private[camel] sealed trait ConsumerEvent * * @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. @@ -240,7 +240,7 @@ private[camel] case class ConsumerRegistered(actorRef: ActorRef, uri: String, uu * * @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 @consume diff --git a/akka-camel/src/main/scala/component/ActorComponent.scala b/akka-camel/src/main/scala/component/ActorComponent.scala index 6c1c5902fa..ccd4c63f0c 100644 --- a/akka-camel/src/main/scala/component/ActorComponent.scala +++ b/akka-camel/src/main/scala/component/ActorComponent.scala @@ -18,7 +18,7 @@ import se.scalablesolutions.akka.camel.{Failure, CamelMessageConversion, Message import CamelMessageConversion.toExchangeAdapter import se.scalablesolutions.akka.dispatch.{CompletableFuture, MessageInvocation, MessageDispatcher} 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 scala.reflect.BeanProperty @@ -37,11 +37,11 @@ class ActorComponent extends DefaultComponent { 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 { case 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( "invalid path format: %s - should be or id: or uuid:" format remaining) } @@ -64,7 +64,7 @@ class ActorComponent extends DefaultComponent { class ActorEndpoint(uri: String, comp: ActorComponent, 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 @@ -151,7 +151,7 @@ class ActorProducer(val ep: ActorEndpoint) extends DefaultProducer(ep) with Asyn 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 restartLinkedActors(reason: Throwable, maxNrOfRetries: Option[Int], withinTimeRange: Option[Int]): 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 invoke(messageHandle: MessageInvocation): Unit = unsupported protected[akka] def remoteAddress_=(addr: Option[InetSocketAddress]): Unit = unsupported diff --git a/akka-persistence/akka-persistence-cassandra/src/main/scala/CassandraStorage.scala b/akka-persistence/akka-persistence-cassandra/src/main/scala/CassandraStorage.scala index 0c6f239ef7..b3867b9492 100644 --- a/akka-persistence/akka-persistence-cassandra/src/main/scala/CassandraStorage.scala +++ b/akka-persistence/akka-persistence-cassandra/src/main/scala/CassandraStorage.scala @@ -4,16 +4,16 @@ package se.scalablesolutions.akka.persistence.cassandra -import se.scalablesolutions.akka.util.UUID import se.scalablesolutions.akka.stm._ import se.scalablesolutions.akka.persistence.common._ +import se.scalablesolutions.akka.actor.{newUuid} object CassandraStorage extends Storage { type ElementType = Array[Byte] - def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) - def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) - def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) + def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString) + def newVector: PersistentVector[ElementType] = newVector(newUuid.toString) + def newRef: PersistentRef[ElementType] = newRef(newUuid.toString) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id) diff --git a/akka-persistence/akka-persistence-mongo/src/main/scala/MongoStorage.scala b/akka-persistence/akka-persistence-mongo/src/main/scala/MongoStorage.scala index 83e47e3ba5..6bd99ee3e1 100644 --- a/akka-persistence/akka-persistence-mongo/src/main/scala/MongoStorage.scala +++ b/akka-persistence/akka-persistence-mongo/src/main/scala/MongoStorage.scala @@ -6,14 +6,14 @@ package se.scalablesolutions.akka.persistence.mongo import se.scalablesolutions.akka.stm._ import se.scalablesolutions.akka.persistence.common._ -import se.scalablesolutions.akka.util.UUID +import se.scalablesolutions.akka.actor.{newUuid} object MongoStorage extends Storage { type ElementType = Array[Byte] - def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) - def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) - def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) + def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString) + def newVector: PersistentVector[ElementType] = newVector(newUuid.toString) + def newRef: PersistentRef[ElementType] = newRef(newUuid.toString) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id) diff --git a/akka-persistence/akka-persistence-redis/src/main/scala/RedisStorage.scala b/akka-persistence/akka-persistence-redis/src/main/scala/RedisStorage.scala index 1eca775567..9055b6717c 100644 --- a/akka-persistence/akka-persistence-redis/src/main/scala/RedisStorage.scala +++ b/akka-persistence/akka-persistence-redis/src/main/scala/RedisStorage.scala @@ -4,18 +4,18 @@ 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.persistence.common._ object RedisStorage extends Storage { type ElementType = Array[Byte] - def newMap: PersistentMap[ElementType, ElementType] = newMap(UUID.newUuid.toString) - def newVector: PersistentVector[ElementType] = newVector(UUID.newUuid.toString) - def newRef: PersistentRef[ElementType] = newRef(UUID.newUuid.toString) - override def newQueue: PersistentQueue[ElementType] = newQueue(UUID.newUuid.toString) - override def newSortedSet: PersistentSortedSet[ElementType] = newSortedSet(UUID.newUuid.toString) + def newMap: PersistentMap[ElementType, ElementType] = newMap(newUuid.toString) + def newVector: PersistentVector[ElementType] = newVector(newUuid.toString) + def newRef: PersistentRef[ElementType] = newRef(newUuid.toString) + override def newQueue: PersistentQueue[ElementType] = newQueue(newUuid.toString) + override def newSortedSet: PersistentSortedSet[ElementType] = newSortedSet(newUuid.toString) def getMap(id: String): PersistentMap[ElementType, ElementType] = newMap(id) def getVector(id: String): PersistentVector[ElementType] = newVector(id) diff --git a/akka-remote/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java b/akka-remote/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java index ab05937f61..bc7e21a870 100644 --- a/akka-remote/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java +++ b/akka-remote/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java @@ -244,12 +244,12 @@ public final class RemoteProtocol { return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteActorRefProtocol_fieldAccessorTable; } - // required string uuid = 1; - public static final int UUID_FIELD_NUMBER = 1; - private boolean hasUuid; - private java.lang.String uuid_ = ""; - public boolean hasUuid() { return hasUuid; } - public java.lang.String getUuid() { return uuid_; } + // required string classOrServiceName = 1; + public static final int CLASSORSERVICENAME_FIELD_NUMBER = 1; + private boolean hasClassOrServiceName; + private java.lang.String classOrServiceName_ = ""; + public boolean hasClassOrServiceName() { return hasClassOrServiceName; } + public java.lang.String getClassOrServiceName() { return classOrServiceName_; } // required string actorClassname = 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(); } public final boolean isInitialized() { - if (!hasUuid) return false; + if (!hasClassOrServiceName) return false; if (!hasActorClassname) return false; if (!hasHomeAddress) return false; if (!getHomeAddress().isInitialized()) return false; @@ -286,8 +286,8 @@ public final class RemoteProtocol { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasUuid()) { - output.writeString(1, getUuid()); + if (hasClassOrServiceName()) { + output.writeString(1, getClassOrServiceName()); } if (hasActorClassname()) { output.writeString(2, getActorClassname()); @@ -307,9 +307,9 @@ public final class RemoteProtocol { if (size != -1) return size; size = 0; - if (hasUuid()) { + if (hasClassOrServiceName()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getUuid()); + .computeStringSize(1, getClassOrServiceName()); } if (hasActorClassname()) { size += com.google.protobuf.CodedOutputStream @@ -481,8 +481,8 @@ public final class RemoteProtocol { 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.hasUuid()) { - setUuid(other.getUuid()); + if (other.hasClassOrServiceName()) { + setClassOrServiceName(other.getClassOrServiceName()); } if (other.hasActorClassname()) { setActorClassname(other.getActorClassname()); @@ -519,7 +519,7 @@ public final class RemoteProtocol { break; } case 10: { - setUuid(input.readString()); + setClassOrServiceName(input.readString()); break; } case 18: { @@ -544,24 +544,24 @@ public final class RemoteProtocol { } - // required string uuid = 1; - public boolean hasUuid() { - return result.hasUuid(); + // required string classOrServiceName = 1; + public boolean hasClassOrServiceName() { + return result.hasClassOrServiceName(); } - public java.lang.String getUuid() { - return result.getUuid(); + public java.lang.String getClassOrServiceName() { + return result.getClassOrServiceName(); } - public Builder setUuid(java.lang.String value) { + public Builder setClassOrServiceName(java.lang.String value) { if (value == null) { throw new NullPointerException(); } - result.hasUuid = true; - result.uuid_ = value; + result.hasClassOrServiceName = true; + result.classOrServiceName_ = value; return this; } - public Builder clearUuid() { - result.hasUuid = false; - result.uuid_ = getDefaultInstance().getUuid(); + public Builder clearClassOrServiceName() { + result.hasClassOrServiceName = false; + result.classOrServiceName_ = getDefaultInstance().getClassOrServiceName(); return this; } @@ -680,12 +680,12 @@ public final class RemoteProtocol { 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; private boolean hasUuid; - private java.lang.String uuid_ = ""; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_; 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; public static final int ID_FIELD_NUMBER = 2; @@ -777,6 +777,7 @@ public final class RemoteProtocol { } private void initFields() { + uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); originalAddress_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance(); lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance(); supervisor_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance(); @@ -786,6 +787,7 @@ public final class RemoteProtocol { if (!hasId) return false; if (!hasActorClassname) return false; if (!hasOriginalAddress) return false; + if (!getUuid().isInitialized()) return false; if (!getOriginalAddress().isInitialized()) return false; if (hasLifeCycle()) { if (!getLifeCycle().isInitialized()) return false; @@ -803,7 +805,7 @@ public final class RemoteProtocol { throws java.io.IOException { getSerializedSize(); if (hasUuid()) { - output.writeString(1, getUuid()); + output.writeMessage(1, getUuid()); } if (hasId()) { output.writeString(2, getId()); @@ -852,7 +854,7 @@ public final class RemoteProtocol { size = 0; if (hasUuid()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getUuid()); + .computeMessageSize(1, getUuid()); } if (hasId()) { size += com.google.protobuf.CodedOutputStream @@ -1065,7 +1067,7 @@ public final class RemoteProtocol { 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.hasUuid()) { - setUuid(other.getUuid()); + mergeUuid(other.getUuid()); } if (other.hasId()) { setId(other.getId()); @@ -1132,7 +1134,12 @@ public final class RemoteProtocol { break; } 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; } case 18: { @@ -1205,24 +1212,40 @@ public final class RemoteProtocol { } - // required string uuid = 1; + // required .UuidProtocol uuid = 1; public boolean hasUuid() { return result.hasUuid(); } - public java.lang.String getUuid() { + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol 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) { - throw new NullPointerException(); - } - result.hasUuid = true; + throw new NullPointerException(); + } + result.hasUuid = true; result.uuid_ = value; 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() { result.hasUuid = false; - result.uuid_ = getDefaultInstance().getUuid(); + result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -1966,12 +1989,12 @@ public final class RemoteProtocol { 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; private boolean hasUuid; - private java.lang.String uuid_ = ""; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_; 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; public static final int TARGET_FIELD_NUMBER = 2; @@ -2009,6 +2032,7 @@ public final class RemoteProtocol { public java.lang.String getId() { return id_; } private void initFields() { + uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); actorType_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.SCALA_ACTOR; typedActorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance(); } @@ -2017,6 +2041,7 @@ public final class RemoteProtocol { if (!hasTarget) return false; if (!hasTimeout) return false; if (!hasActorType) return false; + if (!getUuid().isInitialized()) return false; if (hasTypedActorInfo()) { if (!getTypedActorInfo().isInitialized()) return false; } @@ -2027,7 +2052,7 @@ public final class RemoteProtocol { throws java.io.IOException { getSerializedSize(); if (hasUuid()) { - output.writeString(1, getUuid()); + output.writeMessage(1, getUuid()); } if (hasTarget()) { output.writeString(2, getTarget()); @@ -2055,7 +2080,7 @@ public final class RemoteProtocol { size = 0; if (hasUuid()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getUuid()); + .computeMessageSize(1, getUuid()); } if (hasTarget()) { size += com.google.protobuf.CodedOutputStream @@ -2236,7 +2261,7 @@ public final class RemoteProtocol { 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.hasUuid()) { - setUuid(other.getUuid()); + mergeUuid(other.getUuid()); } if (other.hasTarget()) { setTarget(other.getTarget()); @@ -2279,7 +2304,12 @@ public final class RemoteProtocol { break; } 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; } case 18: { @@ -2318,24 +2348,40 @@ public final class RemoteProtocol { } - // required string uuid = 1; + // required .UuidProtocol uuid = 1; public boolean hasUuid() { return result.hasUuid(); } - public java.lang.String getUuid() { + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol 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) { - throw new NullPointerException(); - } - result.hasUuid = true; + throw new NullPointerException(); + } + result.hasUuid = true; result.uuid_ = value; 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() { result.hasUuid = false; - result.uuid_ = getDefaultInstance().getUuid(); + result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -2827,12 +2873,12 @@ public final class RemoteProtocol { return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteRequestProtocol_fieldAccessorTable; } - // required uint64 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private boolean hasId; - private long id_ = 0L; - public boolean hasId() { return hasId; } - public long getId() { return id_; } + // required .UuidProtocol uuid = 1; + public static final int UUID_FIELD_NUMBER = 1; + private boolean hasUuid; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_; + public boolean hasUuid() { return hasUuid; } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; } // required .MessageProtocol message = 2; public static final int MESSAGE_FIELD_NUMBER = 2; @@ -2855,12 +2901,12 @@ public final class RemoteProtocol { public boolean hasIsOneWay() { return hasIsOneWay; } public boolean getIsOneWay() { return isOneWay_; } - // optional string supervisorUuid = 5; + // optional .UuidProtocol supervisorUuid = 5; public static final int SUPERVISORUUID_FIELD_NUMBER = 5; private boolean hasSupervisorUuid; - private java.lang.String supervisorUuid_ = ""; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol supervisorUuid_; 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; public static final int SENDER_FIELD_NUMBER = 6; @@ -2882,17 +2928,23 @@ public final class RemoteProtocol { } private void initFields() { + uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.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(); } public final boolean isInitialized() { - if (!hasId) return false; + if (!hasUuid) return false; if (!hasMessage) return false; if (!hasActorInfo) return false; if (!hasIsOneWay) return false; + if (!getUuid().isInitialized()) return false; if (!getMessage().isInitialized()) return false; if (!getActorInfo().isInitialized()) return false; + if (hasSupervisorUuid()) { + if (!getSupervisorUuid().isInitialized()) return false; + } if (hasSender()) { if (!getSender().isInitialized()) return false; } @@ -2905,8 +2957,8 @@ public final class RemoteProtocol { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasId()) { - output.writeUInt64(1, getId()); + if (hasUuid()) { + output.writeMessage(1, getUuid()); } if (hasMessage()) { output.writeMessage(2, getMessage()); @@ -2918,7 +2970,7 @@ public final class RemoteProtocol { output.writeBool(4, getIsOneWay()); } if (hasSupervisorUuid()) { - output.writeString(5, getSupervisorUuid()); + output.writeMessage(5, getSupervisorUuid()); } if (hasSender()) { output.writeMessage(6, getSender()); @@ -2935,9 +2987,9 @@ public final class RemoteProtocol { if (size != -1) return size; size = 0; - if (hasId()) { + if (hasUuid()) { size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, getId()); + .computeMessageSize(1, getUuid()); } if (hasMessage()) { size += com.google.protobuf.CodedOutputStream @@ -2953,7 +3005,7 @@ public final class RemoteProtocol { } if (hasSupervisorUuid()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(5, getSupervisorUuid()); + .computeMessageSize(5, getSupervisorUuid()); } if (hasSender()) { size += com.google.protobuf.CodedOutputStream @@ -3125,8 +3177,8 @@ public final class RemoteProtocol { 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.hasId()) { - setId(other.getId()); + if (other.hasUuid()) { + mergeUuid(other.getUuid()); } if (other.hasMessage()) { mergeMessage(other.getMessage()); @@ -3138,7 +3190,7 @@ public final class RemoteProtocol { setIsOneWay(other.getIsOneWay()); } if (other.hasSupervisorUuid()) { - setSupervisorUuid(other.getSupervisorUuid()); + mergeSupervisorUuid(other.getSupervisorUuid()); } if (other.hasSender()) { mergeSender(other.getSender()); @@ -3174,8 +3226,13 @@ public final class RemoteProtocol { } break; } - case 8: { - setId(input.readUInt64()); + case 10: { + 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; } case 18: { @@ -3201,7 +3258,12 @@ public final class RemoteProtocol { break; } 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; } case 50: { @@ -3224,21 +3286,40 @@ public final class RemoteProtocol { } - // required uint64 id = 1; - public boolean hasId() { - return result.hasId(); + // required .UuidProtocol uuid = 1; + public boolean hasUuid() { + return result.hasUuid(); } - public long getId() { - return result.getId(); + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { + return result.getUuid(); } - public Builder setId(long value) { - result.hasId = true; - result.id_ = value; + public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasUuid = true; + result.uuid_ = value; return this; } - public Builder clearId() { - result.hasId = false; - result.id_ = 0L; + 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() { + result.hasUuid = false; + result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -3334,24 +3415,40 @@ public final class RemoteProtocol { return this; } - // optional string supervisorUuid = 5; + // optional .UuidProtocol supervisorUuid = 5; public boolean hasSupervisorUuid() { return result.hasSupervisorUuid(); } - public java.lang.String getSupervisorUuid() { + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol 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) { - throw new NullPointerException(); - } - result.hasSupervisorUuid = true; + throw new NullPointerException(); + } + result.hasSupervisorUuid = true; result.supervisorUuid_ = value; 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() { result.hasSupervisorUuid = false; - result.supervisorUuid_ = getDefaultInstance().getSupervisorUuid(); + result.supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -3482,12 +3579,12 @@ public final class RemoteProtocol { return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_RemoteReplyProtocol_fieldAccessorTable; } - // required uint64 id = 1; - public static final int ID_FIELD_NUMBER = 1; - private boolean hasId; - private long id_ = 0L; - public boolean hasId() { return hasId; } - public long getId() { return id_; } + // required .UuidProtocol uuid = 1; + public static final int UUID_FIELD_NUMBER = 1; + private boolean hasUuid; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol uuid_; + public boolean hasUuid() { return hasUuid; } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { return uuid_; } // optional .MessageProtocol message = 2; public static final int MESSAGE_FIELD_NUMBER = 2; @@ -3503,12 +3600,12 @@ public final class RemoteProtocol { public boolean hasException() { return hasException; } 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; private boolean hasSupervisorUuid; - private java.lang.String supervisorUuid_ = ""; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol supervisorUuid_; 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; public static final int ISACTOR_FIELD_NUMBER = 5; @@ -3537,19 +3634,25 @@ public final class RemoteProtocol { } private void initFields() { + uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance(); exception_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance(); + supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); } public final boolean isInitialized() { - if (!hasId) return false; + if (!hasUuid) return false; if (!hasIsActor) return false; if (!hasIsSuccessful) return false; + if (!getUuid().isInitialized()) return false; if (hasMessage()) { if (!getMessage().isInitialized()) return false; } if (hasException()) { if (!getException().isInitialized()) return false; } + if (hasSupervisorUuid()) { + if (!getSupervisorUuid().isInitialized()) return false; + } for (se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MetadataEntryProtocol element : getMetadataList()) { if (!element.isInitialized()) return false; } @@ -3559,8 +3662,8 @@ public final class RemoteProtocol { public void writeTo(com.google.protobuf.CodedOutputStream output) throws java.io.IOException { getSerializedSize(); - if (hasId()) { - output.writeUInt64(1, getId()); + if (hasUuid()) { + output.writeMessage(1, getUuid()); } if (hasMessage()) { output.writeMessage(2, getMessage()); @@ -3569,7 +3672,7 @@ public final class RemoteProtocol { output.writeMessage(3, getException()); } if (hasSupervisorUuid()) { - output.writeString(4, getSupervisorUuid()); + output.writeMessage(4, getSupervisorUuid()); } if (hasIsActor()) { output.writeBool(5, getIsActor()); @@ -3589,9 +3692,9 @@ public final class RemoteProtocol { if (size != -1) return size; size = 0; - if (hasId()) { + if (hasUuid()) { size += com.google.protobuf.CodedOutputStream - .computeUInt64Size(1, getId()); + .computeMessageSize(1, getUuid()); } if (hasMessage()) { size += com.google.protobuf.CodedOutputStream @@ -3603,7 +3706,7 @@ public final class RemoteProtocol { } if (hasSupervisorUuid()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(4, getSupervisorUuid()); + .computeMessageSize(4, getSupervisorUuid()); } if (hasIsActor()) { size += com.google.protobuf.CodedOutputStream @@ -3779,8 +3882,8 @@ public final class RemoteProtocol { 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.hasId()) { - setId(other.getId()); + if (other.hasUuid()) { + mergeUuid(other.getUuid()); } if (other.hasMessage()) { mergeMessage(other.getMessage()); @@ -3789,7 +3892,7 @@ public final class RemoteProtocol { mergeException(other.getException()); } if (other.hasSupervisorUuid()) { - setSupervisorUuid(other.getSupervisorUuid()); + mergeSupervisorUuid(other.getSupervisorUuid()); } if (other.hasIsActor()) { setIsActor(other.getIsActor()); @@ -3828,8 +3931,13 @@ public final class RemoteProtocol { } break; } - case 8: { - setId(input.readUInt64()); + case 10: { + 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; } case 18: { @@ -3851,7 +3959,12 @@ public final class RemoteProtocol { break; } 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; } case 40: { @@ -3873,21 +3986,40 @@ public final class RemoteProtocol { } - // required uint64 id = 1; - public boolean hasId() { - return result.hasId(); + // required .UuidProtocol uuid = 1; + public boolean hasUuid() { + return result.hasUuid(); } - public long getId() { - return result.getId(); + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol getUuid() { + return result.getUuid(); } - public Builder setId(long value) { - result.hasId = true; - result.id_ = value; + public Builder setUuid(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasUuid = true; + result.uuid_ = value; return this; } - public Builder clearId() { - result.hasId = false; - result.id_ = 0L; + 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() { + result.hasUuid = false; + result.uuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -3965,24 +4097,40 @@ public final class RemoteProtocol { return this; } - // optional string supervisorUuid = 4; + // optional .UuidProtocol supervisorUuid = 4; public boolean hasSupervisorUuid() { return result.hasSupervisorUuid(); } - public java.lang.String getSupervisorUuid() { + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol 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) { - throw new NullPointerException(); - } - result.hasSupervisorUuid = true; + throw new NullPointerException(); + } + result.hasSupervisorUuid = true; result.supervisorUuid_ = value; 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() { result.hasSupervisorUuid = false; - result.supervisorUuid_ = getDefaultInstance().getSupervisorUuid(); + result.supervisorUuid_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.UuidProtocol.getDefaultInstance(); return this; } @@ -5764,52 +5912,55 @@ public final class RemoteProtocol { descriptor; static { java.lang.String[] descriptorData = { - "\n\024RemoteProtocol.proto\"v\n\026RemoteActorRef" + - "Protocol\022\014\n\004uuid\030\001 \002(\t\022\026\n\016actorClassname" + - "\030\002 \002(\t\022%\n\013homeAddress\030\003 \002(\0132\020.AddressPro" + - "tocol\022\017\n\007timeout\030\004 \001(\004\"\200\003\n\032SerializedAct" + - "orRefProtocol\022\014\n\004uuid\030\001 \002(\t\022\n\n\002id\030\002 \002(\t\022" + - "\026\n\016actorClassname\030\003 \002(\t\022)\n\017originalAddre" + - "ss\030\004 \002(\0132\020.AddressProtocol\022\025\n\ractorInsta" + - "nce\030\005 \001(\014\022\033\n\023serializerClassname\030\006 \001(\t\022\024" + - "\n\014isTransactor\030\007 \001(\010\022\017\n\007timeout\030\010 \001(\004\022\026\n" + - "\016receiveTimeout\030\t \001(\004\022%\n\tlifeCycle\030\n \001(\013", - "2\022.LifeCycleProtocol\022+\n\nsupervisor\030\013 \001(\013" + - "2\027.RemoteActorRefProtocol\022\024\n\014hotswapStac" + - "k\030\014 \001(\014\022(\n\010messages\030\r \003(\0132\026.RemoteReques" + - "tProtocol\"r\n\017MessageProtocol\0225\n\023serializ" + - "ationScheme\030\001 \002(\0162\030.SerializationSchemeT" + - "ype\022\017\n\007message\030\002 \002(\014\022\027\n\017messageManifest\030" + - "\003 \001(\014\"\236\001\n\021ActorInfoProtocol\022\014\n\004uuid\030\001 \002(" + - "\t\022\016\n\006target\030\002 \002(\t\022\017\n\007timeout\030\003 \002(\004\022\035\n\tac" + - "torType\030\004 \002(\0162\n.ActorType\022/\n\016typedActorI" + - "nfo\030\005 \001(\0132\027.TypedActorInfoProtocol\022\n\n\002id", - "\030\006 \001(\t\";\n\026TypedActorInfoProtocol\022\021\n\tinte" + - "rface\030\001 \002(\t\022\016\n\006method\030\002 \002(\t\"\352\001\n\025RemoteRe" + - "questProtocol\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \002" + - "(\0132\020.MessageProtocol\022%\n\tactorInfo\030\003 \002(\0132" + - "\022.ActorInfoProtocol\022\020\n\010isOneWay\030\004 \002(\010\022\026\n" + - "\016supervisorUuid\030\005 \001(\t\022\'\n\006sender\030\006 \001(\0132\027." + - "RemoteActorRefProtocol\022(\n\010metadata\030\007 \003(\013" + - "2\026.MetadataEntryProtocol\"\324\001\n\023RemoteReply" + - "Protocol\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \001(\0132\020." + - "MessageProtocol\022%\n\texception\030\003 \001(\0132\022.Exc", - "eptionProtocol\022\026\n\016supervisorUuid\030\004 \001(\t\022\017" + - "\n\007isActor\030\005 \002(\010\022\024\n\014isSuccessful\030\006 \002(\010\022(\n" + - "\010metadata\030\007 \003(\0132\026.MetadataEntryProtocol\"" + - ")\n\014UuidProtocol\022\014\n\004high\030\001 \002(\004\022\013\n\003low\030\002 \002" + - "(\004\"3\n\025MetadataEntryProtocol\022\013\n\003key\030\001 \002(\t" + - "\022\r\n\005value\030\002 \002(\014\"6\n\021LifeCycleProtocol\022!\n\t" + - "lifeCycle\030\001 \002(\0162\016.LifeCycleType\"1\n\017Addre" + - "ssProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 \002" + - "(\r\"7\n\021ExceptionProtocol\022\021\n\tclassname\030\001 \002" + - "(\t\022\017\n\007message\030\002 \002(\t*=\n\tActorType\022\017\n\013SCAL", - "A_ACTOR\020\001\022\016\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACTOR" + - "\020\003*]\n\027SerializationSchemeType\022\010\n\004JAVA\020\001\022" + - "\013\n\007SBINARY\020\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JSO" + - "N\020\004\022\014\n\010PROTOBUF\020\005*-\n\rLifeCycleType\022\r\n\tPE" + - "RMANENT\020\001\022\r\n\tTEMPORARY\020\002B-\n)se.scalables" + - "olutions.akka.remote.protocolH\001" + "\n\024RemoteProtocol.proto\"\204\001\n\026RemoteActorRe" + + "fProtocol\022\032\n\022classOrServiceName\030\001 \002(\t\022\026\n" + + "\016actorClassname\030\002 \002(\t\022%\n\013homeAddress\030\003 \002" + + "(\0132\020.AddressProtocol\022\017\n\007timeout\030\004 \001(\004\"\217\003" + + "\n\032SerializedActorRefProtocol\022\033\n\004uuid\030\001 \002" + + "(\0132\r.UuidProtocol\022\n\n\002id\030\002 \002(\t\022\026\n\016actorCl" + + "assname\030\003 \002(\t\022)\n\017originalAddress\030\004 \002(\0132\020" + + ".AddressProtocol\022\025\n\ractorInstance\030\005 \001(\014\022" + + "\033\n\023serializerClassname\030\006 \001(\t\022\024\n\014isTransa" + + "ctor\030\007 \001(\010\022\017\n\007timeout\030\010 \001(\004\022\026\n\016receiveTi", + "meout\030\t \001(\004\022%\n\tlifeCycle\030\n \001(\0132\022.LifeCyc" + + "leProtocol\022+\n\nsupervisor\030\013 \001(\0132\027.RemoteA" + + "ctorRefProtocol\022\024\n\014hotswapStack\030\014 \001(\014\022(\n" + + "\010messages\030\r \003(\0132\026.RemoteRequestProtocol\"" + + "r\n\017MessageProtocol\0225\n\023serializationSchem" + + "e\030\001 \002(\0162\030.SerializationSchemeType\022\017\n\007mes" + + "sage\030\002 \002(\014\022\027\n\017messageManifest\030\003 \001(\014\"\255\001\n\021" + + "ActorInfoProtocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidPr" + + "otocol\022\016\n\006target\030\002 \002(\t\022\017\n\007timeout\030\003 \002(\004\022" + + "\035\n\tactorType\030\004 \002(\0162\n.ActorType\022/\n\016typedA", + "ctorInfo\030\005 \001(\0132\027.TypedActorInfoProtocol\022" + + "\n\n\002id\030\006 \001(\t\";\n\026TypedActorInfoProtocol\022\021\n" + + "\tinterface\030\001 \002(\t\022\016\n\006method\030\002 \002(\t\"\212\002\n\025Rem" + + "oteRequestProtocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidP" + + "rotocol\022!\n\007message\030\002 \002(\0132\020.MessageProtoc" + + "ol\022%\n\tactorInfo\030\003 \002(\0132\022.ActorInfoProtoco" + + "l\022\020\n\010isOneWay\030\004 \002(\010\022%\n\016supervisorUuid\030\005 " + + "\001(\0132\r.UuidProtocol\022\'\n\006sender\030\006 \001(\0132\027.Rem" + + "oteActorRefProtocol\022(\n\010metadata\030\007 \003(\0132\026." + + "MetadataEntryProtocol\"\364\001\n\023RemoteReplyPro", + "tocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidProtocol\022!\n\007me" + + "ssage\030\002 \001(\0132\020.MessageProtocol\022%\n\texcepti" + + "on\030\003 \001(\0132\022.ExceptionProtocol\022%\n\016supervis" + + "orUuid\030\004 \001(\0132\r.UuidProtocol\022\017\n\007isActor\030\005" + + " \002(\010\022\024\n\014isSuccessful\030\006 \002(\010\022(\n\010metadata\030\007" + + " \003(\0132\026.MetadataEntryProtocol\")\n\014UuidProt" + + "ocol\022\014\n\004high\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025Metad" + + "ataEntryProtocol\022\013\n\003key\030\001 \002(\t\022\r\n\005value\030\002" + + " \002(\014\"6\n\021LifeCycleProtocol\022!\n\tlifeCycle\030\001" + + " \002(\0162\016.LifeCycleType\"1\n\017AddressProtocol\022", + "\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\"7\n\021Excep" + + "tionProtocol\022\021\n\tclassname\030\001 \002(\t\022\017\n\007messa" + + "ge\030\002 \002(\t*=\n\tActorType\022\017\n\013SCALA_ACTOR\020\001\022\016" + + "\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACTOR\020\003*]\n\027Seria" + + "lizationSchemeType\022\010\n\004JAVA\020\001\022\013\n\007SBINARY\020" + + "\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 = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -5821,7 +5972,7 @@ public final class RemoteProtocol { internal_static_RemoteActorRefProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( 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.Builder.class); internal_static_SerializedActorRefProtocol_descriptor = @@ -5861,7 +6012,7 @@ public final class RemoteProtocol { internal_static_RemoteRequestProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( 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.Builder.class); internal_static_RemoteReplyProtocol_descriptor = @@ -5869,7 +6020,7 @@ public final class RemoteProtocol { internal_static_RemoteReplyProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( 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.Builder.class); internal_static_UuidProtocol_descriptor = diff --git a/akka-remote/src/main/protocol/RemoteProtocol.proto b/akka-remote/src/main/protocol/RemoteProtocol.proto index 4f2fa5c2dd..55c3ae35fd 100644 --- a/akka-remote/src/main/protocol/RemoteProtocol.proto +++ b/akka-remote/src/main/protocol/RemoteProtocol.proto @@ -16,7 +16,7 @@ option optimize_for = SPEED; * on the original node. */ message RemoteActorRefProtocol { - required UuidProtocol uuid = 1; + required string classOrServiceName = 1; required string actorClassname = 2; required AddressProtocol homeAddress = 3; optional uint64 timeout = 4; @@ -80,7 +80,7 @@ message RemoteRequestProtocol { required MessageProtocol message = 2; required ActorInfoProtocol actorInfo = 3; required bool isOneWay = 4; - optional string supervisorUuid = 5; + optional UuidProtocol supervisorUuid = 5; optional RemoteActorRefProtocol sender = 6; repeated MetadataEntryProtocol metadata = 7; } @@ -92,7 +92,7 @@ message RemoteReplyProtocol { required UuidProtocol uuid = 1; optional MessageProtocol message = 2; optional ExceptionProtocol exception = 3; - optional string supervisorUuid = 4; + optional UuidProtocol supervisorUuid = 4; required bool isActor = 5; required bool isSuccessful = 6; repeated MetadataEntryProtocol metadata = 7; diff --git a/akka-remote/src/main/scala/remote/RemoteClient.scala b/akka-remote/src/main/scala/remote/RemoteClient.scala index 26cc275956..bb9714bc61 100644 --- a/akka-remote/src/main/scala/remote/RemoteClient.scala +++ b/akka-remote/src/main/scala/remote/RemoteClient.scala @@ -7,12 +7,12 @@ package se.scalablesolutions.akka.remote import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => ActorTypeProtocol, _} import se.scalablesolutions.akka.actor.{Exit, Actor, ActorRef, ActorType, RemoteActorRef, IllegalActorStateException} 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.serialization.RemoteActorSerialization._ import se.scalablesolutions.akka.AkkaException import Actor._ - import org.jboss.netty.channel._ import group.DefaultChannelGroup 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) 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 = actorFor(classNameOrServiceId, classNameOrServiceId, 5000L, hostname, port, None) @@ -162,21 +162,21 @@ object RemoteClient extends Logging { 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 } - 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)) set -= uuid 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) if (set.isDefined && (set.get ne null)) set.get else { - val remoteActorSet = new HashSet[String] + val remoteActorSet = new HashSet[Uuid] remoteActors.put(remoteServerAddress, remoteActorSet) remoteActorSet } @@ -194,8 +194,8 @@ class RemoteClient private[akka] ( val name = "RemoteClient@" + hostname + "::" + port //FIXME Should these be clear:ed on postStop? - private val futures = new ConcurrentHashMap[Long, CompletableFuture[_]] - private val supervisors = new ConcurrentHashMap[String, ActorRef] + private val futures = new ConcurrentHashMap[Uuid, CompletableFuture[_]] + private val supervisors = new ConcurrentHashMap[Uuid, ActorRef] private val remoteAddress = new InetSocketAddress(hostname, port) @@ -287,7 +287,7 @@ class RemoteClient private[akka] ( futures.synchronized { val futureResult = if (senderFuture.isDefined) senderFuture.get 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) Some(futureResult) } @@ -330,8 +330,8 @@ class RemoteClient private[akka] ( */ class RemoteClientPipelineFactory( name: String, - futures: ConcurrentMap[Long, CompletableFuture[_]], - supervisors: ConcurrentMap[String, ActorRef], + futures: ConcurrentMap[Uuid, CompletableFuture[_]], + supervisors: ConcurrentMap[Uuid, ActorRef], bootstrap: ClientBootstrap, remoteAddress: SocketAddress, timer: HashedWheelTimer, @@ -370,8 +370,8 @@ class RemoteClientPipelineFactory( @ChannelHandler.Sharable class RemoteClientHandler( val name: String, - val futures: ConcurrentMap[Long, CompletableFuture[_]], - val supervisors: ConcurrentMap[String, ActorRef], + val futures: ConcurrentMap[Uuid, CompletableFuture[_]], + val supervisors: ConcurrentMap[Uuid, ActorRef], val bootstrap: ClientBootstrap, val remoteAddress: SocketAddress, val timer: HashedWheelTimer, @@ -391,14 +391,15 @@ class RemoteClientHandler( val result = event.getMessage if (result.isInstanceOf[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) - val future = futures.get(reply.getId).asInstanceOf[CompletableFuture[Any]] + val future = futures.get(replyUuid).asInstanceOf[CompletableFuture[Any]] if (reply.getIsSuccessful) { val message = MessageSerializer.deserialize(reply.getMessage) future.completeWithResult(message) } else { if (reply.hasSupervisorUuid()) { - val supervisorUuid = reply.getSupervisorUuid + val supervisorUuid = uuidFrom(reply.getSupervisorUuid.getHigh,reply.getSupervisorUuid.getLow) if (!supervisors.containsKey(supervisorUuid)) throw new IllegalActorStateException( "Expected a registered supervisor for UUID [" + supervisorUuid + "] but none was found") val supervisedActor = supervisors.get(supervisorUuid) @@ -408,7 +409,7 @@ class RemoteClientHandler( } future.completeWithException(parseException(reply, client.loader)) } - futures.remove(reply.getId) + futures remove replyUuid } else { val exception = new RemoteClientException("Unknown message received in remote client handler: " + result, client) client.notifyListeners(RemoteClientError(exception, client)) diff --git a/akka-remote/src/main/scala/remote/RemoteServer.scala b/akka-remote/src/main/scala/remote/RemoteServer.scala index c1f25b6d4f..a9841baf8c 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -11,6 +11,7 @@ import java.util.{Map => JMap} import se.scalablesolutions.akka.actor.{ Actor, TypedActor, ActorRef, IllegalActorStateException, RemoteActorSystemMessage} +import se.scalablesolutions.akka.actor.{Uuid,uuidFrom} import se.scalablesolutions.akka.actor.Actor._ import se.scalablesolutions.akka.util._ import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._ @@ -122,19 +123,19 @@ object RemoteServer { } private class RemoteActorSet { - private[RemoteServer] val actors = new ConcurrentHashMap[String, ActorRef] - private[RemoteServer] val typedActors = new ConcurrentHashMap[String, AnyRef] + private[RemoteServer] val actors = new ConcurrentHashMap[Object, ActorRef] + private[RemoteServer] val typedActors = new ConcurrentHashMap[Object, AnyRef] } private val guard = new ReadWriteGuard private val remoteActorSets = Map[Address, RemoteActorSet]() 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) } - 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) } @@ -504,7 +505,7 @@ class RemoteServerHandler( override def onComplete(result: AnyRef) { log.debug("Returning result from actor invocation [%s]", result) val replyBuilder = RemoteReplyProtocol.newBuilder - .setId(request.getId) + .setUuid(request.getUuid) .setMessage(MessageSerializer.serialize(result)) .setIsSuccessful(true) .setIsActor(true) @@ -548,7 +549,7 @@ class RemoteServerHandler( val result = messageReceiver.invoke(typedActor, args: _*) log.debug("Returning result from remote typed actor invocation [%s]", result) val replyBuilder = RemoteReplyProtocol.newBuilder - .setId(request.getId) + .setUuid(request.getUuid) .setMessage(MessageSerializer.serialize(result)) .setIsSuccessful(true) .setIsActor(false) @@ -569,7 +570,7 @@ class RemoteServerHandler( * Find a registered actor by ID (default) or UUID. * 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() var actorRefOrNull = registeredActors get id if (actorRefOrNull eq null) { @@ -582,7 +583,7 @@ class RemoteServerHandler( * Find a registered typed actor by ID (default) or UUID. * 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() var actorRefOrNull = registeredActors get id if (actorRefOrNull eq null) { @@ -599,7 +600,7 @@ class RemoteServerHandler( * Does not start the actor. */ private def createActor(actorInfo: ActorInfoProtocol): ActorRef = { - val uuid = actorInfo.getUuid + val uuid = uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow) val id = actorInfo.getId val name = actorInfo.getTarget @@ -629,7 +630,7 @@ class RemoteServerHandler( } private def createTypedActor(actorInfo: ActorInfoProtocol): AnyRef = { - val uuid = actorInfo.getUuid + val uuid = uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow) val id = actorInfo.getId val typedActorOrNull = findTypedActorByIdOrUUid(id, uuid) @@ -664,7 +665,7 @@ class RemoteServerHandler( val actorInfo = request.getActorInfo log.error(e, "Could not invoke remote typed actor [%s :: %s]", actorInfo.getTypedActorInfo.getMethod, actorInfo.getTarget) val replyBuilder = RemoteReplyProtocol.newBuilder - .setId(request.getId) + .setUuid(request.getUuid) .setException(ExceptionProtocol.newBuilder.setClassname(e.getClass.getName).setMessage(e.getMessage).build) .setIsSuccessful(false) .setIsActor(isActor) diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index bc1aa9052f..e94565ad97 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -14,9 +14,8 @@ import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => Ac import ActorTypeProtocol._ import se.scalablesolutions.akka.config.{AllForOneStrategy, OneForOneStrategy, FaultHandlingStrategy} import se.scalablesolutions.akka.config.ScalaConfig._ - +import se.scalablesolutions.akka.actor.{uuidFrom,newUuid} import com.google.protobuf.ByteString -import se.scalablesolutions.akka.util.UUID /** * Type class definition for Actor Serialization @@ -109,7 +108,7 @@ object ActorSerialization { .build val builder = SerializedActorRefProtocol.newBuilder - .setUuid(actorRef.uuid) + .setUuid(UuidProtocol.newBuilder.setHigh(actorRef.uuid.getTime).setLow(actorRef.uuid.getClockSeqAndNode).build) .setId(actorRef.id) .setActorClassname(actorRef.actorClass.getName) .setOriginalAddress(originalAddress) @@ -167,7 +166,7 @@ object ActorSerialization { } val ar = new LocalActorRef( - protocol.getUuid, + uuidFrom(protocol.getUuid.getHigh,protocol.getUuid.getLow), protocol.getId, protocol.getOriginalAddress.getHostname, protocol.getOriginalAddress.getPort, @@ -208,7 +207,7 @@ object RemoteActorSerialization { private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = { Actor.log.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n" + protocol) RemoteActorRef( - protocol.getUuid, + protocol.getClassOrServiceName, protocol.getActorClassname, protocol.getHomeAddress.getHostname, protocol.getHomeAddress.getPort, @@ -232,7 +231,7 @@ object RemoteActorSerialization { } RemoteActorRefProtocol.newBuilder - .setUuid(uuid) + .setClassOrServiceName(id) .setActorClassname(actorClass.getName) .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) .setTimeout(timeout) @@ -250,7 +249,7 @@ object RemoteActorSerialization { import actorRef._ val actorInfoBuilder = ActorInfoProtocol.newBuilder - .setUuid(uuid) + .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build) .setId(actorRef.id) .setTarget(actorClassName) .setTimeout(timeout) @@ -270,16 +269,16 @@ object RemoteActorSerialization { val actorInfo = actorInfoBuilder.build val requestBuilder = RemoteRequestProtocol.newBuilder - .setId(UUID.newUuid) + .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build) .setMessage(MessageSerializer.serialize(message)) .setActorInfo(actorInfo) .setIsOneWay(isOneWay) 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 => - RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid, sender) + RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid.toString, sender) requestBuilder.setSender(toRemoteActorRefProtocol(sender)) } requestBuilder diff --git a/akka-remote/src/test/scala/ticket/Ticket434Spec.scala b/akka-remote/src/test/scala/ticket/Ticket434Spec.scala index b27c17cfe5..404b8fe22f 100644 --- a/akka-remote/src/test/scala/ticket/Ticket434Spec.scala +++ b/akka-remote/src/test/scala/ticket/Ticket434Spec.scala @@ -6,6 +6,7 @@ package se.scalablesolutions.akka.actor.ticket import org.scalatest.Spec import org.scalatest.matchers.ShouldMatchers import se.scalablesolutions.akka.actor.Actor._ +import se.scalablesolutions.akka.actor.{Uuid,newUuid,uuidFrom} import se.scalablesolutions.akka.actor.remote.ServerInitiatedRemoteActorSpec.RemoteActorSpecActorUnidirectional import java.util.concurrent.TimeUnit import se.scalablesolutions.akka.remote.{RemoteClient, RemoteServer} @@ -32,14 +33,15 @@ class Ticket434Spec extends Spec with ShouldMatchers { describe("The ActorInfoProtocol") { it("should be possible to set the acor id and uuuid") { + val uuid = newUuid val actorInfoBuilder = ActorInfoProtocol.newBuilder - .setUuid("unique-id") + .setUuid(UuidProtocol.newBuilder.setHigh(uuid.getTime).setLow(uuid.getClockSeqAndNode).build) .setId("some-id") .setTarget("actorClassName") .setTimeout(5000L) .setActorType(ActorType.SCALA_ACTOR) val actorInfo = actorInfoBuilder.build - assert(actorInfo.getUuid === "unique-id") + assert(uuidFrom(actorInfo.getUuid.getHigh,actorInfo.getUuid.getLow) === uuid) assert(actorInfo.getId === "some-id") } } diff --git a/akka-typed-actor/src/main/scala/actor/TypedActor.scala b/akka-typed-actor/src/main/scala/actor/TypedActor.scala index c3457cb43b..2ae01a5670 100644 --- a/akka-typed-actor/src/main/scala/actor/TypedActor.scala +++ b/akka-typed-actor/src/main/scala/actor/TypedActor.scala @@ -622,7 +622,7 @@ private[akka] abstract class ActorAspect { protected var typedActor: TypedActor = _ protected var actorRef: ActorRef = _ protected var timeout: Long = _ - protected var uuid: String = _ + protected var uuid: Uuid = _ protected var remoteAddress: Option[InetSocketAddress] = _ protected def localDispatch(joinPoint: JoinPoint): AnyRef = {