diff --git a/kernel/src/main/scala/Kernel.scala b/kernel/src/main/scala/Kernel.scala
index 9ca5a249c8..73dc069343 100644
--- a/kernel/src/main/scala/Kernel.scala
+++ b/kernel/src/main/scala/Kernel.scala
@@ -53,13 +53,12 @@ object Kernel extends Logging {
if (RUN_REMOTE_SERVICE) startRemoteService
STORAGE_SYSTEM match {
- case "cassandra" => startCassandra
- case "terracotta" => throw new UnsupportedOperationException("terracotta storage backend is not yet supported")
- case "redis" => throw new UnsupportedOperationException("redis storage backend is not yet supported")
- case "voldemort" => throw new UnsupportedOperationException("voldemort storage backend is not yet supported")
+ case "cassandra" => startCassandra
+ case "terracotta" => throw new UnsupportedOperationException("terracotta storage backend is not yet supported")
+ case "redis" => throw new UnsupportedOperationException("redis storage backend is not yet supported")
+ case "voldemort" => throw new UnsupportedOperationException("voldemort storage backend is not yet supported")
case "tokyo-cabinet" => throw new UnsupportedOperationException("tokyo-cabinet storage backend is not yet supported")
- case "tokyo-tyrant" => throw new UnsupportedOperationException("tokyo-tyrart storage backend is not yet supported")
- case "hazelcast" => throw new UnsupportedOperationException("hazelcast storage backend is not yet supported")
+ case _ => throw new UnsupportedOperationException("Unknown storage system [" + STORAGE_SYSTEM + "]")
}
if (RUN_REST_SERVICE) startJersey
@@ -115,7 +114,7 @@ object Kernel extends Logging {
remoteServerThread.start
}
- private[akka] def startCassandra = if (kernel.Kernel.config.getBool("akka.storage.cassandra.service", true)) {
+ private[akka] def startCassandra = if (config.getBool("akka.storage.cassandra.service", true)) {
System.setProperty("cassandra", "")
System.setProperty("storage-config", akka.Boot.CONFIG + "/")
CassandraStorage.start
diff --git a/kernel/src/main/scala/actor/ActiveObject.scala b/kernel/src/main/scala/actor/ActiveObject.scala
index 14d3f46c1e..c99efabb67 100644
--- a/kernel/src/main/scala/actor/ActiveObject.scala
+++ b/kernel/src/main/scala/actor/ActiveObject.scala
@@ -4,16 +4,15 @@
package se.scalablesolutions.akka.kernel.actor
-import com.google.protobuf.ByteString
-import java.io.File
import java.lang.reflect.{InvocationTargetException, Method}
import java.net.InetSocketAddress
-import kernel.config.ScalaConfig._
import kernel.reactor.{MessageDispatcher, FutureResult}
-import kernel.util.{HashCode, Serializer, JavaJSONSerializer}
import kernel.nio.protobuf.RemoteProtocol.{RemoteRequest, RemoteReply}
-import kernel.nio.{RemoteClient, RemoteServer, RemoteRequestIdFactory}
+import kernel.nio.{RemoteProtocolBuilder, RemoteClient, RemoteServer, RemoteRequestIdFactory}
+import kernel.config.ScalaConfig._
+import kernel.util._
+import serialization.Serializer
import org.codehaus.aspectwerkz.intercept.{Advisable, AroundAdvice}
import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint}
@@ -255,8 +254,6 @@ sealed class ActorAroundAdvice(val target: Class[_],
val actor: Dispatcher,
val remoteAddress: Option[InetSocketAddress],
val timeout: Long) extends AroundAdvice {
- private val serializer: Serializer = JavaJSONSerializer
-
val id = target.getName
actor.timeout = timeout
actor.start
@@ -281,16 +278,14 @@ sealed class ActorAroundAdvice(val target: Class[_],
private def remoteDispatch(joinpoint: JoinPoint): AnyRef = {
val rtti = joinpoint.getRtti.asInstanceOf[MethodRtti]
val oneWay = isOneWay(rtti)
- val (message: AnyRef, isEscaped) = escapeArguments(rtti.getParameterValues)
+ val (message: Array[AnyRef], isEscaped) = escapeArguments(rtti.getParameterValues)
val supervisorId = {
val id = actor.registerSupervisorAsRemoteActor
if (id.isDefined) id.get
else null
}
- val request = RemoteRequest.newBuilder
+ val requestBuilder = RemoteRequest.newBuilder
.setId(RemoteRequestIdFactory.nextId)
- .setMessage(ByteString.copyFrom(serializer.out(message)))
- .setMessageType(message.getClass.getName)
.setMethod(rtti.getMethod.getName)
.setTarget(target.getName)
.setTimeout(timeout)
@@ -298,8 +293,9 @@ sealed class ActorAroundAdvice(val target: Class[_],
.setIsActor(false)
.setIsOneWay(oneWay)
.setIsEscaped(false)
- .build
- val future = RemoteClient.clientFor(remoteAddress.get).send(request)
+ RemoteProtocolBuilder.setMessage(message, requestBuilder)
+ val remoteMessage = requestBuilder.build
+ val future = RemoteClient.clientFor(remoteAddress.get).send(remoteMessage)
if (oneWay) null // for void methods
else {
if (future.isDefined) {
@@ -321,7 +317,7 @@ sealed class ActorAroundAdvice(val target: Class[_],
rtti.getMethod.getReturnType == java.lang.Void.TYPE ||
rtti.getMethod.isAnnotationPresent(Annotations.oneway)
- private def escapeArguments(args: Array[Object]): Tuple2[Array[Object], Boolean] = {
+ private def escapeArguments(args: Array[AnyRef]): Tuple2[Array[AnyRef], Boolean] = {
var isEscaped = false
val escapedArgs = for (arg <- args) yield {
val clazz = arg.getClass
@@ -451,7 +447,8 @@ private[kernel] class Dispatcher(val callbacks: Option[RestartCallbacks]) extend
if (arg.getClass.getName.contains("$$ProxiedByAWSubclassing$$")) unserializable = true
}
if (!unserializable && hasMutableArgument) {
- val copyOfArgs = serializer.deepClone(args)
+ // FIXME: can we have another default deep cloner?
+ val copyOfArgs = Serializer.Java.deepClone(args)
joinpoint.getRtti.asInstanceOf[MethodRtti].setParameterValues(copyOfArgs)
}
}
diff --git a/kernel/src/main/scala/actor/Actor.scala b/kernel/src/main/scala/actor/Actor.scala
index d7a23b08ae..de154d76f9 100644
--- a/kernel/src/main/scala/actor/Actor.scala
+++ b/kernel/src/main/scala/actor/Actor.scala
@@ -12,12 +12,11 @@ import kernel.reactor._
import kernel.config.ScalaConfig._
import kernel.stm.TransactionManagement
import kernel.util.Helpers.ReadWriteLock
-import kernel.util.{Serializer, ScalaJSONSerializer, Logging}
-import kernel.nio.protobuf._
-import kernel.nio.{RemoteServer, RemoteClient, RemoteRequestIdFactory}
+import kernel.nio.protobuf.RemoteProtocol.RemoteRequest
+import kernel.util.Logging
+import serialization.{Serializer, Serializable, SerializationProtocol}
+import nio.{RemoteProtocolBuilder, RemoteClient, RemoteServer, RemoteRequestIdFactory}
-
-import nio.protobuf.RemoteProtocol.RemoteRequest
sealed abstract class LifecycleMessage
case class Init(config: AnyRef) extends LifecycleMessage
case class HotSwap(code: Option[PartialFunction[Any, Unit]]) extends LifecycleMessage
@@ -32,20 +31,25 @@ object DispatcherType {
case object ThreadBasedDispatcher extends DispatcherType
}
+/**
+ * @author Jonas Bonér
+ */
class ActorMessageInvoker(val actor: Actor) extends MessageInvoker {
def invoke(handle: MessageInvocation) = actor.invoke(handle)
}
- def deserialize(array : Array[Byte]) : MediaContent = fromByteArray[MediaContent](array)
- def serialize(content : MediaContent) : Array[Byte] = toByteArray(content)
-
-
+/**
+ * @author Jonas Bonér
+ */
object Actor {
val TIMEOUT = kernel.Kernel.config.getInt("akka.actor.timeout", 5000)
val SERIALIZE_MESSAGES = kernel.Kernel.config.getBool("akka.actor.serialize-messages", false)
}
-trait Actor extends Logging with TransactionManagement {
+/**
+ * @author Jonas Bonér
+ */
+@serializable trait Actor extends Logging with TransactionManagement {
@volatile private[this] var isRunning: Boolean = false
private[this] val remoteFlagLock = new ReadWriteLock
private[this] val transactionalFlagLock = new ReadWriteLock
@@ -61,8 +65,6 @@ trait Actor extends Logging with TransactionManagement {
protected[this] val linkedActors = new CopyOnWriteArraySet[Actor]
protected[actor] var lifeCycleConfig: Option[LifeCycle] = None
- protected[this] val serializer: Serializer = ScalaJSONSerializer
-
// ====================================
// ==== USER CALLBACKS TO OVERRIDE ====
// ====================================
@@ -403,8 +405,6 @@ trait Actor extends Logging with TransactionManagement {
if (remoteAddress.isDefined) {
val requestBuilder = RemoteRequest.newBuilder
.setId(RemoteRequestIdFactory.nextId)
- .setMessage(ByteString.copyFrom(serializer.out(message)))
- .setMessageType(message.getClass.getName)
.setTarget(this.getClass.getName)
.setTimeout(timeout)
.setIsActor(true)
@@ -412,6 +412,7 @@ trait Actor extends Logging with TransactionManagement {
.setIsEscaped(false)
val id = registerSupervisorAsRemoteActor
if (id.isDefined) requestBuilder.setSupervisorUuid(id.get)
+ RemoteProtocolBuilder.setMessage(message, requestBuilder)
RemoteClient.clientFor(remoteAddress.get).send(requestBuilder.build)
} else {
val handle = new MessageInvocation(this, message, None, TransactionManagement.threadBoundTx.get)
@@ -424,13 +425,12 @@ trait Actor extends Logging with TransactionManagement {
if (remoteAddress.isDefined) {
val requestBuilder = RemoteRequest.newBuilder
.setId(RemoteRequestIdFactory.nextId)
- .setMessage(ByteString.copyFrom(serializer.out(message)))
- .setMessageType(message.getClass.getName)
.setTarget(this.getClass.getName)
.setTimeout(timeout)
.setIsActor(true)
.setIsOneWay(false)
.setIsEscaped(false)
+ RemoteProtocolBuilder.setMessage(message, requestBuilder)
val id = registerSupervisorAsRemoteActor
if (id.isDefined) requestBuilder.setSupervisorUuid(id.get)
val future = RemoteClient.clientFor(remoteAddress.get).send(requestBuilder.build)
@@ -455,7 +455,7 @@ trait Actor extends Logging with TransactionManagement {
private def dispatch[T](messageHandle: MessageInvocation) = {
if (messageHandle.tx.isDefined) TransactionManagement.threadBoundTx.set(messageHandle.tx)
- val message = messageHandle.message//serializeMessage(messageHandle.message)
+ val message = messageHandle.message //serializeMessage(messageHandle.message)
val future = messageHandle.future
try {
senderFuture = future
@@ -474,7 +474,7 @@ trait Actor extends Logging with TransactionManagement {
private def transactionalDispatch[T](messageHandle: MessageInvocation) = {
if (messageHandle.tx.isDefined) TransactionManagement.threadBoundTx.set(messageHandle.tx)
- val message = messageHandle.message//serializeMessage(messageHandle.message)
+ val message = messageHandle.message //serializeMessage(messageHandle.message)
val future = messageHandle.future
try {
if (!tryToCommitTransaction && isTransactionTopLevel) handleCollision
@@ -607,7 +607,7 @@ trait Actor extends Logging with TransactionManagement {
!message.isInstanceOf[scala.collection.immutable.Set[_]] &&
!message.isInstanceOf[scala.collection.immutable.Tree[_,_]] &&
!message.getClass.isAnnotationPresent(Annotations.immutable)) {
- serializer.deepClone(message)
+ Serializer.Java.deepClone(message)
} else message
} else message
diff --git a/kernel/src/main/scala/nio/RemoteClient.scala b/kernel/src/main/scala/nio/RemoteClient.scala
index c18f64db8b..80a03c826d 100644
--- a/kernel/src/main/scala/nio/RemoteClient.scala
+++ b/kernel/src/main/scala/nio/RemoteClient.scala
@@ -7,10 +7,11 @@ package se.scalablesolutions.akka.kernel.nio
import java.net.InetSocketAddress
import java.util.concurrent.{Executors, ConcurrentMap, ConcurrentHashMap}
-import kernel.nio.protobuf.RemoteProtocol.{RemoteRequest, RemoteReply}
+import protobuf.RemoteProtocol.{RemoteRequest, RemoteReply}
import kernel.actor.{Exit, Actor}
import kernel.reactor.{DefaultCompletableFutureResult, CompletableFutureResult}
-import kernel.util.{Serializer, ScalaJSONSerializer, JavaJSONSerializer, Logging}
+import serialization.{Serializer, Serializable, SerializationProtocol}
+import kernel.util.Logging
import org.jboss.netty.bootstrap.ClientBootstrap
import org.jboss.netty.channel._
@@ -18,9 +19,11 @@ import org.jboss.netty.channel.socket.nio.NioClientSocketChannelFactory
import org.jboss.netty.handler.codec.frame.{LengthFieldBasedFrameDecoder, LengthFieldPrepender}
import org.jboss.netty.handler.codec.protobuf.{ProtobufDecoder, ProtobufEncoder}
-import protobuf.RemoteProtocol
import scala.collection.mutable.HashMap
+/**
+ * @author Jonas Bonér
+ */
object RemoteClient extends Logging {
private val clients = new HashMap[String, RemoteClient]
def clientFor(address: InetSocketAddress): RemoteClient = synchronized {
@@ -37,6 +40,9 @@ object RemoteClient extends Logging {
}
}
+/**
+ * @author Jonas Bonér
+ */
class RemoteClient(hostname: String, port: Int) extends Logging {
@volatile private var isRunning = false
private val futures = new ConcurrentHashMap[Long, CompletableFutureResult]
@@ -107,7 +113,7 @@ class RemoteClientPipelineFactory(futures: ConcurrentMap[Long, CompletableFuture
def getPipeline: ChannelPipeline = {
val p = Channels.pipeline()
p.addLast("frameDecoder", new LengthFieldBasedFrameDecoder(1048576, 0, 4, 0, 4));
- p.addLast("protobufDecoder", new ProtobufDecoder(RemoteProtocol.RemoteReply.getDefaultInstance));
+ p.addLast("protobufDecoder", new ProtobufDecoder(RemoteReply.getDefaultInstance));
p.addLast("frameEncoder", new LengthFieldPrepender(4));
p.addLast("protobufEncoder", new ProtobufEncoder());
p.addLast("handler", new RemoteClientHandler(futures, supervisors))
@@ -135,12 +141,7 @@ class RemoteClientHandler(val futures: ConcurrentMap[Long, CompletableFutureResu
log.debug("Received RemoteReply[\n%s]", reply.toString)
val future = futures.get(reply.getId)
if (reply.getIsSuccessful) {
- val messageBytes = reply.getMessage.toByteArray
- val messageType = reply.getMessageType
- val messageClass = Class.forName(messageType)
- val message =
- if (reply.isActor) ScalaJSONSerializer.in(messageBytes, Some(messageClass))
- else JavaJSONSerializer.in(messageBytes, Some(messageClass))
+ val message = RemoteProtocolBuilder.getMessage(reply)
future.completeWithResult(message)
} else {
if (reply.hasSupervisorUuid) {
@@ -148,15 +149,9 @@ class RemoteClientHandler(val futures: ConcurrentMap[Long, CompletableFutureResu
if (!supervisors.containsKey(supervisorUuid)) throw new IllegalStateException("Expected a registered supervisor for UUID [" + supervisorUuid + "] but none was found")
val supervisedActor = supervisors.get(supervisorUuid)
if (!supervisedActor.supervisor.isDefined) throw new IllegalStateException("Can't handle restart for remote actor " + supervisedActor + " since its supervisor has been removed")
- else supervisedActor.supervisor.get ! Exit(supervisedActor, new RuntimeException(reply.getException))
+ else supervisedActor.supervisor.get ! Exit(supervisedActor, parseException(reply))
}
- val exception = reply.getException
- val exceptionType = Class.forName(exception.substring(0, exception.indexOf('$')))
- val exceptionMessage = exception.substring(exception.indexOf('$') + 1, exception.length)
- val exceptionInstance = exceptionType
- .getConstructor(Array[Class[_]](classOf[String]): _*)
- .newInstance(exceptionMessage).asInstanceOf[Throwable]
- future.completeWithException(null, exceptionInstance)
+ future.completeWithException(null, parseException(reply))
}
futures.remove(reply.getId)
} else throw new IllegalArgumentException("Unknown message received in remote client handler: " + result)
@@ -172,4 +167,13 @@ class RemoteClientHandler(val futures: ConcurrentMap[Long, CompletableFutureResu
event.getCause.printStackTrace
event.getChannel.close
}
+
+ private def parseException(reply: RemoteReply) = {
+ val exception = reply.getException
+ val exceptionType = Class.forName(exception.substring(0, exception.indexOf('$')))
+ val exceptionMessage = exception.substring(exception.indexOf('$') + 1, exception.length)
+ exceptionType
+ .getConstructor(Array[Class[_]](classOf[String]): _*)
+ .newInstance(exceptionMessage).asInstanceOf[Throwable]
+ }
}
diff --git a/kernel/src/main/scala/nio/RemoteProtocolBuilder.scala b/kernel/src/main/scala/nio/RemoteProtocolBuilder.scala
new file mode 100644
index 0000000000..1a56eed18d
--- /dev/null
+++ b/kernel/src/main/scala/nio/RemoteProtocolBuilder.scala
@@ -0,0 +1,111 @@
+/**
+ * Copyright (C) 2009 Scalable Solutions.
+ */
+
+package se.scalablesolutions.akka.kernel.nio
+
+import akka.serialization.Serializable.SBinary
+import com.google.protobuf.{Message, ByteString}
+
+import serialization.{Serializer, Serializable, SerializationProtocol}
+import protobuf.RemoteProtocol.{RemoteRequest, RemoteReply}
+
+object RemoteProtocolBuilder {
+ def getMessage(request: RemoteRequest): AnyRef = {
+ request.getProtocol match {
+ case SerializationProtocol.SBINARY =>
+ val renderer = Class.forName(new String(request.getMessageManifest.toByteArray)).newInstance.asInstanceOf[SBinary]
+ renderer.fromBytes(request.getMessage.toByteArray)
+ case SerializationProtocol.SCALA_JSON =>
+ val manifest = Serializer.Java.in(request.getMessageManifest.toByteArray, None).asInstanceOf[String]
+ Serializer.ScalaJSON.in(request.getMessage.toByteArray, Some(Class.forName(manifest)))
+ case SerializationProtocol.JAVA_JSON =>
+ val manifest = Serializer.Java.in(request.getMessageManifest.toByteArray, None).asInstanceOf[String]
+ Serializer.JavaJSON.in(request.getMessage.toByteArray, Some(Class.forName(manifest)))
+ case SerializationProtocol.PROTOBUF =>
+ val manifest = Serializer.Java.in(request.getMessageManifest.toByteArray, None).asInstanceOf[Message]
+ Serializer.Protobuf.in(request.getMessage.toByteArray, manifest)
+ case SerializationProtocol.JAVA =>
+ Serializer.Java.in(request.getMessage.toByteArray, None)
+ case SerializationProtocol.AVRO =>
+ throw new UnsupportedOperationException("Avro protocol is not yet supported")
+ }
+ }
+
+ def getMessage(reply: RemoteReply): AnyRef = {
+ reply.getProtocol match {
+ case SerializationProtocol.SBINARY =>
+ val renderer = Class.forName(new String(reply.getMessageManifest.toByteArray)).newInstance.asInstanceOf[SBinary]
+ renderer.fromBytes(reply.getMessage.toByteArray)
+ case SerializationProtocol.SCALA_JSON =>
+ val manifest = Serializer.Java.in(reply.getMessageManifest.toByteArray, None).asInstanceOf[String]
+ Serializer.ScalaJSON.in(reply.getMessage.toByteArray, Some(Class.forName(manifest)))
+ case SerializationProtocol.JAVA_JSON =>
+ val manifest = Serializer.Java.in(reply.getMessageManifest.toByteArray, None).asInstanceOf[String]
+ Serializer.JavaJSON.in(reply.getMessage.toByteArray, Some(Class.forName(manifest)))
+ case SerializationProtocol.PROTOBUF =>
+ val manifest = Serializer.Java.in(reply.getMessageManifest.toByteArray, None).asInstanceOf[Message]
+ Serializer.Protobuf.in(reply.getMessage.toByteArray, manifest)
+ case SerializationProtocol.JAVA =>
+ Serializer.Java.in(reply.getMessage.toByteArray, None)
+ case SerializationProtocol.AVRO =>
+ throw new UnsupportedOperationException("Avro protocol is not yet supported")
+ }
+ }
+
+ def setMessage(message: AnyRef, builder: RemoteRequest.Builder) = {
+ if (message.isInstanceOf[Serializable.SBinary]) {
+ val serializable = message.asInstanceOf[Serializable.SBinary]
+ builder.setProtocol(SerializationProtocol.SBINARY)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.getClass.getName.getBytes))
+ } else if (message.isInstanceOf[Serializable.Protobuf]) {
+ val serializable = message.asInstanceOf[Serializable.Protobuf]
+ builder.setProtocol(SerializationProtocol.PROTOBUF)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(Serializer.Java.out(serializable.getSchema)))
+ } else if (message.isInstanceOf[Serializable.ScalaJSON[_]]) {
+ val serializable = message.asInstanceOf[Serializable.ScalaJSON[_]]
+ builder.setProtocol(SerializationProtocol.SCALA_JSON)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.body.asInstanceOf[AnyRef].getClass.getName.getBytes))
+ } else if (message.isInstanceOf[Serializable.JavaJSON[_]]) {
+ val serializable = message.asInstanceOf[Serializable.JavaJSON[_]]
+ builder.setProtocol(SerializationProtocol.JAVA_JSON)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.body.asInstanceOf[AnyRef].getClass.getName.getBytes))
+ } else {
+ // default, e.g. if no protocol used explicitly then use Java serialization
+ builder.setProtocol(SerializationProtocol.JAVA)
+ builder.setMessage(ByteString.copyFrom(Serializer.Java.out(message)))
+ }
+ }
+
+ def setMessage(message: AnyRef, builder: RemoteReply.Builder) = {
+ if (message.isInstanceOf[Serializable.SBinary]) {
+ val serializable = message.asInstanceOf[Serializable.SBinary]
+ builder.setProtocol(SerializationProtocol.SBINARY)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.getClass.getName.getBytes))
+ } else if (message.isInstanceOf[Serializable.Protobuf]) {
+ val serializable = message.asInstanceOf[Serializable.Protobuf]
+ builder.setProtocol(SerializationProtocol.PROTOBUF)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(Serializer.Java.out(serializable.getSchema)))
+ } else if (message.isInstanceOf[Serializable.ScalaJSON[_]]) {
+ val serializable = message.asInstanceOf[Serializable.ScalaJSON[_]]
+ builder.setProtocol(SerializationProtocol.SCALA_JSON)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.body.asInstanceOf[AnyRef].getClass.getName.getBytes))
+ } else if (message.isInstanceOf[Serializable.JavaJSON[_]]) {
+ val serializable = message.asInstanceOf[Serializable.JavaJSON[_]]
+ builder.setProtocol(SerializationProtocol.JAVA_JSON)
+ builder.setMessage(ByteString.copyFrom(serializable.toBytes))
+ builder.setMessageManifest(ByteString.copyFrom(serializable.body.asInstanceOf[AnyRef].getClass.getName.getBytes))
+ } else {
+ // default, e.g. if no protocol used explicitly then use Java serialization
+ builder.setProtocol(SerializationProtocol.JAVA)
+ builder.setMessage(ByteString.copyFrom(Serializer.Java.out(message)))
+ }
+ }
+}
\ No newline at end of file
diff --git a/kernel/src/main/scala/nio/RemoteServer.scala b/kernel/src/main/scala/nio/RemoteServer.scala
index c1166dd174..e701c40637 100644
--- a/kernel/src/main/scala/nio/RemoteServer.scala
+++ b/kernel/src/main/scala/nio/RemoteServer.scala
@@ -9,9 +9,10 @@ import java.net.InetSocketAddress
import java.util.concurrent.{ConcurrentHashMap, Executors}
import kernel.actor._
-import kernel.util.{Serializer, ScalaJSONSerializer, JavaJSONSerializer, Logging}
+import kernel.util._
import protobuf.RemoteProtocol
import protobuf.RemoteProtocol.{RemoteReply, RemoteRequest}
+import serialization.{Serializer, Serializable, SerializationProtocol}
import org.jboss.netty.bootstrap.ServerBootstrap
import org.jboss.netty.channel._
@@ -19,12 +20,16 @@ import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory
import org.jboss.netty.handler.codec.frame.{LengthFieldBasedFrameDecoder, LengthFieldPrepender}
import org.jboss.netty.handler.codec.protobuf.{ProtobufDecoder, ProtobufEncoder}
-import com.google.protobuf.ByteString
-
+/**
+ * @author Jonas Bonér
+ */
class RemoteServer extends Logging {
def start = RemoteServer.start
}
+/**
+ * @author Jonas Bonér
+ */
object RemoteServer extends Logging {
val HOSTNAME = kernel.Kernel.config.getString("akka.remote.hostname", "localhost")
val PORT = kernel.Kernel.config.getInt("akka.remote.port", 9999)
@@ -104,21 +109,18 @@ class RemoteServerHandler extends SimpleChannelUpstreamHandler with Logging {
log.debug("Dispatching to remote actor [%s]", request.getTarget)
val actor = createActor(request.getTarget, request.getTimeout)
actor.start
- val messageClass = Class.forName(request.getMessageType)
- val message = ScalaJSONSerializer.in(request.getMessage.toByteArray, Some(messageClass))
+ val message = RemoteProtocolBuilder.getMessage(request)
if (request.getIsOneWay) actor ! message
else {
try {
val resultOrNone = actor !! message
val result: AnyRef = if (resultOrNone.isDefined) resultOrNone.get else null
log.debug("Returning result from actor invocation [%s]", result)
- val replyMessage = ScalaJSONSerializer.out(result)
val replyBuilder = RemoteReply.newBuilder
.setId(request.getId)
- .setMessage(ByteString.copyFrom(replyMessage))
- .setMessageType(result.getClass.getName)
.setIsSuccessful(true)
.setIsActor(true)
+ RemoteProtocolBuilder.setMessage(result, replyBuilder)
if (request.hasSupervisorUuid) replyBuilder.setSupervisorUuid(request.getSupervisorUuid)
channel.write(replyBuilder.build)
} catch {
@@ -140,7 +142,7 @@ class RemoteServerHandler extends SimpleChannelUpstreamHandler with Logging {
log.debug("Dispatching to remote active object [%s :: %s]", request.getMethod, request.getTarget)
val activeObject = createActiveObject(request.getTarget, request.getTimeout)
- val args: scala.List[AnyRef] = JavaJSONSerializer.in(request.getMessage.toByteArray, Some(classOf[scala.List[AnyRef]]))
+ val args = RemoteProtocolBuilder.getMessage(request).asInstanceOf[scala.List[AnyRef]]
val argClasses = args.map(_.getClass)
val (unescapedArgs, unescapedArgClasses) = unescapeArgs(args, argClasses, request.getTimeout)
@@ -151,13 +153,11 @@ class RemoteServerHandler extends SimpleChannelUpstreamHandler with Logging {
else {
val result = messageReceiver.invoke(activeObject, unescapedArgs: _*)
log.debug("Returning result from remote active object invocation [%s]", result)
- val replyMessage = JavaJSONSerializer.out(result)
val replyBuilder = RemoteReply.newBuilder
.setId(request.getId)
- .setMessage(ByteString.copyFrom(replyMessage))
- .setMessageType(result.getClass.getName)
.setIsSuccessful(true)
.setIsActor(false)
+ RemoteProtocolBuilder.setMessage(result, replyBuilder)
if (request.hasSupervisorUuid) replyBuilder.setSupervisorUuid(request.getSupervisorUuid)
channel.write(replyBuilder.build)
}
diff --git a/kernel/src/main/scala/serialization/Serializable.scala b/kernel/src/main/scala/serialization/Serializable.scala
index f28c68a335..23655a96df 100644
--- a/kernel/src/main/scala/serialization/Serializable.scala
+++ b/kernel/src/main/scala/serialization/Serializable.scala
@@ -4,28 +4,51 @@
package se.scalablesolutions.akka.serialization
-
+import org.codehaus.jackson.map.ObjectMapper
+import com.google.protobuf.Message
import com.twitter.commons.Json
-import java.io.{StringWriter, ByteArrayOutputStream, ObjectOutputStream}
import reflect.Manifest
import sbinary.DefaultProtocol
+import java.io.{StringWriter, ByteArrayOutputStream, ObjectOutputStream}
+object SerializationProtocol {
+ val SBINARY = 1
+ val SCALA_JSON = 2
+ val JAVA_JSON = 3
+ val PROTOBUF = 4
+ val JAVA = 5
+ val AVRO = 6
+}
+
+/**
+ * @author Jonas Bonér
+ */
+trait Serializable {
+ def toBytes: Array[Byte]
+}
+
+/**
+ * @author Jonas Bonér
+ */
object Serializable {
- trait Protobuf {
+ /**
+ * @author Jonas Bonér
+ */
+ trait JSON[T] extends Serializable {
+ def body: T
+ def toJSON: String
}
- trait SBinary[T] extends DefaultProtocol {
- def toBytes: Array[Byte] = toByteArray(this)
- def getManifest: Manifest[T] = Manifest.singleType(this.asInstanceOf[T])
- }
-
- trait JavaJSON {
- private val mapper = new org.codehaus.jackson.map.ObjectMapper
+ /**
+ * @author Jonas Bonér
+ */
+ trait JavaJSON[T] extends JSON[T]{
+ private val mapper = new ObjectMapper
def toJSON: String = {
val out = new StringWriter
- mapper.writeValue(out, obj)
+ mapper.writeValue(out, body)
out.close
out.toString
}
@@ -33,19 +56,38 @@ object Serializable {
def toBytes: Array[Byte] = {
val bos = new ByteArrayOutputStream
val out = new ObjectOutputStream(bos)
- mapper.writeValue(out, obj)
+ mapper.writeValue(out, body)
out.close
bos.toByteArray
}
}
- trait ScalaJSON {
- def toJSON: String = {
- Json.build(obj).toString.getBytes("UTF-8")
- }
+ /**
+ * @author Jonas Bonér
+ */
+ trait ScalaJSON[T] extends JSON[T] {
+ def toJSON: String = Json.build(body).toString
+ def toBytes: Array[Byte] = Json.build(body).toString.getBytes
+ }
+
+ /**
+ * @author Jonas Bonér
+ */
+ trait Protobuf extends Serializable {
+ def toBytes: Array[Byte]
+ def getSchema: Message
+ }
- def toBytes: Array[Byte] = {
- Json.build(obj).toString.getBytes("UTF-8")
- }
+ /**
+ *
+ * import sbinary.DefaultProtocol._
+ * def fromBytes(bytes: Array[Byte]) = fromByteArray[String](bytes)
+ * def toBytes: Array[Byte] = toByteArray(body)
+ *
+ * @author Jonas Bonér
+ */
+ trait SBinary extends Serializable {
+ def fromBytes(bytes: Array[Byte])
+ def toBytes: Array[Byte]
}
}
\ No newline at end of file
diff --git a/kernel/src/main/scala/serialization/Serializer.scala b/kernel/src/main/scala/serialization/Serializer.scala
new file mode 100644
index 0000000000..dea5bb5dce
--- /dev/null
+++ b/kernel/src/main/scala/serialization/Serializer.scala
@@ -0,0 +1,113 @@
+/**
+ * Copyright (C) 2009 Scalable Solutions.
+ */
+
+package se.scalablesolutions.akka.serialization
+
+import com.google.protobuf.Message
+import java.io.{ObjectOutputStream, ByteArrayOutputStream, ObjectInputStream, ByteArrayInputStream}
+import reflect.Manifest
+import sbinary.DefaultProtocol
+import org.codehaus.jackson.map.ObjectMapper
+import com.twitter.commons.Json
+
+/**
+ * @author Jonas Bonér
+ */
+trait Serializer {
+ def deepClone[T <: AnyRef](obj: T): T
+ def out(obj: AnyRef): Array[Byte]
+ def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef
+}
+
+/**
+ * @author Jonas Bonér
+ */
+object Serializer {
+ /**
+ * @author Jonas Bonér
+ */
+ object Java extends Serializer {
+ def deepClone[T <: AnyRef](obj: T): T = in(out(obj), None).asInstanceOf[T]
+
+ def out(obj: AnyRef): Array[Byte] = {
+ val bos = new ByteArrayOutputStream
+ val out = new ObjectOutputStream(bos)
+ out.writeObject(obj)
+ out.close
+ bos.toByteArray
+ }
+
+ def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = {
+ val in = new ObjectInputStream(new ByteArrayInputStream(bytes))
+ val obj = in.readObject
+ in.close
+ obj
+ }
+ }
+
+ /**
+ * @author Jonas Bonér
+ */
+ object Protobuf {
+ //def deepClone[T <: AnyRef](obj: T): T = in(out(obj), None).asInstanceOf[T]
+
+ def out(obj: AnyRef): Array[Byte] = {
+ throw new UnsupportedOperationException
+ }
+
+ def in(bytes: Array[Byte], schema: Message): AnyRef = {
+ throw new UnsupportedOperationException
+ }
+ }
+
+ /**
+ * @author Jonas Bonér
+ */
+ object JavaJSON extends Serializer {
+ private val mapper = new ObjectMapper
+
+ def deepClone[T <: AnyRef](obj: T): T = in(out(obj), Some(obj.getClass)).asInstanceOf[T]
+
+ def out(obj: AnyRef): Array[Byte] = {
+ val bos = new ByteArrayOutputStream
+ val out = new ObjectOutputStream(bos)
+ mapper.writeValue(out, obj)
+ out.close
+ bos.toByteArray
+ }
+
+ def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = {
+ if (!clazz.isDefined) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided")
+ val in = new ObjectInputStream(new ByteArrayInputStream(bytes))
+ val obj = mapper.readValue(in, clazz.get).asInstanceOf[AnyRef]
+ in.close
+ obj
+ }
+ }
+
+ /**
+ * @author Jonas Bonér
+ */
+ object ScalaJSON extends Serializer {
+ def deepClone[T <: AnyRef](obj: T): T = in(out(obj), None).asInstanceOf[T]
+
+ def out(obj: AnyRef): Array[Byte] = Json.build(obj).toString.getBytes("UTF-8")
+
+ def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = Json.parse(new String(bytes, "UTF-8")).asInstanceOf[AnyRef]
+ }
+
+ /**
+ * @author Jonas Bonér
+ */
+ object SBinary {
+ import sbinary.DefaultProtocol._
+
+ def deepClone[T <: AnyRef](obj: T)(implicit w : Writes[T], r : Reads[T]): T = in[T](out[T](obj), None)
+
+ def out[T](t : T)(implicit bin : Writes[T]): Array[Byte] = toByteArray[T](t)
+
+ def in[T](array : Array[Byte], clazz: Option[Class[T]])(implicit bin : Reads[T]): T = fromByteArray[T](array)
+ }
+}
+
diff --git a/kernel/src/main/scala/state/CassandraStorage.scala b/kernel/src/main/scala/state/CassandraStorage.scala
index bb0e6d215f..1f6472675d 100644
--- a/kernel/src/main/scala/state/CassandraStorage.scala
+++ b/kernel/src/main/scala/state/CassandraStorage.scala
@@ -5,7 +5,9 @@
package se.scalablesolutions.akka.kernel.state
import java.io.File
-import kernel.util.{Serializer, JavaSerializationSerializer, Logging}
+
+import kernel.util.Logging
+import serialization.{Serializer, Serializable, SerializationProtocol}
import org.apache.cassandra.config.DatabaseDescriptor
import org.apache.cassandra.service._
@@ -23,7 +25,7 @@ import org.apache.thrift.TProcessorFactory
*
* @author Jonas Bonér
*/
-final object CassandraStorage extends Logging {
+object CassandraStorage extends Logging {
val TABLE_NAME = "akka"
val MAP_COLUMN_FAMILY = "map"
val VECTOR_COLUMN_FAMILY = "vector"
@@ -38,12 +40,13 @@ final object CassandraStorage extends Logging {
@volatile private[this] var isRunning = false
private[this] val serializer: Serializer = {
- kernel.Kernel.config.getString("akka.storage.cassandra.storage-format", "serialization") match {
- case "serialization" => JavaSerializationSerializer
- case "json" => throw new UnsupportedOperationException("json storage protocol is not yet supported")
- case "avro" => throw new UnsupportedOperationException("avro storage protocol is not yet supported")
- case "thrift" => throw new UnsupportedOperationException("thrift storage protocol is not yet supported")
- case "protobuf" => throw new UnsupportedOperationException("protobuf storage protocol is not yet supported")
+ kernel.Kernel.config.getString("akka.storage.cassandra.storage-format", "java") match {
+ case "scala-json" => Serializer.ScalaJSON
+ case "java-json" => Serializer.JavaJSON
+ //case "sbinary" => Serializer.SBinary
+ case "java" => Serializer.Java
+ case "avro" => throw new UnsupportedOperationException("Avro serialization protocol is not yet supported")
+ case unknown => throw new UnsupportedOperationException("unknwon storage protocol [" + unknown + "]")
}
}
diff --git a/kernel/src/main/scala/util/Helpers.scala b/kernel/src/main/scala/util/Helpers.scala
index 45fbfc34c9..cc629e0801 100644
--- a/kernel/src/main/scala/util/Helpers.scala
+++ b/kernel/src/main/scala/util/Helpers.scala
@@ -4,6 +4,8 @@
package se.scalablesolutions.akka.kernel.util
+import java.io.UnsupportedEncodingException
+import java.security.{NoSuchAlgorithmException, MessageDigest}
import java.util.concurrent.locks.ReentrantReadWriteLock
import scala.actors._
@@ -18,6 +20,20 @@ class SystemFailure(cause: Throwable) extends RuntimeException(cause)
*/
object Helpers extends Logging {
+ def getDigestFor(s: String) = {
+ val digest = MessageDigest.getInstance("MD5")
+ digest.update(s.getBytes("ASCII"))
+ val bytes = digest.digest
+
+ val sb = new StringBuilder
+ val hex = "0123456789ABCDEF"
+ bytes.foreach(b => {
+ val n = b.asInstanceOf[Int]
+ sb.append(hex.charAt((n & 0xF) >> 4)).append(hex.charAt(n & 0xF))
+ })
+ sb.toString
+ }
+
// ================================================
@serializable
class ReadWriteLock {
diff --git a/kernel/src/main/scala/util/Serializer.scala b/kernel/src/main/scala/util/Serializer.scala
deleted file mode 100644
index ce00bd9690..0000000000
--- a/kernel/src/main/scala/util/Serializer.scala
+++ /dev/null
@@ -1,95 +0,0 @@
-/**
- * Copyright (C) 2009 Scalable Solutions.
- */
-
-package se.scalablesolutions.akka.kernel.util
-
-import java.io.{ObjectOutputStream, ByteArrayOutputStream, ObjectInputStream, ByteArrayInputStream}
-import reflect.Manifest
-import sbinary.DefaultProtocol
-import org.codehaus.jackson.map.ObjectMapper
-import com.twitter.commons.Json
-
-/**
- * @author Jonas Bonér
- */
-trait Serializer {
- def deepClone[T <: AnyRef](obj: T): T
- def out(obj: AnyRef): Array[Byte]
- def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef
-}
-
-/**
- * @author Jonas Bonér
- */
-object JavaSerializationSerializer extends Serializer {
- def deepClone[T <: AnyRef](obj: T): T = in(out(obj), None).asInstanceOf[T]
-
- def out(obj: AnyRef): Array[Byte] = {
- val bos = new ByteArrayOutputStream
- val out = new ObjectOutputStream(bos)
- out.writeObject(obj)
- out.close
- bos.toByteArray
- }
-
- def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = {
- val in = new ObjectInputStream(new ByteArrayInputStream(bytes))
- val obj = in.readObject
- in.close
- obj
- }
-}
-
-/**
- * @author Jonas Bonér
- */
-object JavaJSONSerializer extends Serializer {
- private val json = new org.codehaus.jackson.map.ObjectMapper
-
- def deepClone[T <: AnyRef](obj: T): T = in(out(obj), Some(obj.getClass)).asInstanceOf[T]
-
- def out(obj: AnyRef): Array[Byte] = {
- val bos = new ByteArrayOutputStream
- val out = new ObjectOutputStream(bos)
- json.writeValue(out, obj)
- out.close
- bos.toByteArray
- }
-
- def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = {
- if (!clazz.isDefined) throw new IllegalArgumentException("Can't deserialize JSON to instance if no class is provided")
- val in = new ObjectInputStream(new ByteArrayInputStream(bytes))
- val obj = json.readValue(in, clazz.get).asInstanceOf[AnyRef]
- in.close
- obj
- }
-}
-
-/**
- * @author Jonas Bonér
- */
-object ScalaJSONSerializer extends Serializer {
- def deepClone[T <: AnyRef](obj: T): T = in(out(obj), None).asInstanceOf[T]
-
- def out(obj: AnyRef): Array[Byte] = {
- Json.build(obj).toString.getBytes("UTF-8")
- }
-
- def in(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = {
- Json.parse(new String(bytes, "UTF-8")).asInstanceOf[AnyRef]
- }
-}
-
-/**
- * @author Jonas Bonér
- */
-object SBinarySerializer extends SBinarySerializer
-trait SBinarySerializer extends DefaultProtocol {
- def in[T](t : T)(implicit bin : Writes[T], m: Manifest[T]): Pair[Array[Byte], Manifest[T]] =
- Pair(toByteArray(t), m)
-
- def out[T](array : Array[Byte], m: Manifest[T])(implicit bin : Reads[T]) =
- read[T](new ByteArrayInputStream(array))
-}
-
diff --git a/kernel/src/test/scala/InMemoryActorSpec.scala b/kernel/src/test/scala/InMemoryActorSpec.scala
index d5d629ddff..5ce06a10b3 100644
--- a/kernel/src/test/scala/InMemoryActorSpec.scala
+++ b/kernel/src/test/scala/InMemoryActorSpec.scala
@@ -76,6 +76,7 @@ class InMemStatefulActor extends Actor {
}
}
+@serializable
class InMemFailerActor extends Actor {
makeTransactionRequired
def receive: PartialFunction[Any, Unit] = {
diff --git a/kernel/src/test/scala/PersistentActorSpec.scala b/kernel/src/test/scala/PersistentActorSpec.scala
index e2ea673dad..3423dad84a 100644
--- a/kernel/src/test/scala/PersistentActorSpec.scala
+++ b/kernel/src/test/scala/PersistentActorSpec.scala
@@ -5,7 +5,6 @@ import java.util.concurrent.TimeUnit
import junit.framework.TestCase
import kernel.Kernel
-
import kernel.reactor._
import kernel.state.{CassandraStorageConfig, TransactionalState}
@@ -49,7 +48,7 @@ class PersistentActor extends Actor {
}
}
-class PersistentFailerActor extends Actor {
+@serializable class PersistentFailerActor extends Actor {
makeTransactionRequired
def receive: PartialFunction[Any, Unit] = {
case "Failure" =>
@@ -61,7 +60,7 @@ object PersistenceManager {
@volatile var isRunning = false
def init = if (!isRunning) {
System.setProperty("storage-config", "config")
- Kernel.startCassandra
+ Kernel.boot
isRunning = true
}
}
diff --git a/kernel/src/test/scala/RemoteSupervisorSpec.scala b/kernel/src/test/scala/RemoteSupervisorSpec.scala
index 079f43a031..6e9d65c3d1 100644
--- a/kernel/src/test/scala/RemoteSupervisorSpec.scala
+++ b/kernel/src/test/scala/RemoteSupervisorSpec.scala
@@ -591,7 +591,8 @@ class RemoteSupervisorSpec extends junit.framework.TestCase with Suite {
}
}
-class RemotePingPong1Actor extends Actor {
+
+@serializable class RemotePingPong1Actor extends Actor {
override def receive: PartialFunction[Any, Unit] = {
case Ping =>
Log.messageLog += "ping"
@@ -608,7 +609,7 @@ class RemotePingPong1Actor extends Actor {
}
}
-class RemotePingPong2Actor extends Actor {
+@serializable class RemotePingPong2Actor extends Actor {
override def receive: PartialFunction[Any, Unit] = {
case Ping =>
Log.messageLog += "ping"
@@ -621,7 +622,7 @@ class RemotePingPong2Actor extends Actor {
}
}
-class RemotePingPong3Actor extends Actor {
+@serializable class RemotePingPong3Actor extends Actor {
override def receive: PartialFunction[Any, Unit] = {
case Ping =>
Log.messageLog += "ping"
diff --git a/lib/akka-util-java-0.5.jar b/lib/akka-util-java-0.5.jar
index b15a1f3d4c..cf9eed0832 100644
Binary files a/lib/akka-util-java-0.5.jar and b/lib/akka-util-java-0.5.jar differ
diff --git a/samples-java/akka-samples-java.iml b/samples-java/akka-samples-java.iml
index 23ca61c88a..9b4766e88b 100644
--- a/samples-java/akka-samples-java.iml
+++ b/samples-java/akka-samples-java.iml
@@ -41,7 +41,8 @@
-
+
+
diff --git a/samples-scala/akka-samples-scala.iml b/samples-scala/akka-samples-scala.iml
index a961b2448d..0804891166 100644
--- a/samples-scala/akka-samples-scala.iml
+++ b/samples-scala/akka-samples-scala.iml
@@ -1,5 +1,10 @@
+
+
+
+
+
@@ -41,7 +46,8 @@
-
+
+
diff --git a/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.java b/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.java
index 62c41195b1..c36d54c2c7 100644
--- a/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.java
+++ b/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.java
@@ -32,121 +32,131 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteRequest_fieldAccessorTable;
}
- // required bytes message = 1;
- public static final int MESSAGE_FIELD_NUMBER = 1;
- private boolean hasMessage;
- private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY;
- public boolean hasMessage() { return hasMessage; }
- public com.google.protobuf.ByteString getMessage() { return message_; }
-
- // optional string method = 2;
- public static final int METHOD_FIELD_NUMBER = 2;
- private boolean hasMethod;
- private java.lang.String method_ = "";
- public boolean hasMethod() { return hasMethod; }
- public java.lang.String getMethod() { return method_; }
-
- // required string target = 3;
- public static final int TARGET_FIELD_NUMBER = 3;
- private boolean hasTarget;
- private java.lang.String target_ = "";
- public boolean hasTarget() { return hasTarget; }
- public java.lang.String getTarget() { return target_; }
-
- // required uint64 timeout = 4;
- public static final int TIMEOUT_FIELD_NUMBER = 4;
- private boolean hasTimeout;
- private long timeout_ = 0L;
- public boolean hasTimeout() { return hasTimeout; }
- public long getTimeout() { return timeout_; }
-
- // optional string supervisorUuid = 5;
- public static final int SUPERVISORUUID_FIELD_NUMBER = 5;
- private boolean hasSupervisorUuid;
- private java.lang.String supervisorUuid_ = "";
- public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
- public java.lang.String getSupervisorUuid() { return supervisorUuid_; }
-
- // required bool isActor = 6;
- public static final int ISACTOR_FIELD_NUMBER = 6;
- private boolean hasIsActor;
- private boolean isActor_ = false;
- public boolean hasIsActor() { return hasIsActor; }
- public boolean getIsActor() { return isActor_; }
-
- // required bool isOneWay = 7;
- public static final int ISONEWAY_FIELD_NUMBER = 7;
- private boolean hasIsOneWay;
- private boolean isOneWay_ = false;
- public boolean hasIsOneWay() { return hasIsOneWay; }
- public boolean getIsOneWay() { return isOneWay_; }
-
- // required bool isEscaped = 8;
- public static final int ISESCAPED_FIELD_NUMBER = 8;
- private boolean hasIsEscaped;
- private boolean isEscaped_ = false;
- public boolean hasIsEscaped() { return hasIsEscaped; }
- public boolean getIsEscaped() { return isEscaped_; }
-
- // required uint64 id = 9;
- public static final int ID_FIELD_NUMBER = 9;
+ // 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 string messageType = 10;
- public static final int MESSAGETYPE_FIELD_NUMBER = 10;
- private boolean hasMessageType;
- private java.lang.String messageType_ = "";
- public boolean hasMessageType() { return hasMessageType; }
- public java.lang.String getMessageType() { return messageType_; }
+ // required uint32 protocol = 2;
+ public static final int PROTOCOL_FIELD_NUMBER = 2;
+ private boolean hasProtocol;
+ private int protocol_ = 0;
+ public boolean hasProtocol() { return hasProtocol; }
+ public int getProtocol() { return protocol_; }
+
+ // required bytes message = 3;
+ public static final int MESSAGE_FIELD_NUMBER = 3;
+ private boolean hasMessage;
+ private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY;
+ public boolean hasMessage() { return hasMessage; }
+ public com.google.protobuf.ByteString getMessage() { return message_; }
+
+ // optional bytes messageManifest = 4;
+ public static final int MESSAGEMANIFEST_FIELD_NUMBER = 4;
+ private boolean hasMessageManifest;
+ private com.google.protobuf.ByteString messageManifest_ = com.google.protobuf.ByteString.EMPTY;
+ public boolean hasMessageManifest() { return hasMessageManifest; }
+ public com.google.protobuf.ByteString getMessageManifest() { return messageManifest_; }
+
+ // optional string method = 5;
+ public static final int METHOD_FIELD_NUMBER = 5;
+ private boolean hasMethod;
+ private java.lang.String method_ = "";
+ public boolean hasMethod() { return hasMethod; }
+ public java.lang.String getMethod() { return method_; }
+
+ // required string target = 6;
+ public static final int TARGET_FIELD_NUMBER = 6;
+ private boolean hasTarget;
+ private java.lang.String target_ = "";
+ public boolean hasTarget() { return hasTarget; }
+ public java.lang.String getTarget() { return target_; }
+
+ // required uint64 timeout = 7;
+ public static final int TIMEOUT_FIELD_NUMBER = 7;
+ private boolean hasTimeout;
+ private long timeout_ = 0L;
+ public boolean hasTimeout() { return hasTimeout; }
+ public long getTimeout() { return timeout_; }
+
+ // optional string supervisorUuid = 8;
+ public static final int SUPERVISORUUID_FIELD_NUMBER = 8;
+ private boolean hasSupervisorUuid;
+ private java.lang.String supervisorUuid_ = "";
+ public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
+ public java.lang.String getSupervisorUuid() { return supervisorUuid_; }
+
+ // required bool isActor = 9;
+ public static final int ISACTOR_FIELD_NUMBER = 9;
+ private boolean hasIsActor;
+ private boolean isActor_ = false;
+ public boolean hasIsActor() { return hasIsActor; }
+ public boolean getIsActor() { return isActor_; }
+
+ // required bool isOneWay = 10;
+ public static final int ISONEWAY_FIELD_NUMBER = 10;
+ private boolean hasIsOneWay;
+ private boolean isOneWay_ = false;
+ public boolean hasIsOneWay() { return hasIsOneWay; }
+ public boolean getIsOneWay() { return isOneWay_; }
+
+ // required bool isEscaped = 11;
+ public static final int ISESCAPED_FIELD_NUMBER = 11;
+ private boolean hasIsEscaped;
+ private boolean isEscaped_ = false;
+ public boolean hasIsEscaped() { return hasIsEscaped; }
+ public boolean getIsEscaped() { return isEscaped_; }
@Override
public final boolean isInitialized() {
+ if (!hasId) return false;
+ if (!hasProtocol) return false;
if (!hasMessage) return false;
if (!hasTarget) return false;
if (!hasTimeout) return false;
if (!hasIsActor) return false;
if (!hasIsOneWay) return false;
if (!hasIsEscaped) return false;
- if (!hasId) return false;
- if (!hasMessageType) return false;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
+ if (hasId()) {
+ output.writeUInt64(1, getId());
+ }
+ if (hasProtocol()) {
+ output.writeUInt32(2, getProtocol());
+ }
if (hasMessage()) {
- output.writeBytes(1, getMessage());
+ output.writeBytes(3, getMessage());
+ }
+ if (hasMessageManifest()) {
+ output.writeBytes(4, getMessageManifest());
}
if (hasMethod()) {
- output.writeString(2, getMethod());
+ output.writeString(5, getMethod());
}
if (hasTarget()) {
- output.writeString(3, getTarget());
+ output.writeString(6, getTarget());
}
if (hasTimeout()) {
- output.writeUInt64(4, getTimeout());
+ output.writeUInt64(7, getTimeout());
}
if (hasSupervisorUuid()) {
- output.writeString(5, getSupervisorUuid());
+ output.writeString(8, getSupervisorUuid());
}
if (hasIsActor()) {
- output.writeBool(6, getIsActor());
+ output.writeBool(9, getIsActor());
}
if (hasIsOneWay()) {
- output.writeBool(7, getIsOneWay());
+ output.writeBool(10, getIsOneWay());
}
if (hasIsEscaped()) {
- output.writeBool(8, getIsEscaped());
- }
- if (hasId()) {
- output.writeUInt64(9, getId());
- }
- if (hasMessageType()) {
- output.writeString(10, getMessageType());
+ output.writeBool(11, getIsEscaped());
}
getUnknownFields().writeTo(output);
}
@@ -158,45 +168,49 @@ public final class RemoteProtocol {
if (size != -1) return size;
size = 0;
+ if (hasId()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt64Size(1, getId());
+ }
+ if (hasProtocol()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt32Size(2, getProtocol());
+ }
if (hasMessage()) {
size += com.google.protobuf.CodedOutputStream
- .computeBytesSize(1, getMessage());
+ .computeBytesSize(3, getMessage());
+ }
+ if (hasMessageManifest()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(4, getMessageManifest());
}
if (hasMethod()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(2, getMethod());
+ .computeStringSize(5, getMethod());
}
if (hasTarget()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(3, getTarget());
+ .computeStringSize(6, getTarget());
}
if (hasTimeout()) {
size += com.google.protobuf.CodedOutputStream
- .computeUInt64Size(4, getTimeout());
+ .computeUInt64Size(7, getTimeout());
}
if (hasSupervisorUuid()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(5, getSupervisorUuid());
+ .computeStringSize(8, getSupervisorUuid());
}
if (hasIsActor()) {
size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(6, getIsActor());
+ .computeBoolSize(9, getIsActor());
}
if (hasIsOneWay()) {
size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(7, getIsOneWay());
+ .computeBoolSize(10, getIsOneWay());
}
if (hasIsEscaped()) {
size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(8, getIsEscaped());
- }
- if (hasId()) {
- size += com.google.protobuf.CodedOutputStream
- .computeUInt64Size(9, getId());
- }
- if (hasMessageType()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(10, getMessageType());
+ .computeBoolSize(11, getIsEscaped());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
@@ -339,9 +353,18 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteRequest other) {
if (other == se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteRequest.getDefaultInstance()) return this;
+ if (other.hasId()) {
+ setId(other.getId());
+ }
+ if (other.hasProtocol()) {
+ setProtocol(other.getProtocol());
+ }
if (other.hasMessage()) {
setMessage(other.getMessage());
}
+ if (other.hasMessageManifest()) {
+ setMessageManifest(other.getMessageManifest());
+ }
if (other.hasMethod()) {
setMethod(other.getMethod());
}
@@ -363,12 +386,6 @@ public final class RemoteProtocol {
if (other.hasIsEscaped()) {
setIsEscaped(other.getIsEscaped());
}
- if (other.hasId()) {
- setId(other.getId());
- }
- if (other.hasMessageType()) {
- setMessageType(other.getMessageType());
- }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -403,44 +420,48 @@ public final class RemoteProtocol {
}
break;
}
- case 10: {
- setMessage(input.readBytes());
- break;
- }
- case 18: {
- setMethod(input.readString());
- break;
- }
- case 26: {
- setTarget(input.readString());
- break;
- }
- case 32: {
- setTimeout(input.readUInt64());
- break;
- }
- case 42: {
- setSupervisorUuid(input.readString());
- break;
- }
- case 48: {
- setIsActor(input.readBool());
- break;
- }
- case 56: {
- setIsOneWay(input.readBool());
- break;
- }
- case 64: {
- setIsEscaped(input.readBool());
- break;
- }
- case 72: {
+ case 8: {
setId(input.readUInt64());
break;
}
- case 82: {
- setMessageType(input.readString());
+ case 16: {
+ setProtocol(input.readUInt32());
+ break;
+ }
+ case 26: {
+ setMessage(input.readBytes());
+ break;
+ }
+ case 34: {
+ setMessageManifest(input.readBytes());
+ break;
+ }
+ case 42: {
+ setMethod(input.readString());
+ break;
+ }
+ case 50: {
+ setTarget(input.readString());
+ break;
+ }
+ case 56: {
+ setTimeout(input.readUInt64());
+ break;
+ }
+ case 66: {
+ setSupervisorUuid(input.readString());
+ break;
+ }
+ case 72: {
+ setIsActor(input.readBool());
+ break;
+ }
+ case 80: {
+ setIsOneWay(input.readBool());
+ break;
+ }
+ case 88: {
+ setIsEscaped(input.readBool());
break;
}
}
@@ -448,7 +469,43 @@ public final class RemoteProtocol {
}
- // required bytes message = 1;
+ // required uint64 id = 1;
+ public boolean hasId() {
+ return result.hasId();
+ }
+ public long getId() {
+ return result.getId();
+ }
+ public Builder setId(long value) {
+ result.hasId = true;
+ result.id_ = value;
+ return this;
+ }
+ public Builder clearId() {
+ result.hasId = false;
+ result.id_ = 0L;
+ return this;
+ }
+
+ // required uint32 protocol = 2;
+ public boolean hasProtocol() {
+ return result.hasProtocol();
+ }
+ public int getProtocol() {
+ return result.getProtocol();
+ }
+ public Builder setProtocol(int value) {
+ result.hasProtocol = true;
+ result.protocol_ = value;
+ return this;
+ }
+ public Builder clearProtocol() {
+ result.hasProtocol = false;
+ result.protocol_ = 0;
+ return this;
+ }
+
+ // required bytes message = 3;
public boolean hasMessage() {
return result.hasMessage();
}
@@ -469,7 +526,28 @@ public final class RemoteProtocol {
return this;
}
- // optional string method = 2;
+ // optional bytes messageManifest = 4;
+ public boolean hasMessageManifest() {
+ return result.hasMessageManifest();
+ }
+ public com.google.protobuf.ByteString getMessageManifest() {
+ return result.getMessageManifest();
+ }
+ public Builder setMessageManifest(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasMessageManifest = true;
+ result.messageManifest_ = value;
+ return this;
+ }
+ public Builder clearMessageManifest() {
+ result.hasMessageManifest = false;
+ result.messageManifest_ = com.google.protobuf.ByteString.EMPTY;
+ return this;
+ }
+
+ // optional string method = 5;
public boolean hasMethod() {
return result.hasMethod();
}
@@ -490,7 +568,7 @@ public final class RemoteProtocol {
return this;
}
- // required string target = 3;
+ // required string target = 6;
public boolean hasTarget() {
return result.hasTarget();
}
@@ -511,7 +589,7 @@ public final class RemoteProtocol {
return this;
}
- // required uint64 timeout = 4;
+ // required uint64 timeout = 7;
public boolean hasTimeout() {
return result.hasTimeout();
}
@@ -529,7 +607,7 @@ public final class RemoteProtocol {
return this;
}
- // optional string supervisorUuid = 5;
+ // optional string supervisorUuid = 8;
public boolean hasSupervisorUuid() {
return result.hasSupervisorUuid();
}
@@ -550,7 +628,7 @@ public final class RemoteProtocol {
return this;
}
- // required bool isActor = 6;
+ // required bool isActor = 9;
public boolean hasIsActor() {
return result.hasIsActor();
}
@@ -568,7 +646,7 @@ public final class RemoteProtocol {
return this;
}
- // required bool isOneWay = 7;
+ // required bool isOneWay = 10;
public boolean hasIsOneWay() {
return result.hasIsOneWay();
}
@@ -586,7 +664,7 @@ public final class RemoteProtocol {
return this;
}
- // required bool isEscaped = 8;
+ // required bool isEscaped = 11;
public boolean hasIsEscaped() {
return result.hasIsEscaped();
}
@@ -603,45 +681,6 @@ public final class RemoteProtocol {
result.isEscaped_ = false;
return this;
}
-
- // required uint64 id = 9;
- public boolean hasId() {
- return result.hasId();
- }
- public long getId() {
- return result.getId();
- }
- public Builder setId(long value) {
- result.hasId = true;
- result.id_ = value;
- return this;
- }
- public Builder clearId() {
- result.hasId = false;
- result.id_ = 0L;
- return this;
- }
-
- // required string messageType = 10;
- public boolean hasMessageType() {
- return result.hasMessageType();
- }
- public java.lang.String getMessageType() {
- return result.getMessageType();
- }
- public Builder setMessageType(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasMessageType = true;
- result.messageType_ = value;
- return this;
- }
- public Builder clearMessageType() {
- result.hasMessageType = false;
- result.messageType_ = "";
- return this;
- }
}
static {
@@ -674,20 +713,20 @@ public final class RemoteProtocol {
return se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteReply_fieldAccessorTable;
}
- // required bool isSuccessful = 1;
- public static final int ISSUCCESSFUL_FIELD_NUMBER = 1;
- private boolean hasIsSuccessful;
- private boolean isSuccessful_ = false;
- public boolean hasIsSuccessful() { return hasIsSuccessful; }
- public boolean getIsSuccessful() { return isSuccessful_; }
-
- // required uint64 id = 2;
- public static final int ID_FIELD_NUMBER = 2;
+ // 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_; }
+ // optional uint32 protocol = 2;
+ public static final int PROTOCOL_FIELD_NUMBER = 2;
+ private boolean hasProtocol;
+ private int protocol_ = 0;
+ public boolean hasProtocol() { return hasProtocol; }
+ public int getProtocol() { return protocol_; }
+
// optional bytes message = 3;
public static final int MESSAGE_FIELD_NUMBER = 3;
private boolean hasMessage;
@@ -695,27 +734,27 @@ public final class RemoteProtocol {
public boolean hasMessage() { return hasMessage; }
public com.google.protobuf.ByteString getMessage() { return message_; }
- // optional string exception = 4;
- public static final int EXCEPTION_FIELD_NUMBER = 4;
+ // optional bytes messageManifest = 4;
+ public static final int MESSAGEMANIFEST_FIELD_NUMBER = 4;
+ private boolean hasMessageManifest;
+ private com.google.protobuf.ByteString messageManifest_ = com.google.protobuf.ByteString.EMPTY;
+ public boolean hasMessageManifest() { return hasMessageManifest; }
+ public com.google.protobuf.ByteString getMessageManifest() { return messageManifest_; }
+
+ // optional string exception = 5;
+ public static final int EXCEPTION_FIELD_NUMBER = 5;
private boolean hasException;
private java.lang.String exception_ = "";
public boolean hasException() { return hasException; }
public java.lang.String getException() { return exception_; }
- // optional string supervisorUuid = 5;
- public static final int SUPERVISORUUID_FIELD_NUMBER = 5;
+ // optional string supervisorUuid = 6;
+ public static final int SUPERVISORUUID_FIELD_NUMBER = 6;
private boolean hasSupervisorUuid;
private java.lang.String supervisorUuid_ = "";
public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
public java.lang.String getSupervisorUuid() { return supervisorUuid_; }
- // optional string messageType = 6;
- public static final int MESSAGETYPE_FIELD_NUMBER = 6;
- private boolean hasMessageType;
- private java.lang.String messageType_ = "";
- public boolean hasMessageType() { return hasMessageType; }
- public java.lang.String getMessageType() { return messageType_; }
-
// required bool isActor = 7;
public static final int ISACTOR_FIELD_NUMBER = 7;
private boolean hasIsActor;
@@ -723,38 +762,48 @@ public final class RemoteProtocol {
public boolean hasIsActor() { return hasIsActor; }
public boolean getIsActor() { return isActor_; }
+ // required bool isSuccessful = 8;
+ public static final int ISSUCCESSFUL_FIELD_NUMBER = 8;
+ private boolean hasIsSuccessful;
+ private boolean isSuccessful_ = false;
+ public boolean hasIsSuccessful() { return hasIsSuccessful; }
+ public boolean getIsSuccessful() { return isSuccessful_; }
+
@Override
public final boolean isInitialized() {
- if (!hasIsSuccessful) return false;
if (!hasId) return false;
if (!hasIsActor) return false;
+ if (!hasIsSuccessful) return false;
return true;
}
@Override
public void writeTo(com.google.protobuf.CodedOutputStream output)
throws java.io.IOException {
- if (hasIsSuccessful()) {
- output.writeBool(1, getIsSuccessful());
- }
if (hasId()) {
- output.writeUInt64(2, getId());
+ output.writeUInt64(1, getId());
+ }
+ if (hasProtocol()) {
+ output.writeUInt32(2, getProtocol());
}
if (hasMessage()) {
output.writeBytes(3, getMessage());
}
+ if (hasMessageManifest()) {
+ output.writeBytes(4, getMessageManifest());
+ }
if (hasException()) {
- output.writeString(4, getException());
+ output.writeString(5, getException());
}
if (hasSupervisorUuid()) {
- output.writeString(5, getSupervisorUuid());
- }
- if (hasMessageType()) {
- output.writeString(6, getMessageType());
+ output.writeString(6, getSupervisorUuid());
}
if (hasIsActor()) {
output.writeBool(7, getIsActor());
}
+ if (hasIsSuccessful()) {
+ output.writeBool(8, getIsSuccessful());
+ }
getUnknownFields().writeTo(output);
}
@@ -765,34 +814,38 @@ public final class RemoteProtocol {
if (size != -1) return size;
size = 0;
- if (hasIsSuccessful()) {
- size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(1, getIsSuccessful());
- }
if (hasId()) {
size += com.google.protobuf.CodedOutputStream
- .computeUInt64Size(2, getId());
+ .computeUInt64Size(1, getId());
+ }
+ if (hasProtocol()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt32Size(2, getProtocol());
}
if (hasMessage()) {
size += com.google.protobuf.CodedOutputStream
.computeBytesSize(3, getMessage());
}
+ if (hasMessageManifest()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBytesSize(4, getMessageManifest());
+ }
if (hasException()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(4, getException());
+ .computeStringSize(5, getException());
}
if (hasSupervisorUuid()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(5, getSupervisorUuid());
- }
- if (hasMessageType()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(6, getMessageType());
+ .computeStringSize(6, getSupervisorUuid());
}
if (hasIsActor()) {
size += com.google.protobuf.CodedOutputStream
.computeBoolSize(7, getIsActor());
}
+ if (hasIsSuccessful()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeBoolSize(8, getIsSuccessful());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -856,12 +909,12 @@ public final class RemoteProtocol {
.buildParsed();
}
- public static Builder newBuilder() { return new Builder(); }
- public Builder newBuilderForType() { return new Builder(); }
+ public static se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder newBuilder() { return new se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder(); }
+ public se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder newBuilderForType() { return new se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder(); }
public static Builder newBuilder(se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply prototype) {
- return new Builder().mergeFrom(prototype);
+ return new se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder().mergeFrom(prototype);
}
- public Builder toBuilder() { return newBuilder(this); }
+ public se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder toBuilder() { return newBuilder(this); }
public static final class Builder extends
com.google.protobuf.GeneratedMessage.Builder {
@@ -934,27 +987,30 @@ public final class RemoteProtocol {
public Builder mergeFrom(se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply other) {
if (other == se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.getDefaultInstance()) return this;
- if (other.hasIsSuccessful()) {
- setIsSuccessful(other.getIsSuccessful());
- }
if (other.hasId()) {
setId(other.getId());
}
+ if (other.hasProtocol()) {
+ setProtocol(other.getProtocol());
+ }
if (other.hasMessage()) {
setMessage(other.getMessage());
}
+ if (other.hasMessageManifest()) {
+ setMessageManifest(other.getMessageManifest());
+ }
if (other.hasException()) {
setException(other.getException());
}
if (other.hasSupervisorUuid()) {
setSupervisorUuid(other.getSupervisorUuid());
}
- if (other.hasMessageType()) {
- setMessageType(other.getMessageType());
- }
if (other.hasIsActor()) {
setIsActor(other.getIsActor());
}
+ if (other.hasIsSuccessful()) {
+ setIsSuccessful(other.getIsSuccessful());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -990,11 +1046,11 @@ public final class RemoteProtocol {
break;
}
case 8: {
- setIsSuccessful(input.readBool());
+ setId(input.readUInt64());
break;
}
case 16: {
- setId(input.readUInt64());
+ setProtocol(input.readUInt32());
break;
}
case 26: {
@@ -1002,45 +1058,31 @@ public final class RemoteProtocol {
break;
}
case 34: {
- setException(input.readString());
+ setMessageManifest(input.readBytes());
break;
}
case 42: {
- setSupervisorUuid(input.readString());
+ setException(input.readString());
break;
}
case 50: {
- setMessageType(input.readString());
+ setSupervisorUuid(input.readString());
break;
}
case 56: {
setIsActor(input.readBool());
break;
}
+ case 64: {
+ setIsSuccessful(input.readBool());
+ break;
+ }
}
}
}
- // required bool isSuccessful = 1;
- public boolean hasIsSuccessful() {
- return result.hasIsSuccessful();
- }
- public boolean getIsSuccessful() {
- return result.getIsSuccessful();
- }
- public Builder setIsSuccessful(boolean value) {
- result.hasIsSuccessful = true;
- result.isSuccessful_ = value;
- return this;
- }
- public Builder clearIsSuccessful() {
- result.hasIsSuccessful = false;
- result.isSuccessful_ = false;
- return this;
- }
-
- // required uint64 id = 2;
+ // required uint64 id = 1;
public boolean hasId() {
return result.hasId();
}
@@ -1058,6 +1100,24 @@ public final class RemoteProtocol {
return this;
}
+ // optional uint32 protocol = 2;
+ public boolean hasProtocol() {
+ return result.hasProtocol();
+ }
+ public int getProtocol() {
+ return result.getProtocol();
+ }
+ public Builder setProtocol(int value) {
+ result.hasProtocol = true;
+ result.protocol_ = value;
+ return this;
+ }
+ public Builder clearProtocol() {
+ result.hasProtocol = false;
+ result.protocol_ = 0;
+ return this;
+ }
+
// optional bytes message = 3;
public boolean hasMessage() {
return result.hasMessage();
@@ -1079,7 +1139,28 @@ public final class RemoteProtocol {
return this;
}
- // optional string exception = 4;
+ // optional bytes messageManifest = 4;
+ public boolean hasMessageManifest() {
+ return result.hasMessageManifest();
+ }
+ public com.google.protobuf.ByteString getMessageManifest() {
+ return result.getMessageManifest();
+ }
+ public Builder setMessageManifest(com.google.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasMessageManifest = true;
+ result.messageManifest_ = value;
+ return this;
+ }
+ public Builder clearMessageManifest() {
+ result.hasMessageManifest = false;
+ result.messageManifest_ = com.google.protobuf.ByteString.EMPTY;
+ return this;
+ }
+
+ // optional string exception = 5;
public boolean hasException() {
return result.hasException();
}
@@ -1100,7 +1181,7 @@ public final class RemoteProtocol {
return this;
}
- // optional string supervisorUuid = 5;
+ // optional string supervisorUuid = 6;
public boolean hasSupervisorUuid() {
return result.hasSupervisorUuid();
}
@@ -1121,27 +1202,6 @@ public final class RemoteProtocol {
return this;
}
- // optional string messageType = 6;
- public boolean hasMessageType() {
- return result.hasMessageType();
- }
- public java.lang.String getMessageType() {
- return result.getMessageType();
- }
- public Builder setMessageType(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasMessageType = true;
- result.messageType_ = value;
- return this;
- }
- public Builder clearMessageType() {
- result.hasMessageType = false;
- result.messageType_ = "";
- return this;
- }
-
// required bool isActor = 7;
public boolean hasIsActor() {
return result.hasIsActor();
@@ -1159,6 +1219,24 @@ public final class RemoteProtocol {
result.isActor_ = false;
return this;
}
+
+ // required bool isSuccessful = 8;
+ public boolean hasIsSuccessful() {
+ return result.hasIsSuccessful();
+ }
+ public boolean getIsSuccessful() {
+ return result.getIsSuccessful();
+ }
+ public Builder setIsSuccessful(boolean value) {
+ result.hasIsSuccessful = true;
+ result.isSuccessful_ = value;
+ return this;
+ }
+ public Builder clearIsSuccessful() {
+ result.hasIsSuccessful = false;
+ result.isSuccessful_ = false;
+ return this;
+ }
}
static {
@@ -1187,16 +1265,17 @@ public final class RemoteProtocol {
java.lang.String descriptorData =
"\nBse/scalablesolutions/akka/kernel/nio/p" +
"rotobuf/RemoteProtocol.proto\022-se.scalabl" +
- "esolutions.akka.kernel.nio.protobuf\"\300\001\n\r" +
- "RemoteRequest\022\017\n\007message\030\001 \002(\014\022\016\n\006method" +
- "\030\002 \001(\t\022\016\n\006target\030\003 \002(\t\022\017\n\007timeout\030\004 \002(\004\022" +
- "\026\n\016supervisorUuid\030\005 \001(\t\022\017\n\007isActor\030\006 \002(\010" +
- "\022\020\n\010isOneWay\030\007 \002(\010\022\021\n\tisEscaped\030\010 \002(\010\022\n\n" +
- "\002id\030\t \002(\004\022\023\n\013messageType\030\n \002(\t\"\221\001\n\013Remot" +
- "eReply\022\024\n\014isSuccessful\030\001 \002(\010\022\n\n\002id\030\002 \002(\004" +
- "\022\017\n\007message\030\003 \001(\014\022\021\n\texception\030\004 \001(\t\022\026\n\016" +
- "supervisorUuid\030\005 \001(\t\022\023\n\013messageType\030\006 \001(" +
- "\t\022\017\n\007isActor\030\007 \002(\010B\002H\001";
+ "esolutions.akka.kernel.nio.protobuf\"\326\001\n\r" +
+ "RemoteRequest\022\n\n\002id\030\001 \002(\004\022\020\n\010protocol\030\002 " +
+ "\002(\r\022\017\n\007message\030\003 \002(\014\022\027\n\017messageManifest\030" +
+ "\004 \001(\014\022\016\n\006method\030\005 \001(\t\022\016\n\006target\030\006 \002(\t\022\017\n" +
+ "\007timeout\030\007 \002(\004\022\026\n\016supervisorUuid\030\010 \001(\t\022\017" +
+ "\n\007isActor\030\t \002(\010\022\020\n\010isOneWay\030\n \002(\010\022\021\n\tisE" +
+ "scaped\030\013 \002(\010\"\247\001\n\013RemoteReply\022\n\n\002id\030\001 \002(\004" +
+ "\022\020\n\010protocol\030\002 \001(\r\022\017\n\007message\030\003 \001(\014\022\027\n\017m" +
+ "essageManifest\030\004 \001(\014\022\021\n\texception\030\005 \001(\t\022" +
+ "\026\n\016supervisorUuid\030\006 \001(\t\022\017\n\007isActor\030\007 \002(\010" +
+ "\022\024\n\014isSuccessful\030\010 \002(\010B\002H\001";
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
public com.google.protobuf.ExtensionRegistry assignDescriptors(
@@ -1207,7 +1286,7 @@ public final class RemoteProtocol {
internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteRequest_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteRequest_descriptor,
- new java.lang.String[] { "Message", "Method", "Target", "Timeout", "SupervisorUuid", "IsActor", "IsOneWay", "IsEscaped", "Id", "MessageType", },
+ new java.lang.String[] { "Id", "Protocol", "Message", "MessageManifest", "Method", "Target", "Timeout", "SupervisorUuid", "IsActor", "IsOneWay", "IsEscaped", },
se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteRequest.class,
se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteRequest.Builder.class);
internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteReply_descriptor =
@@ -1215,7 +1294,7 @@ public final class RemoteProtocol {
internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteReply_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_se_scalablesolutions_akka_kernel_nio_protobuf_RemoteReply_descriptor,
- new java.lang.String[] { "IsSuccessful", "Id", "Message", "Exception", "SupervisorUuid", "MessageType", "IsActor", },
+ new java.lang.String[] { "Id", "Protocol", "Message", "MessageManifest", "Exception", "SupervisorUuid", "IsActor", "IsSuccessful", },
se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.class,
se.scalablesolutions.akka.kernel.nio.protobuf.RemoteProtocol.RemoteReply.Builder.class);
return null;
diff --git a/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.proto b/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.proto
index 9a03521d2f..b58fb392b3 100644
--- a/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.proto
+++ b/util-java/src/main/java/se/scalablesolutions/akka/kernel/nio/protobuf/RemoteProtocol.proto
@@ -12,45 +12,27 @@ package se.scalablesolutions.akka.kernel.nio.protobuf;
option optimize_for = SPEED;
-/*
-val message: Array[Byte],
-val method: String,
-val target: String,
-val timeout: Long,
-val supervisorUuid: String
-val isOneWay: Boolean,
-val isActor: Boolean,
-val isEscaped: Boolean,
-val id: Long,
-val messageType: String,
-*/
message RemoteRequest {
- required bytes message = 1;
- optional string method = 2;
- required string target = 3;
- required uint64 timeout = 4;
- optional string supervisorUuid = 5;
- required bool isActor = 6;
- required bool isOneWay = 7;
- required bool isEscaped = 8;
- required uint64 id = 9;
- required string messageType = 10;
+ required uint64 id = 1;
+ required uint32 protocol = 2;
+ required bytes message = 3;
+ optional bytes messageManifest = 4;
+ optional string method = 5;
+ required string target = 6;
+ required uint64 timeout = 7;
+ optional string supervisorUuid = 8;
+ required bool isActor = 9;
+ required bool isOneWay = 10;
+ required bool isEscaped = 11;
}
-/*
-val isSuccessful: Boolean,
-val id: Long,
-val message: Array[Byte],
-val exception: Throwable,
-val supervisorUuid: String
-val isActor: Boolean,
-*/
message RemoteReply {
- required bool isSuccessful = 1;
- required uint64 id = 2;
+ required uint64 id = 1;
+ optional uint32 protocol = 2;
optional bytes message = 3;
- optional string exception = 4;
- optional string supervisorUuid = 5;
- optional string messageType = 6;
+ optional bytes messageManifest = 4;
+ optional string exception = 5;
+ optional string supervisorUuid = 6;
required bool isActor = 7;
+ required bool isSuccessful = 8;
}
\ No newline at end of file