From 3f507fb7ca1c6c7bec8a41e0a09d6710fced282a Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Tue, 31 Aug 2010 19:12:14 +0200 Subject: [PATCH 1/5] Initial UUID migration --- .../se/scalablesolutions/akka/util/UUID.java | 59 ------------------ akka-actor/src/main/scala/util/UUID.scala | 9 +++ .../src/main/scala/remote/RemoteClient.scala | 12 ---- .../serialization/SerializationProtocol.scala | 5 +- embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar | Bin 0 -> 15009 bytes embedded-repo/com/eaio/uuid/3.2/uuid-3.2.pom | 8 +++ project/build/AkkaProject.scala | 3 + 7 files changed, 23 insertions(+), 73 deletions(-) delete mode 100644 akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java create mode 100644 akka-actor/src/main/scala/util/UUID.scala create mode 100644 embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar create mode 100644 embedded-repo/com/eaio/uuid/3.2/uuid-3.2.pom diff --git a/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java b/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java deleted file mode 100644 index f06aab34df..0000000000 --- a/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ -package se.scalablesolutions.akka.util; - -/** - * NOTE: - *

- * This code is based on code from the [Plasmid Replication Engine] project. - *
- * Licensed under [Mozilla Public License 1.0 (MPL)]. - *

- * Original JavaDoc: - *

- * Our distributed objects are generally named most efficiently (and cleanly) - * by their UUID's. This class provides some static helpers for using UUID's. - * If it was efficient to do in Java, I would make the uuid an normal class - * and use instances of it. However, in current JVM's, we would end up using an - * Object to represent a long, which is pretty expensive. Maybe someday. ### - *

- * UUID format: currently using currentTimeMillis() for the low bits. This uses - * about 40 bits for the next 1000 years, leaving 24 bits for debugging - * and consistency data. I'm using 8 of those for a magic asci 'U' byte. - *

- * Future: use one instance of Uuid per type of object for better performance - * and more detailed info (instance could be matched to its uuid's via a map or - * array). This all static version bites.### - */ -public final class UUID { - - public static final long UUID_NONE = 0; - public static final long UUID_WILD = -1; - public static final long UUID_MAGICMASK = 0xff << 56; - public static final long UUID_MAGIC = 'U' << 56; - - protected static long lastTime; - - /** - * Generate and return a new Universally Unique ID. - * Happens to be monotonically increasing. - */ - public synchronized static long newUuid() { - long time = System.currentTimeMillis(); - - if (time <= lastTime) { - time = lastTime + 1; - } - lastTime = time; - return UUID_MAGIC | time; - } - - /** - * Returns true if uuid could have been generated by Uuid. - */ - public static boolean isValid(final long uuid) { - return (uuid & UUID_MAGICMASK) == UUID_MAGIC - && (uuid & ~UUID_MAGICMASK) != 0; - } -} \ No newline at end of file diff --git a/akka-actor/src/main/scala/util/UUID.scala b/akka-actor/src/main/scala/util/UUID.scala new file mode 100644 index 0000000000..548f014e58 --- /dev/null +++ b/akka-actor/src/main/scala/util/UUID.scala @@ -0,0 +1,9 @@ +/** + * 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-remote/src/main/scala/remote/RemoteClient.scala b/akka-remote/src/main/scala/remote/RemoteClient.scala index 35578477ff..459c260a62 100644 --- a/akka-remote/src/main/scala/remote/RemoteClient.scala +++ b/akka-remote/src/main/scala/remote/RemoteClient.scala @@ -31,18 +31,6 @@ import java.util.concurrent.atomic.AtomicLong import scala.collection.mutable.{HashSet, HashMap} import scala.reflect.BeanProperty -/** - * Atomic remote request/reply message id generator. - * - * @author Jonas Bonér - */ -object RemoteRequestProtocolIdFactory { - private val nodeId = UUID.newUuid - private val id = new AtomicLong - - def nextId: Long = id.getAndIncrement + nodeId -} - /** * Life-cycle events for RemoteClient. */ diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index 3f54f8e921..4050c2026f 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -10,11 +10,12 @@ import se.scalablesolutions.akka.stm.global._ import se.scalablesolutions.akka.stm.TransactionManagement._ import se.scalablesolutions.akka.stm.TransactionManagement import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._ -import se.scalablesolutions.akka.remote.{RemoteServer, RemoteRequestProtocolIdFactory, MessageSerializer} +import se.scalablesolutions.akka.remote.{RemoteServer, MessageSerializer} import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType._ import se.scalablesolutions.akka.serialization.Serializer import com.google.protobuf.ByteString +import se.scalablesolutions.akka.util.UUID /** * Type class definition for Actor Serialization @@ -267,7 +268,7 @@ object RemoteActorSerialization { val actorInfo = actorInfoBuilder.build val requestBuilder = RemoteRequestProtocol.newBuilder - .setId(RemoteRequestProtocolIdFactory.nextId) + .setId(UUID.newUuid) .setMessage(MessageSerializer.serialize(message)) .setActorInfo(actorInfo) .setIsOneWay(isOneWay) diff --git a/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar b/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar new file mode 100644 index 0000000000000000000000000000000000000000..b205a2488e6c050feec7e89352e93fc9ae59ab09 GIT binary patch literal 15009 zcmWIWW@h1H00GO~={6u5hB+A+7<^qr9CbbY-1K3}I2bH)r`!01`D&ywFfi0IFffQ9 zEAw^q^K^3!4$<><`|Nw>w2!y0-bG$-U9EFx&TkGfxMKX^X_1cCxf43xx=tMIPnLvD z5z{`PQn7PRcaX4mP;kjyt+gUD+(MI$gG6hDPX~Rj*g40`xY+B!qsX6_zdL;l}0BvM)C9r6xJS5=n3kPP_G5x$St7p-~t?&}BNg~v7-Ew9d)D?Lw6F0WZtai*02t*G@&b+=@N zw3}P>rM?f5buiX?Y8#SkDHqCcZozSLi7Odru_;!zE-^b^kt|-{q zb}1_OrO?j>W>>$=TYGWtrh@06bw6n*70L^UtPH)``0n|e?b;UE*JqtPxMGcT=~GLl z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oC}15g_m<>2kLlI&UDC=I=!_sWT zT||KzjtI>x`WTu~+j98a0cuDhjIt+W6k7R!y + + 4.0.0 + com.eaio + uuid + 3.2 + jar + \ No newline at end of file diff --git a/project/build/AkkaProject.scala b/project/build/AkkaProject.scala index 53afac6a22..cf7378b0d2 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -140,6 +140,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val jetty_util = "org.eclipse.jetty" % "jetty-util" % JETTY_VERSION % "compile" lazy val jetty_xml = "org.eclipse.jetty" % "jetty-xml" % JETTY_VERSION % "compile" + lazy val uuid = "com.eaio" % "uuid" % "3.2" % "compile" + lazy val guicey = "org.guiceyfruit" % "guice-all" % "2.0" % "compile" lazy val h2_lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" % "compile" @@ -340,6 +342,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaActorProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { + val uuid = Dependencies.uuid val configgy = Dependencies.configgy val hawtdispatch = Dependencies.hawtdispatch val multiverse = Dependencies.multiverse From 551f25aba8d14c536827c4e0045e9549884533a9 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Fri, 17 Sep 2010 16:04:25 +0200 Subject: [PATCH 2/5] 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 = { From a1c0bd57f1a35f20700b07bd8634ffe460aaa6a7 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Sun, 19 Sep 2010 17:02:15 +0200 Subject: [PATCH 3/5] Its a wrap! --- akka-actor/src/main/scala/actor/Implicits.scala | 4 +++- akka-actor/src/main/scala/util/Logging.scala | 2 +- .../main/scala/component/ActorComponent.scala | 17 +++++++---------- .../scala/component/ActorComponentTest.scala | 11 +++++++---- .../src/main/scala/remote/RemoteServer.scala | 8 ++++---- .../serialization/SerializationProtocol.scala | 2 +- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/akka-actor/src/main/scala/actor/Implicits.scala b/akka-actor/src/main/scala/actor/Implicits.scala index f228d45186..9992cd36a1 100644 --- a/akka-actor/src/main/scala/actor/Implicits.scala +++ b/akka-actor/src/main/scala/actor/Implicits.scala @@ -16,5 +16,7 @@ package object actor { 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) + def uuidFrom(uuid: String): Uuid = { + new Uuid(uuid) + } } diff --git a/akka-actor/src/main/scala/util/Logging.scala b/akka-actor/src/main/scala/util/Logging.scala index b6ddaaa16a..8d2e64be58 100644 --- a/akka-actor/src/main/scala/util/Logging.scala +++ b/akka-actor/src/main/scala/util/Logging.scala @@ -111,7 +111,7 @@ class Logger(val logger: SLFLogger) { warning(message(fmt,arg,argN:_*)) } - def warn(fmt: => String, arg: Any, argN: Any*) = warning(fmt, arg, argN) + def warn(fmt: => String, arg: Any, argN: Any*) = warning(fmt, arg, argN:_*) def warning(msg: => String) { if (warning_?) logger warn msg diff --git a/akka-camel/src/main/scala/component/ActorComponent.scala b/akka-camel/src/main/scala/component/ActorComponent.scala index ccd4c63f0c..fefbeffbb6 100644 --- a/akka-camel/src/main/scala/component/ActorComponent.scala +++ b/akka-camel/src/main/scala/component/ActorComponent.scala @@ -33,18 +33,15 @@ import scala.reflect.BeanProperty */ class ActorComponent extends DefaultComponent { def createEndpoint(uri: String, remaining: String, parameters: JavaMap[String, Object]): ActorEndpoint = { - val idAndUuid = idAndUuidPair(remaining) - new ActorEndpoint(uri, this, idAndUuid._1, idAndUuid._2) + val (id,uuid) = idAndUuidPair(remaining) + new ActorEndpoint(uri, this, id, uuid) } - 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(uuidFrom(uuid))) - case _ => throw new IllegalArgumentException( - "invalid path format: %s - should be or id: or uuid:" format remaining) - } + private def idAndUuidPair(remaining: String): Tuple2[Option[String],Option[Uuid]] = remaining match { + case null => throw new IllegalArgumentException("invalid path format: %s - should be or id: or uuid:" format remaining) + case id if id startsWith "id:" => (Some(id substring 3),None) + case uuid if uuid startsWith "uuid:" => (None,Some(uuidFrom(uuid substring 5))) + case id => (Some(id),None) } } diff --git a/akka-camel/src/test/scala/component/ActorComponentTest.scala b/akka-camel/src/test/scala/component/ActorComponentTest.scala index e27e8c5875..f35e8b3885 100644 --- a/akka-camel/src/test/scala/component/ActorComponentTest.scala +++ b/akka-camel/src/test/scala/component/ActorComponentTest.scala @@ -4,10 +4,13 @@ import org.apache.camel.{Endpoint, AsyncProcessor} import org.apache.camel.impl.DefaultCamelContext import org.junit._ import org.scalatest.junit.JUnitSuite +import se.scalablesolutions.akka.actor.uuidFrom class ActorComponentTest extends JUnitSuite { val component: ActorComponent = ActorComponentTest.actorComponent + def testUUID = uuidFrom("93da8c80-c3fd-11df-abed-60334b120057") + @Test def shouldCreateEndpointWithIdDefined = { val ep1: ActorEndpoint = component.createEndpoint("actor:abc").asInstanceOf[ActorEndpoint] val ep2: ActorEndpoint = component.createEndpoint("actor:id:abc").asInstanceOf[ActorEndpoint] @@ -20,15 +23,15 @@ class ActorComponentTest extends JUnitSuite { } @Test def shouldCreateEndpointWithUuidDefined = { - val ep: ActorEndpoint = component.createEndpoint("actor:uuid:abc").asInstanceOf[ActorEndpoint] - assert(ep.uuid === Some("abc")) + val ep: ActorEndpoint = component.createEndpoint("actor:uuid:" + testUUID).asInstanceOf[ActorEndpoint] + assert(ep.uuid === Some(testUUID)) assert(ep.id === None) assert(!ep.blocking) } @Test def shouldCreateEndpointWithBlockingSet = { - val ep: ActorEndpoint = component.createEndpoint("actor:uuid:abc?blocking=true").asInstanceOf[ActorEndpoint] - assert(ep.uuid === Some("abc")) + val ep: ActorEndpoint = component.createEndpoint("actor:uuid:"+testUUID+"?blocking=true").asInstanceOf[ActorEndpoint] + assert(ep.uuid === Some(testUUID)) assert(ep.id === None) assert(ep.blocking) } diff --git a/akka-remote/src/main/scala/remote/RemoteServer.scala b/akka-remote/src/main/scala/remote/RemoteServer.scala index a9841baf8c..bacaf22546 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -123,8 +123,8 @@ object RemoteServer { } private class RemoteActorSet { - private[RemoteServer] val actors = new ConcurrentHashMap[Object, ActorRef] - private[RemoteServer] val typedActors = new ConcurrentHashMap[Object, AnyRef] + private[RemoteServer] val actors = new ConcurrentHashMap[String, ActorRef] + private[RemoteServer] val typedActors = new ConcurrentHashMap[String, AnyRef] } private val guard = new ReadWriteGuard @@ -132,11 +132,11 @@ object RemoteServer { private val remoteServers = Map[Address, RemoteServer]() 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.toString, actor) } 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.toString, typedActor) } private[akka] def getOrCreateServer(address: InetSocketAddress): RemoteServer = guard.withWriteGuard { diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index e94565ad97..7997be128b 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -231,7 +231,7 @@ object RemoteActorSerialization { } RemoteActorRefProtocol.newBuilder - .setClassOrServiceName(id) + .setClassOrServiceName(uuid.toString) .setActorClassname(actorClass.getName) .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) .setTimeout(timeout) From dfa637b090287edd4b8c54be112e9d98f0de8e29 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Sun, 19 Sep 2010 17:02:15 +0200 Subject: [PATCH 4/5] Its a wrap! --- akka-actor/src/main/scala/actor/Implicits.scala | 4 +++- akka-actor/src/main/scala/util/Logging.scala | 2 +- .../main/scala/component/ActorComponent.scala | 17 +++++++---------- .../scala/component/ActorComponentTest.scala | 11 +++++++---- .../src/main/scala/remote/RemoteServer.scala | 8 ++++---- .../serialization/SerializationProtocol.scala | 2 +- 6 files changed, 23 insertions(+), 21 deletions(-) diff --git a/akka-actor/src/main/scala/actor/Implicits.scala b/akka-actor/src/main/scala/actor/Implicits.scala index f228d45186..9992cd36a1 100644 --- a/akka-actor/src/main/scala/actor/Implicits.scala +++ b/akka-actor/src/main/scala/actor/Implicits.scala @@ -16,5 +16,7 @@ package object actor { 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) + def uuidFrom(uuid: String): Uuid = { + new Uuid(uuid) + } } diff --git a/akka-actor/src/main/scala/util/Logging.scala b/akka-actor/src/main/scala/util/Logging.scala index b6ddaaa16a..8d2e64be58 100644 --- a/akka-actor/src/main/scala/util/Logging.scala +++ b/akka-actor/src/main/scala/util/Logging.scala @@ -111,7 +111,7 @@ class Logger(val logger: SLFLogger) { warning(message(fmt,arg,argN:_*)) } - def warn(fmt: => String, arg: Any, argN: Any*) = warning(fmt, arg, argN) + def warn(fmt: => String, arg: Any, argN: Any*) = warning(fmt, arg, argN:_*) def warning(msg: => String) { if (warning_?) logger warn msg diff --git a/akka-camel/src/main/scala/component/ActorComponent.scala b/akka-camel/src/main/scala/component/ActorComponent.scala index ccd4c63f0c..e0a70e255c 100644 --- a/akka-camel/src/main/scala/component/ActorComponent.scala +++ b/akka-camel/src/main/scala/component/ActorComponent.scala @@ -33,18 +33,15 @@ import scala.reflect.BeanProperty */ class ActorComponent extends DefaultComponent { def createEndpoint(uri: String, remaining: String, parameters: JavaMap[String, Object]): ActorEndpoint = { - val idAndUuid = idAndUuidPair(remaining) - new ActorEndpoint(uri, this, idAndUuid._1, idAndUuid._2) + val (id,uuid) = idAndUuidPair(remaining) + new ActorEndpoint(uri, this, id, uuid) } - 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(uuidFrom(uuid))) - case _ => throw new IllegalArgumentException( - "invalid path format: %s - should be or id: or uuid:" format remaining) - } + private def idAndUuidPair(remaining: String): Tuple2[Option[String],Option[Uuid]] = remaining match { + case null | "" => throw new IllegalArgumentException("invalid path format: [%s] - should be or id: or uuid:" format remaining) + case id if id startsWith "id:" => (Some(id substring 3),None) + case uuid if uuid startsWith "uuid:" => (None,Some(uuidFrom(uuid substring 5))) + case id => (Some(id),None) } } diff --git a/akka-camel/src/test/scala/component/ActorComponentTest.scala b/akka-camel/src/test/scala/component/ActorComponentTest.scala index e27e8c5875..f35e8b3885 100644 --- a/akka-camel/src/test/scala/component/ActorComponentTest.scala +++ b/akka-camel/src/test/scala/component/ActorComponentTest.scala @@ -4,10 +4,13 @@ import org.apache.camel.{Endpoint, AsyncProcessor} import org.apache.camel.impl.DefaultCamelContext import org.junit._ import org.scalatest.junit.JUnitSuite +import se.scalablesolutions.akka.actor.uuidFrom class ActorComponentTest extends JUnitSuite { val component: ActorComponent = ActorComponentTest.actorComponent + def testUUID = uuidFrom("93da8c80-c3fd-11df-abed-60334b120057") + @Test def shouldCreateEndpointWithIdDefined = { val ep1: ActorEndpoint = component.createEndpoint("actor:abc").asInstanceOf[ActorEndpoint] val ep2: ActorEndpoint = component.createEndpoint("actor:id:abc").asInstanceOf[ActorEndpoint] @@ -20,15 +23,15 @@ class ActorComponentTest extends JUnitSuite { } @Test def shouldCreateEndpointWithUuidDefined = { - val ep: ActorEndpoint = component.createEndpoint("actor:uuid:abc").asInstanceOf[ActorEndpoint] - assert(ep.uuid === Some("abc")) + val ep: ActorEndpoint = component.createEndpoint("actor:uuid:" + testUUID).asInstanceOf[ActorEndpoint] + assert(ep.uuid === Some(testUUID)) assert(ep.id === None) assert(!ep.blocking) } @Test def shouldCreateEndpointWithBlockingSet = { - val ep: ActorEndpoint = component.createEndpoint("actor:uuid:abc?blocking=true").asInstanceOf[ActorEndpoint] - assert(ep.uuid === Some("abc")) + val ep: ActorEndpoint = component.createEndpoint("actor:uuid:"+testUUID+"?blocking=true").asInstanceOf[ActorEndpoint] + assert(ep.uuid === Some(testUUID)) assert(ep.id === None) assert(ep.blocking) } diff --git a/akka-remote/src/main/scala/remote/RemoteServer.scala b/akka-remote/src/main/scala/remote/RemoteServer.scala index a9841baf8c..bacaf22546 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -123,8 +123,8 @@ object RemoteServer { } private class RemoteActorSet { - private[RemoteServer] val actors = new ConcurrentHashMap[Object, ActorRef] - private[RemoteServer] val typedActors = new ConcurrentHashMap[Object, AnyRef] + private[RemoteServer] val actors = new ConcurrentHashMap[String, ActorRef] + private[RemoteServer] val typedActors = new ConcurrentHashMap[String, AnyRef] } private val guard = new ReadWriteGuard @@ -132,11 +132,11 @@ object RemoteServer { private val remoteServers = Map[Address, RemoteServer]() 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.toString, actor) } 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.toString, typedActor) } private[akka] def getOrCreateServer(address: InetSocketAddress): RemoteServer = guard.withWriteGuard { diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index e94565ad97..7997be128b 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -231,7 +231,7 @@ object RemoteActorSerialization { } RemoteActorRefProtocol.newBuilder - .setClassOrServiceName(id) + .setClassOrServiceName(uuid.toString) .setActorClassname(actorClass.getName) .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) .setTimeout(timeout) From 4f0bb01fd2664f7d113696f6020669b0a19fe4e1 Mon Sep 17 00:00:00 2001 From: Viktor Klang Date: Wed, 22 Sep 2010 11:37:23 +0200 Subject: [PATCH 5/5] Preparing to add UUIDs to RemoteServer as well --- akka-remote/src/main/scala/remote/RemoteServer.scala | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/akka-remote/src/main/scala/remote/RemoteServer.scala b/akka-remote/src/main/scala/remote/RemoteServer.scala index 8784a8c81f..fadc5ce60a 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -314,7 +314,7 @@ class RemoteServer extends Logging with ListenerManagement { } } - private def register(id: String, actorRef: ActorRef, registry: ConcurrentHashMap[String, ActorRef]) { + private def register[Key](id: Key, actorRef: ActorRef, registry: ConcurrentHashMap[Key, ActorRef]) { if (_isRunning) { if (!registry.contains(id)) { if (!actorRef.isRunning) actorRef.start @@ -323,7 +323,7 @@ class RemoteServer extends Logging with ListenerManagement { } } - private def registerTypedActor(id: String, typedActor: AnyRef, registry: ConcurrentHashMap[String, AnyRef]) { + private def registerTypedActor[Key](id: Key, typedActor: AnyRef, registry: ConcurrentHashMap[Key, AnyRef]) { if (_isRunning) { if (!registry.contains(id)) { registry.put(id, typedActor) @@ -337,8 +337,7 @@ class RemoteServer extends Logging with ListenerManagement { def unregister(actorRef: ActorRef):Unit = synchronized { if (_isRunning) { log.debug("Unregistering server side remote actor [%s] with id [%s:%s]", actorRef.actorClass.getName, actorRef.id, actorRef.uuid) - val actorMap = actors() - actorMap remove actorRef.id + actors() remove actorRef.id if (actorRef.registeredInRemoteNodeDuringSerialization) actorsByUuid() remove actorRef.uuid } }