diff --git a/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java b/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java deleted file mode 100644 index f06aab34df..0000000000 --- a/akka-actor/src/main/java/se/scalablesolutions/akka/util/UUID.java +++ /dev/null @@ -1,59 +0,0 @@ -/** - * Copyright (C) 2009-2010 Scalable Solutions AB - */ -package se.scalablesolutions.akka.util; - -/** - * NOTE: - *

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

- * Original JavaDoc: - *

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

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

- * Future: use one instance of Uuid per type of object for better performance - * and more detailed info (instance could be matched to its uuid's via a map or - * array). This all static version bites.### - */ -public final class UUID { - - public static final long UUID_NONE = 0; - public static final long UUID_WILD = -1; - public static final long UUID_MAGICMASK = 0xff << 56; - public static final long UUID_MAGIC = 'U' << 56; - - protected static long lastTime; - - /** - * Generate and return a new Universally Unique ID. - * Happens to be monotonically increasing. - */ - public synchronized static long newUuid() { - long time = System.currentTimeMillis(); - - if (time <= lastTime) { - time = lastTime + 1; - } - lastTime = time; - return UUID_MAGIC | time; - } - - /** - * Returns true if uuid could have been generated by Uuid. - */ - public static boolean isValid(final long uuid) { - return (uuid & UUID_MAGICMASK) == UUID_MAGIC - && (uuid & ~UUID_MAGICMASK) != 0; - } -} \ No newline at end of file diff --git a/akka-actor/src/main/scala/util/UUID.scala b/akka-actor/src/main/scala/util/UUID.scala new file mode 100644 index 0000000000..548f014e58 --- /dev/null +++ b/akka-actor/src/main/scala/util/UUID.scala @@ -0,0 +1,9 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ + +package se.scalablesolutions.akka.util + +object UUID { + def newUuid = new com.eaio.uuid.UUID() +} \ No newline at end of file diff --git a/akka-remote/src/main/scala/remote/RemoteClient.scala b/akka-remote/src/main/scala/remote/RemoteClient.scala index 35578477ff..459c260a62 100644 --- a/akka-remote/src/main/scala/remote/RemoteClient.scala +++ b/akka-remote/src/main/scala/remote/RemoteClient.scala @@ -31,18 +31,6 @@ import java.util.concurrent.atomic.AtomicLong import scala.collection.mutable.{HashSet, HashMap} import scala.reflect.BeanProperty -/** - * Atomic remote request/reply message id generator. - * - * @author Jonas Bonér - */ -object RemoteRequestProtocolIdFactory { - private val nodeId = UUID.newUuid - private val id = new AtomicLong - - def nextId: Long = id.getAndIncrement + nodeId -} - /** * Life-cycle events for RemoteClient. */ diff --git a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala index 3f54f8e921..4050c2026f 100644 --- a/akka-remote/src/main/scala/serialization/SerializationProtocol.scala +++ b/akka-remote/src/main/scala/serialization/SerializationProtocol.scala @@ -10,11 +10,12 @@ import se.scalablesolutions.akka.stm.global._ import se.scalablesolutions.akka.stm.TransactionManagement._ import se.scalablesolutions.akka.stm.TransactionManagement import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._ -import se.scalablesolutions.akka.remote.{RemoteServer, RemoteRequestProtocolIdFactory, MessageSerializer} +import se.scalablesolutions.akka.remote.{RemoteServer, MessageSerializer} import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType._ import se.scalablesolutions.akka.serialization.Serializer import com.google.protobuf.ByteString +import se.scalablesolutions.akka.util.UUID /** * Type class definition for Actor Serialization @@ -267,7 +268,7 @@ object RemoteActorSerialization { val actorInfo = actorInfoBuilder.build val requestBuilder = RemoteRequestProtocol.newBuilder - .setId(RemoteRequestProtocolIdFactory.nextId) + .setId(UUID.newUuid) .setMessage(MessageSerializer.serialize(message)) .setActorInfo(actorInfo) .setIsOneWay(isOneWay) diff --git a/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar b/embedded-repo/com/eaio/uuid/3.2/uuid-3.2.jar new file mode 100644 index 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 53afac6a22..cf7378b0d2 100644 --- a/project/build/AkkaProject.scala +++ b/project/build/AkkaProject.scala @@ -140,6 +140,8 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { lazy val jetty_util = "org.eclipse.jetty" % "jetty-util" % JETTY_VERSION % "compile" lazy val jetty_xml = "org.eclipse.jetty" % "jetty-xml" % JETTY_VERSION % "compile" + lazy val uuid = "com.eaio" % "uuid" % "3.2" % "compile" + lazy val guicey = "org.guiceyfruit" % "guice-all" % "2.0" % "compile" lazy val h2_lzf = "voldemort.store.compress" % "h2-lzf" % "1.0" % "compile" @@ -340,6 +342,7 @@ class AkkaParentProject(info: ProjectInfo) extends DefaultProject(info) { // ------------------------------------------------------------------------------------------------------------------- class AkkaActorProject(info: ProjectInfo) extends AkkaDefaultProject(info, distPath) { + val uuid = Dependencies.uuid val configgy = Dependencies.configgy val hawtdispatch = Dependencies.hawtdispatch val multiverse = Dependencies.multiverse