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/actor/ActorRef.scala b/akka-actor/src/main/scala/actor/ActorRef.scala index cddbb92fc3..e680f13c58 100644 --- a/akka-actor/src/main/scala/actor/ActorRef.scala +++ b/akka-actor/src/main/scala/actor/ActorRef.scala @@ -78,7 +78,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 _status: ActorRefStatus.StatusType = ActorRefStatus.UNSTARTED @volatile protected[akka] var _homeAddress = new InetSocketAddress(RemoteServerModule.HOSTNAME, RemoteServerModule.PORT) @volatile protected[akka] var _futureTimeout: Option[ScheduledFuture[AnyRef]] = None @@ -95,7 +95,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. @@ -213,7 +213,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. @@ -266,7 +266,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 @@ -622,9 +622,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] @@ -665,7 +665,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 @@ -687,7 +687,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, @@ -1114,7 +1114,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)) @@ -1122,9 +1122,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 @@ -1408,7 +1408,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)) @@ -1437,7 +1437,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 @@ -1460,7 +1460,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..9992cd36a1 100644 --- a/akka-actor/src/main/scala/actor/Implicits.scala +++ b/akka-actor/src/main/scala/actor/Implicits.scala @@ -12,4 +12,11 @@ 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): Uuid = { + 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/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 89cc0d4d3e..a9c96eebb9 100644 --- a/akka-camel/src/main/scala/component/ActorComponent.scala +++ b/akka-camel/src/main/scala/component/ActorComponent.scala @@ -18,6 +18,8 @@ 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, Uuid, uuidFrom} + import se.scalablesolutions.akka.AkkaException import scala.reflect.BeanProperty @@ -33,18 +35,15 @@ import se.scalablesolutions.akka.actor._ */ 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[String]] = { - 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 _ => 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) } } @@ -64,7 +63,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 +150,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) } /** @@ -249,7 +248,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-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-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 31ae9650d4..e5265ea396 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; } @@ -1034,12 +1034,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; @@ -1131,6 +1131,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(); @@ -1140,6 +1141,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; @@ -1157,7 +1159,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()); @@ -1206,7 +1208,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 @@ -1419,7 +1421,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()); @@ -1486,7 +1488,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: { @@ -1559,24 +1566,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; } @@ -2674,12 +2697,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; @@ -2717,6 +2740,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(); } @@ -2725,6 +2749,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; } @@ -2735,7 +2760,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()); @@ -2763,7 +2788,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 @@ -2944,7 +2969,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()); @@ -2987,7 +3012,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: { @@ -3026,24 +3056,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; } @@ -3535,12 +3581,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; @@ -3563,12 +3609,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; @@ -3590,17 +3636,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; } @@ -3613,8 +3665,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()); @@ -3626,7 +3678,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()); @@ -3643,9 +3695,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 @@ -3661,7 +3713,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 @@ -3833,8 +3885,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()); @@ -3846,7 +3898,7 @@ public final class RemoteProtocol { setIsOneWay(other.getIsOneWay()); } if (other.hasSupervisorUuid()) { - setSupervisorUuid(other.getSupervisorUuid()); + mergeSupervisorUuid(other.getSupervisorUuid()); } if (other.hasSender()) { mergeSender(other.getSender()); @@ -3882,8 +3934,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: { @@ -3909,7 +3966,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: { @@ -3932,21 +3994,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; } @@ -4042,24 +4123,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; } @@ -4190,12 +4287,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; @@ -4211,12 +4308,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; @@ -4245,19 +4342,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; } @@ -4267,8 +4370,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()); @@ -4277,7 +4380,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()); @@ -4297,9 +4400,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 @@ -4311,7 +4414,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 @@ -4487,8 +4590,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()); @@ -4497,7 +4600,7 @@ public final class RemoteProtocol { mergeException(other.getException()); } if (other.hasSupervisorUuid()) { - setSupervisorUuid(other.getSupervisorUuid()); + mergeSupervisorUuid(other.getSupervisorUuid()); } if (other.hasIsActor()) { setIsActor(other.getIsActor()); @@ -4536,8 +4639,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: { @@ -4559,7 +4667,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: { @@ -4581,21 +4694,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; } @@ -4673,24 +4805,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; } @@ -6482,57 +6630,60 @@ 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\"_\n\033RemoteTypedAct" + - "orRefProtocol\022)\n\010actorRef\030\001 \002(\0132\027.Remote" + - "ActorRefProtocol\022\025\n\rinterfaceName\030\002 \002(\t\"" + - "\200\003\n\032SerializedActorRefProtocol\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\017originalAddress\030\004 \002(\0132\020.AddressProto" + - "col\022\025\n\ractorInstance\030\005 \001(\014\022\033\n\023serializer", - "Classname\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(\0132\022.LifeCycleProtocol\022+\n" + - "\nsupervisor\030\013 \001(\0132\027.RemoteActorRefProtoc" + - "ol\022\024\n\014hotswapStack\030\014 \001(\014\022(\n\010messages\030\r \003" + - "(\0132\026.RemoteRequestProtocol\"g\n\037Serialized" + - "TypedActorRefProtocol\022-\n\010actorRef\030\001 \002(\0132" + - "\033.SerializedActorRefProtocol\022\025\n\rinterfac" + - "eName\030\002 \002(\t\"r\n\017MessageProtocol\0225\n\023serial" + - "izationScheme\030\001 \002(\0162\030.SerializationSchem", - "eType\022\017\n\007message\030\002 \002(\014\022\027\n\017messageManifes" + - "t\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\t" + - "actorType\030\004 \002(\0162\n.ActorType\022/\n\016typedActo" + - "rInfo\030\005 \001(\0132\027.TypedActorInfoProtocol\022\n\n\002" + - "id\030\006 \001(\t\";\n\026TypedActorInfoProtocol\022\021\n\tin" + - "terface\030\001 \002(\t\022\016\n\006method\030\002 \002(\t\"\352\001\n\025Remote" + - "RequestProtocol\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" + - "(\0132\026.MetadataEntryProtocol\"\324\001\n\023RemoteRep" + - "lyProtocol\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.E" + - "xceptionProtocol\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.MetadataEntryProtoco" + - "l\")\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\tlifeCycle\030\001 \002(\0162\016.LifeCycleType\"1\n\017Add" + - "ressProtocol\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\013SC" + - "ALA_ACTOR\020\001\022\016\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACT" + - "OR\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_J" + - "SON\020\004\022\014\n\010PROTOBUF\020\005*-\n\rLifeCycleType\022\r\n\t" + - "PERMANENT\020\001\022\r\n\tTEMPORARY\020\002B-\n)se.scalabl", - "esolutions.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\"_\n" + + "\033RemoteTypedActorRefProtocol\022)\n\010actorRef" + + "\030\001 \002(\0132\027.RemoteActorRefProtocol\022\025\n\rinter" + + "faceName\030\002 \002(\t\"\217\003\n\032SerializedActorRefPro" + + "tocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidProtocol\022\n\n\002id" + + "\030\002 \002(\t\022\026\n\016actorClassname\030\003 \002(\t\022)\n\017origin" + + "alAddress\030\004 \002(\0132\020.AddressProtocol\022\025\n\ract", + "orInstance\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\tlifeCycl" + + "e\030\n \001(\0132\022.LifeCycleProtocol\022+\n\nsuperviso" + + "r\030\013 \001(\0132\027.RemoteActorRefProtocol\022\024\n\014hots" + + "wapStack\030\014 \001(\014\022(\n\010messages\030\r \003(\0132\026.Remot" + + "eRequestProtocol\"g\n\037SerializedTypedActor" + + "RefProtocol\022-\n\010actorRef\030\001 \002(\0132\033.Serializ" + + "edActorRefProtocol\022\025\n\rinterfaceName\030\002 \002(" + + "\t\"r\n\017MessageProtocol\0225\n\023serializationSch", + "eme\030\001 \002(\0162\030.SerializationSchemeType\022\017\n\007m" + + "essage\030\002 \002(\014\022\027\n\017messageManifest\030\003 \001(\014\"\255\001" + + "\n\021ActorInfoProtocol\022\033\n\004uuid\030\001 \002(\0132\r.Uuid" + + "Protocol\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\016type" + + "dActorInfo\030\005 \001(\0132\027.TypedActorInfoProtoco" + + "l\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\025R" + + "emoteRequestProtocol\022\033\n\004uuid\030\001 \002(\0132\r.Uui" + + "dProtocol\022!\n\007message\030\002 \002(\0132\020.MessageProt", + "ocol\022%\n\tactorInfo\030\003 \002(\0132\022.ActorInfoProto" + + "col\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.R" + + "emoteActorRefProtocol\022(\n\010metadata\030\007 \003(\0132" + + "\026.MetadataEntryProtocol\"\364\001\n\023RemoteReplyP" + + "rotocol\022\033\n\004uuid\030\001 \002(\0132\r.UuidProtocol\022!\n\007" + + "message\030\002 \001(\0132\020.MessageProtocol\022%\n\texcep" + + "tion\030\003 \001(\0132\022.ExceptionProtocol\022%\n\016superv" + + "isorUuid\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\014UuidPr" + + "otocol\022\014\n\004high\030\001 \002(\004\022\013\n\003low\030\002 \002(\004\"3\n\025Met" + + "adataEntryProtocol\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\017AddressProtoco" + + "l\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\"7\n\021Exc" + + "eptionProtocol\022\021\n\tclassname\030\001 \002(\t\022\017\n\007mes" + + "sage\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\027Ser" + + "ializationSchemeType\022\010\n\004JAVA\020\001\022\013\n\007SBINAR", + "Y\020\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JSON\020\004\022\014\n\010PR" + + "OTOBUF\020\005*-\n\rLifeCycleType\022\r\n\tPERMANENT\020\001" + + "\022\r\n\tTEMPORARY\020\002B-\n)se.scalablesolutions." + + "akka.remote.protocolH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -6544,7 +6695,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_RemoteTypedActorRefProtocol_descriptor = @@ -6600,7 +6751,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 = @@ -6608,7 +6759,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 e84ae9f18e..1ea9d8f986 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 string uuid = 1; + required string classOrServiceName = 1; required string actorClassname = 2; required AddressProtocol homeAddress = 3; optional uint64 timeout = 4; @@ -37,7 +37,7 @@ message RemoteTypedActorRefProtocol { * from its original host. */ message SerializedActorRefProtocol { - required string uuid = 1; + required UuidProtocol uuid = 1; required string id = 2; required string actorClassname = 3; required AddressProtocol originalAddress = 4; @@ -75,7 +75,7 @@ message MessageProtocol { * Defines the actor info. */ message ActorInfoProtocol { - required string uuid = 1; + required UuidProtocol uuid = 1; required string target = 2; required uint64 timeout = 3; required ActorType actorType = 4; @@ -95,11 +95,11 @@ message TypedActorInfoProtocol { * Defines a remote message request. */ message RemoteRequestProtocol { - required uint64 id = 1; + required UuidProtocol uuid = 1; 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; } @@ -108,10 +108,10 @@ message RemoteRequestProtocol { * Defines a remote message reply. */ message RemoteReplyProtocol { - required uint64 id = 1; + 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 97e2f3070f..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 @@ -32,18 +32,6 @@ import scala.collection.mutable.{HashSet, HashMap} import scala.reflect.BeanProperty import se.scalablesolutions.akka.actor._ -/** - * 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. */ @@ -75,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) @@ -174,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 } @@ -206,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) @@ -299,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) } @@ -342,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, @@ -382,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, @@ -403,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) @@ -420,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 b258c4867d..fadc5ce60a 100644 --- a/akka-remote/src/main/scala/remote/RemoteServer.scala +++ b/akka-remote/src/main/scala/remote/RemoteServer.scala @@ -10,7 +10,7 @@ import java.util.concurrent.{ConcurrentHashMap, Executors} import java.util.{Map => JMap} import se.scalablesolutions.akka.actor.{ - Actor, TypedActor, ActorRef, IllegalActorStateException, RemoteActorSystemMessage} + Actor, TypedActor, ActorRef, IllegalActorStateException, RemoteActorSystemMessage,uuidFrom,Uuid} import se.scalablesolutions.akka.actor.Actor._ import se.scalablesolutions.akka.util._ import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._ @@ -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 } } @@ -536,10 +535,10 @@ class RemoteServerHandler( override def onComplete(result: AnyRef) { log.debug("Returning result from actor invocation [%s]", result) val replyBuilder = RemoteReplyProtocol.newBuilder - .setId(request.getId) - .setMessage(MessageSerializer.serialize(result)) - .setIsSuccessful(true) - .setIsActor(true) + .setUuid(request.getUuid) + .setMessage(MessageSerializer.serialize(result)) + .setIsSuccessful(true) + .setIsActor(true) if (request.hasSupervisorUuid) replyBuilder.setSupervisorUuid(request.getSupervisorUuid) @@ -580,7 +579,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) @@ -640,7 +639,7 @@ class RemoteServerHandler( val clazz = if (applicationLoader.isDefined) applicationLoader.get.loadClass(name) else Class.forName(name) val actorRef = Actor.actorOf(clazz.newInstance.asInstanceOf[Actor]) - actorRef.uuid = uuid + actorRef.uuid = uuidFrom(uuid.getHigh,uuid.getLow) actorRef.id = id actorRef.timeout = timeout actorRef.remoteAddress = None @@ -695,7 +694,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 c9b443f4ec..0e7f5ce732 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -8,12 +8,12 @@ import se.scalablesolutions.akka.stm.global._ import se.scalablesolutions.akka.stm.TransactionManagement._ import se.scalablesolutions.akka.stm.TransactionManagement import se.scalablesolutions.akka.dispatch.MessageInvocation -import se.scalablesolutions.akka.remote.{RemoteServer, RemoteRequestProtocolIdFactory, MessageSerializer} +import se.scalablesolutions.akka.remote.{RemoteServer, MessageSerializer} import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.{ActorType => ActorTypeProtocol, _} 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.actor._ @@ -110,12 +110,13 @@ object ActorSerialization { .build val builder = SerializedActorRefProtocol.newBuilder - .setUuid(actorRef.uuid) - .setId(actorRef.id) - .setActorClassname(actorRef.actorClass.getName) - .setOriginalAddress(originalAddress) - .setIsTransactor(actorRef.isTransactor) - .setTimeout(actorRef.timeout) + .setUuid(UuidProtocol.newBuilder.setHigh(actorRef.uuid.getTime).setLow(actorRef.uuid.getClockSeqAndNode).build) + .setId(actorRef.id) + .setActorClassname(actorRef.actorClass.getName) + .setOriginalAddress(originalAddress) + .setIsTransactor(actorRef.isTransactor) + .setTimeout(actorRef.timeout) + if (serializeMailBox == true) { val messages = @@ -191,7 +192,7 @@ object ActorSerialization { } val ar = new LocalActorRef( - protocol.getUuid, + uuidFrom(protocol.getUuid.getHigh,protocol.getUuid.getLow), protocol.getId, protocol.getOriginalAddress.getHostname, protocol.getOriginalAddress.getPort, @@ -232,7 +233,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, @@ -251,16 +252,16 @@ object RemoteActorSerialization { if (!registeredInRemoteNodeDuringSerialization) { Actor.log.debug("Register serialized Actor [%s] as remote @ [%s:%s]", actorClass.getName, host, port) RemoteServer.getOrCreateServer(homeAddress) - RemoteServer.registerActorByUuid(homeAddress, uuid, ar) + RemoteServer.registerActorByUuid(homeAddress, uuid.toString, ar) registeredInRemoteNodeDuringSerialization = true } RemoteActorRefProtocol.newBuilder - .setUuid(uuid) - .setActorClassname(actorClass.getName) - .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) - .setTimeout(timeout) - .build + .setClassOrServiceName(uuid.toString) + .setActorClassname(actorClass.getName) + .setHomeAddress(AddressProtocol.newBuilder.setHostname(host).setPort(port).build) + .setTimeout(timeout) + .build } def createRemoteRequestProtocolBuilder( @@ -274,7 +275,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) @@ -295,18 +296,18 @@ object RemoteActorSerialization { val actorInfo = actorInfoBuilder.build val requestBuilder = RemoteRequestProtocol.newBuilder - .setId(RemoteRequestProtocolIdFactory.nextId) + .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.toString, sender) + requestBuilder.setSender(toRemoteActorRefProtocol(sender)) - senderOption.foreach { - sender => - RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid, sender) - requestBuilder.setSender(toRemoteActorRefProtocol(sender)) } requestBuilder } diff --git a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSpec.scala b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSpec.scala index fbf723ece5..e40d44ad6c 100644 --- a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSpec.scala +++ b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteActorSpec.scala @@ -208,7 +208,7 @@ class ServerInitiatedRemoteActorSpec extends JUnitSuite { def shouldRegisterAndUnregisterByUuid { val actor1 = actorOf[RemoteActorSpecActorUnidirectional] server.register("uuid:" + actor1.uuid, actor1) - assert(server.actorsByUuid().get(actor1.uuid) != null, "actor registered") + assert(server.actorsByUuid().get(actor1.uuid.toString) != null, "actor registered") server.unregister("uuid:" + actor1.uuid) assert(server.actorsByUuid().get(actor1.uuid) == null, "actor unregistered") } diff --git a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteTypedActorSpec.scala b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteTypedActorSpec.scala index f50c3e6652..71ece9792e 100644 --- a/akka-remote/src/test/scala/remote/ServerInitiatedRemoteTypedActorSpec.scala +++ b/akka-remote/src/test/scala/remote/ServerInitiatedRemoteTypedActorSpec.scala @@ -103,9 +103,9 @@ class ServerInitiatedRemoteTypedActorSpec extends it("should register and unregister typed actors") { val typedActor = TypedActor.newInstance(classOf[RemoteTypedActorOne], classOf[RemoteTypedActorOneImpl], 1000) server.registerTypedActor("my-test-service", typedActor) - assert(server.typedActors().get("my-test-service") != null, "typed actor registered") + assert(server.typedActors().get("my-test-service") ne null, "typed actor registered") server.unregisterTypedActor("my-test-service") - assert(server.typedActors().get("my-test-service") == null, "typed actor unregistered") + assert(server.typedActors().get("my-test-service") eq null, "typed actor unregistered") } it("should register and unregister typed actors by uuid") { @@ -113,9 +113,9 @@ class ServerInitiatedRemoteTypedActorSpec extends val init = AspectInitRegistry.initFor(typedActor) val uuid = "uuid:" + init.actorRef.uuid server.registerTypedActor(uuid, typedActor) - assert(server.typedActorsByUuid().get(init.actorRef.uuid) != null, "typed actor registered") + assert(server.typedActorsByUuid().get(init.actorRef.uuid.toString) ne null, "typed actor registered") server.unregisterTypedActor(uuid) - assert(server.typedActorsByUuid().get(init.actorRef.uuid) == null, "typed actor unregistered") + assert(server.typedActorsByUuid().get(init.actorRef.uuid.toString) eq null, "typed actor unregistered") } it("should find typed actors by uuid") { @@ -123,7 +123,7 @@ class ServerInitiatedRemoteTypedActorSpec extends val init = AspectInitRegistry.initFor(typedActor) val uuid = "uuid:" + init.actorRef.uuid server.registerTypedActor(uuid, typedActor) - assert(server.typedActorsByUuid().get(init.actorRef.uuid) != null, "typed actor registered") + assert(server.typedActorsByUuid().get(init.actorRef.uuid.toString) ne null, "typed actor registered") val actor = RemoteClient.typedActorFor(classOf[RemoteTypedActorOne], uuid, HOSTNAME, PORT) expect("oneway") { 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 f6cf2e2337..a4c7ddada1 100644 --- a/akka-typed-actor/src/main/scala/actor/TypedActor.scala +++ b/akka-typed-actor/src/main/scala/actor/TypedActor.scala @@ -633,7 +633,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 = { 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 0000000000..b205a2488e Binary files /dev/null and b/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar differ diff --git a/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.pom b/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.pom new file mode 100644 index 0000000000..bb20c22466 --- /dev/null +++ b/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.pom @@ -0,0 +1,8 @@ + + + 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 bb468c7b9f..7fdc8d4b53 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -147,6 +147,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val jetty_xml = "org.eclipse.jetty" % "jetty-xml" % JETTY_VERSION % "compile" lazy val jetty_servlet = "org.eclipse.jetty" % "jetty-servlet" % 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" @@ -354,6 +356,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