diff --git a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala index ab2996f0a7..0b8e68c56a 100644 --- a/akka-actor/src/main/scala/akka/actor/ActorSystem.scala +++ b/akka-actor/src/main/scala/akka/actor/ActorSystem.scala @@ -300,8 +300,9 @@ abstract class ActorSystem extends ActorRefFactory { * Default dispatcher as configured. This dispatcher is used for all actors * in the actor system which do not have a different dispatcher configured * explicitly. + * Importing this member will place the default MessageDispatcher in scope. */ - def dispatcher: MessageDispatcher + implicit def dispatcher: MessageDispatcher /** * Register a block of code (callback) to run after all actors in this actor system have diff --git a/akka-actor/src/main/scala/akka/actor/Props.scala b/akka-actor/src/main/scala/akka/actor/Props.scala index ffc9574421..292a437dab 100644 --- a/akka-actor/src/main/scala/akka/actor/Props.scala +++ b/akka-actor/src/main/scala/akka/actor/Props.scala @@ -138,7 +138,7 @@ case class Props( * Java API. */ def this(actorClass: Class[_ <: Actor]) = this( - creator = () ⇒ actorClass.newInstance, + creator = FromClassCreator(actorClass), dispatcher = Dispatchers.DefaultDispatcherId, routerConfig = Props.defaultRoutedProps) @@ -161,7 +161,7 @@ case class Props( * * Java API. */ - def withCreator(c: Class[_ <: Actor]): Props = copy(creator = () ⇒ c.newInstance) + def withCreator(c: Class[_ <: Actor]): Props = copy(creator = FromClassCreator(c)) /** * Returns a new Props with the specified dispatcher set. @@ -177,4 +177,13 @@ case class Props( * Returns a new Props with the specified deployment configuration. */ def withDeploy(d: Deploy): Props = copy(deploy = d) + +} + +/** + * Used when creating an Actor from a class. Special Function0 to be + * able to optimize serialization. + */ +private[akka] case class FromClassCreator(clazz: Class[_ <: Actor]) extends Function0[Actor] { + def apply(): Actor = clazz.newInstance } diff --git a/akka-docs/Makefile b/akka-docs/Makefile index 3c0041537d..c78d5ba317 100644 --- a/akka-docs/Makefile +++ b/akka-docs/Makefile @@ -34,6 +34,7 @@ endif help: @echo "Please use \`make ' where is one of" @echo " pygments to locally install the custom pygments styles" + @echo " epub to make an epub" @echo " html to make standalone HTML files" @echo " singlehtml to make a single large HTML file" @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter" @@ -53,6 +54,11 @@ pygments: $(LOCALPACKAGES): $(MAKE) pygments +epub: $(LOCALPACKAGES) + $(SPHINXBUILD) $(SPHINXFLAGS) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub + @echo + @echo "Build finished. The epub file is in $(BUILDDIR)/epub." + html: $(LOCALPACKAGES) $(SPHINXBUILD) $(SPHINXFLAGS) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html @echo diff --git a/akka-docs/conf.py b/akka-docs/conf.py index 2e66d8b56c..b632430b59 100644 --- a/akka-docs/conf.py +++ b/akka-docs/conf.py @@ -52,6 +52,14 @@ html_context = { 'include_analytics': 'online' in tags } +# -- Options for EPUB output --------------------------------------------------- +epub_author = "Typesafe Inc" +epub_language = "en" +epub_publisher = epub_author +epub_identifier = "http://doc.akka.io/docs/akka/snapshot/" +epub_scheme = "URL" +epub_cover = ("_sphinx/static/akka.png", "") + # -- Options for LaTeX output -------------------------------------------------- def setup(app): diff --git a/akka-docs/intro/deployment-scenarios.rst b/akka-docs/intro/deployment-scenarios.rst index b2d0334c7d..fc3b38cbd2 100644 --- a/akka-docs/intro/deployment-scenarios.rst +++ b/akka-docs/intro/deployment-scenarios.rst @@ -13,7 +13,7 @@ Akka can be used in different ways: be put into ``WEB-INF/lib`` - As a stand alone application by instantiating ActorSystem in a main class or - using the :ref:`microkernel` + using the :ref:`microkernel-scala` / :ref:`microkernel-java` Using Akka as library @@ -27,5 +27,6 @@ modules to the stack. Using Akka as a stand alone microkernel ---------------------------------------- -Akka can also be run as a stand-alone microkernel. See :ref:`microkernel` for +Akka can also be run as a stand-alone microkernel. See +:ref:`microkernel-scala` / :ref:`microkernel-java` for more information. diff --git a/akka-docs/intro/getting-started.rst b/akka-docs/intro/getting-started.rst index b3bdbf70f3..adc580c6e2 100644 --- a/akka-docs/intro/getting-started.rst +++ b/akka-docs/intro/getting-started.rst @@ -67,7 +67,8 @@ The Akka distribution includes the microkernel. To run the microkernel put your application jar in the ``deploy`` directory and use the scripts in the ``bin`` directory. -More information is available in the documentation of the :ref:`microkernel`. +More information is available in the documentation of the +:ref:`microkernel-scala` / :ref:`microkernel-java`. Using a build tool ------------------ @@ -136,12 +137,17 @@ SBT installation instructions on `https://github.com/harrah/xsbt/wiki/Setup `_ to generate Eclipse project. +Setup SBT project and then use `sbteclipse `_ to generate a Eclipse project. Using Akka with IntelliJ IDEA ----------------------------- -Setup SBT project and then use `sbt-idea `_ to generate IntelliJ IDEA project. +Setup SBT project and then use `sbt-idea `_ to generate a IntelliJ IDEA project. + +Using Akka with NetBeans +------------------------ + +Setup SBT project and then use `sbt-netbeans-plugin `_ to generate a NetBeans project. Build from sources ------------------ diff --git a/akka-docs/java/microkernel.rst b/akka-docs/java/microkernel.rst index 12afbc93c9..970b174549 100644 --- a/akka-docs/java/microkernel.rst +++ b/akka-docs/java/microkernel.rst @@ -1,5 +1,5 @@ -.. _microkernel: +.. _microkernel-java: Microkernel (Java) ================== diff --git a/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala b/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala index 2f67c607ed..c81f16e896 100644 --- a/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala +++ b/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala @@ -33,8 +33,100 @@ class DurableMailboxDocSpec extends AkkaSpec(DurableMailboxDocSpec.config) { "configuration of dispatcher with durable mailbox" in { //#dispatcher-config-use - val myActor = system.actorOf(Props[MyActor].withDispatcher("my-dispatcher"), name = "myactor") + val myActor = system.actorOf(Props[MyActor]. + withDispatcher("my-dispatcher"), name = "myactor") //#dispatcher-config-use } } + +//#custom-mailbox +import com.typesafe.config.Config +import akka.actor.ActorContext +import akka.actor.ActorRef +import akka.actor.ActorSystem +import akka.dispatch.Envelope +import akka.dispatch.MailboxType +import akka.dispatch.MessageQueue +import akka.actor.mailbox.DurableMessageQueue +import akka.actor.mailbox.DurableMessageSerialization + +class MyMailboxType(systemSettings: ActorSystem.Settings, config: Config) + extends MailboxType { + + override def create(owner: Option[ActorContext]): MessageQueue = owner match { + case Some(o) ⇒ new MyMessageQueue(o) + case None ⇒ throw new IllegalArgumentException( + "requires an owner (i.e. does not work with BalancingDispatcher)") + } +} + +class MyMessageQueue(_owner: ActorContext) + extends DurableMessageQueue(_owner) with DurableMessageSerialization { + + val storage = new QueueStorage + + def enqueue(receiver: ActorRef, envelope: Envelope) { + val data: Array[Byte] = serialize(envelope) + storage.push(data) + } + + def dequeue(): Envelope = { + val data: Option[Array[Byte]] = storage.pull() + data.map(deserialize).orNull + } + + def hasMessages: Boolean = !storage.isEmpty + + def numberOfMessages: Int = storage.size + + /** + * Called when the mailbox is disposed. + * An ordinary mailbox would send remaining messages to deadLetters, + * but the purpose of a durable mailbox is to continue + * with the same message queue when the actor is started again. + */ + def cleanUp(owner: ActorContext, deadLetters: MessageQueue): Unit = () + +} +//#custom-mailbox + +// dummy +class QueueStorage { + import java.util.concurrent.ConcurrentLinkedQueue + val queue = new ConcurrentLinkedQueue[Array[Byte]] + def push(data: Array[Byte]): Unit = queue.offer(data) + def pull(): Option[Array[Byte]] = Option(queue.poll()) + def isEmpty: Boolean = queue.isEmpty + def size: Int = queue.size +} + +//#custom-mailbox-test +import akka.actor.mailbox.DurableMailboxSpec + +object MyMailboxSpec { + val config = """ + MyStorage-dispatcher { + mailbox-type = akka.docs.actor.mailbox.MyMailboxType + } + """ +} + +class MyMailboxSpec extends DurableMailboxSpec("MyStorage", MyMailboxSpec.config) { + override def atStartup() { + } + + override def atTermination() { + } + + "MyMailbox" must { + "deliver a message" in { + val actor = createMailboxTestActor() + implicit val sender = testActor + actor ! "hello" + expectMsg("hello") + } + + // add more tests + } +} \ No newline at end of file diff --git a/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java b/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java index 834dc6f0fb..25158446b6 100644 --- a/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java +++ b/akka-docs/modules/code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java @@ -4,9 +4,8 @@ package akka.docs.actor.mailbox; //#imports -import akka.actor.UntypedActorFactory; -import akka.actor.UntypedActor; import akka.actor.Props; +import akka.actor.ActorRef; //#imports @@ -16,8 +15,8 @@ import org.junit.Test; import akka.testkit.AkkaSpec; import com.typesafe.config.ConfigFactory; -import akka.actor.ActorRef; import akka.actor.ActorSystem; +import akka.actor.UntypedActor; import static org.junit.Assert.*; @@ -39,12 +38,8 @@ public class DurableMailboxDocTestBase { @Test public void configDefinedDispatcher() { //#dispatcher-config-use - ActorRef myActor = system.actorOf( - new Props().withDispatcher("my-dispatcher").withCreator(new UntypedActorFactory() { - public UntypedActor create() { - return new MyUntypedActor(); - } - }), "myactor"); + ActorRef myActor = system.actorOf(new Props(MyUntypedActor.class). + withDispatcher("my-dispatcher"), "myactor"); //#dispatcher-config-use myActor.tell("test"); } diff --git a/akka-docs/modules/durable-mailbox.rst b/akka-docs/modules/durable-mailbox.rst index 74618d978e..aca9d51eb5 100644 --- a/akka-docs/modules/durable-mailbox.rst +++ b/akka-docs/modules/durable-mailbox.rst @@ -9,40 +9,45 @@ Overview ======== -Akka supports a set of durable mailboxes. A durable mailbox is a replacement for -the standard actor mailbox that is durable. What this means in practice is that -if there are pending messages in the actor's mailbox when the node of the actor -resides on crashes, then when you restart the node, the actor will be able to -continue processing as if nothing had happened; with all pending messages still -in its mailbox. +A durable mailbox is a mailbox which stores the messages on durable storage. +What this means in practice is that if there are pending messages in the actor's +mailbox when the node of the actor resides on crashes, then when you restart the +node, the actor will be able to continue processing as if nothing had happened; +with all pending messages still in its mailbox. -None of these mailboxes implements transactions for current message. It's possible +You configure durable mailboxes through the dispatcher. The actor is oblivious +to which type of mailbox it is using. + +This gives you an excellent way of creating bulkheads in your application, where +groups of actors sharing the same dispatcher also share the same backing +storage. Read more about that in the :ref:`dispatchers-scala` documentation. + +One basic file based durable mailbox is provided by Akka out-of-the-box. +Other implementations can easily be added. Some are available as separate community +Open Source projects, such as: + +* `AMQP Durable Mailbox `_ + + +A durable mailbox is like any other mailbox not likely to be transactional. It's possible if the actor crashes after receiving a message, but before completing processing of it, that the message could be lost. -.. warning:: **IMPORTANT** +.. warning:: - None of these mailboxes work with blocking message send, i.e. the message + A durable mailbox typically doesn't work with blocking message send, i.e. the message send operations that are relying on futures; ``?`` or ``ask``. If the node has crashed and then restarted, the thread that was blocked waiting for the reply is gone and there is no way we can deliver the message. -The durable mailboxes supported out-of-the-box are: - - ``FileBasedMailbox`` -- backed by a journaling transaction log on the local file system +File-based durable mailbox +========================== -You can easily implement your own mailbox. Look at the existing implementation for inspiration. - -.. _DurableMailbox.General: - -General Usage -------------- - -The durable mailboxes and their configuration options reside in the -``akka.actor.mailbox`` package. - -You configure durable mailboxes through the dispatcher. The -actor is oblivious to which type of mailbox it is using. +This mailbox is backed by a journaling transaction log on the local file +system. It is the simplest to use since it does not require an extra +infrastructure piece to administer, but it is usually sufficient and just what +you need. In the configuration of the dispatcher you specify the fully qualified class name of the mailbox: @@ -60,32 +65,38 @@ Corresponding example in Java: .. includecode:: code/akka/docs/actor/mailbox/DurableMailboxDocTestBase.java :include: imports,dispatcher-config-use -The actor is oblivious to which type of mailbox it is using. - -This gives you an excellent way of creating bulkheads in your application, where -groups of actors sharing the same dispatcher also share the same backing -storage. Read more about that in the :ref:`dispatchers-scala` documentation. - -File-based durable mailbox -========================== - -This mailbox is backed by a journaling transaction log on the local file -system. It is the simplest to use since it does not require an extra -infrastructure piece to administer, but it is usually sufficient and just what -you need. - -You configure durable mailboxes through the dispatcher, as described in -:ref:`DurableMailbox.General` with the following mailbox type. - -Config:: - - my-dispatcher { - mailbox-type = akka.actor.mailbox.FileBasedMailboxType - } - You can also configure and tune the file-based durable mailbox. This is done in the ``akka.actor.mailbox.file-based`` section in the :ref:`configuration`. .. literalinclude:: ../../akka-durable-mailboxes/akka-file-mailbox/src/main/resources/reference.conf :language: none +How to implement a durable mailbox +================================== + +Here is an example of how to implement a custom durable mailbox. Essentially it consists of +a configurator (MailboxType) and a queue implementation (DurableMessageQueue). + +The envelope contains the message sent to the actor, and information about sender. It is the +envelope that needs to be stored. As a help utility you can mixin DurableMessageSerialization +to serialize and deserialize the envelope using the ordinary :ref:`serialization-scala` +mechanism. This optional and you may store the envelope data in any way you like. + +.. includecode:: code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala + :include: custom-mailbox + +To facilitate testing of a durable mailbox you may use ``DurableMailboxSpec`` as base class. +It implements a few basic tests and helps you setup the a fixture. More tests can be +added in concrete subclass like this: + +.. includecode:: code/akka/docs/actor/mailbox/DurableMailboxDocSpec.scala + :include: custom-mailbox-test + +You find DurableMailboxDocSpec in ``akka-mailboxes-common-test-2.1-SNAPSHOT.jar``. +Add this dependency:: + + "com.typesafe.akka" % "akka-mailboxes-common-test" % "2.1-SNAPSHOT" + +For more inspiration you can look at the old implementations based on Redis, MongoDB, Beanstalk, +and ZooKeeper, which can be found in Akka git repository tag +`v2.0.1 `_. \ No newline at end of file diff --git a/akka-docs/scala/code/akka/docs/testkit/TestKitUsageSpec.scala b/akka-docs/scala/code/akka/docs/testkit/TestKitUsageSpec.scala new file mode 100644 index 0000000000..d2b2f9367d --- /dev/null +++ b/akka-docs/scala/code/akka/docs/testkit/TestKitUsageSpec.scala @@ -0,0 +1,156 @@ +/** + * Copyright (C) 2009-2012 Typesafe Inc. + */ +package akka.docs.testkit + +//#testkit-usage +import scala.util.Random + +import org.scalatest.BeforeAndAfterAll +import org.scalatest.WordSpec +import org.scalatest.matchers.ShouldMatchers + +import com.typesafe.config.ConfigFactory + +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.ActorSystem +import akka.actor.Props +import akka.testkit.DefaultTimeout +import akka.testkit.ImplicitSender +import akka.testkit.TestKit +import akka.util.duration._ + +/** + * a Test to show some TestKit examples + */ +class TestKitUsageSpec + extends TestKit(ActorSystem("TestKitUsageSpec", + ConfigFactory.parseString(TestKitUsageSpec.config))) + with DefaultTimeout with ImplicitSender + with WordSpec with ShouldMatchers with BeforeAndAfterAll { + import TestKitUsageSpec._ + + val echoRef = system.actorOf(Props(new EchoActor)) + val forwardRef = system.actorOf(Props(new ForwardingActor(testActor))) + val filterRef = system.actorOf(Props(new FilteringActor(testActor))) + val randomHead = Random.nextInt(6) + val randomTail = Random.nextInt(10) + val headList = Seq().padTo(randomHead, "0") + val tailList = Seq().padTo(randomTail, "1") + val seqRef = system.actorOf(Props(new SequencingActor(testActor, headList, tailList))) + + override def afterAll { + system.shutdown() + } + + "An EchoActor" should { + "Respond with the same message it receives" in { + within(500 millis) { + echoRef ! "test" + expectMsg("test") + } + } + } + "A ForwardingActor" should { + "Forward a message it receives" in { + within(500 millis) { + forwardRef ! "test" + expectMsg("test") + } + } + } + "A FilteringActor" should { + "Filter all messages, except expected messagetypes it receives" in { + var messages = Seq[String]() + within(500 millis) { + filterRef ! "test" + expectMsg("test") + filterRef ! 1 + expectNoMsg + filterRef ! "some" + filterRef ! "more" + filterRef ! 1 + filterRef ! "text" + filterRef ! 1 + + receiveWhile(500 millis) { + case msg: String ⇒ messages = msg +: messages + } + } + messages.length should be(3) + messages.reverse should be(Seq("some", "more", "text")) + } + } + "A SequencingActor" should { + "receive an interesting message at some point " in { + within(500 millis) { + ignoreMsg { + case msg: String ⇒ msg != "something" + } + seqRef ! "something" + expectMsg("something") + ignoreMsg { + case msg: String ⇒ msg == "1" + } + expectNoMsg + ignoreNoMsg + } + } + } +} + +object TestKitUsageSpec { + // Define your test specific configuration here + val config = """ + akka { + loglevel = "WARNING" + } + """ + + /** + * An Actor that echoes everything you send to it + */ + class EchoActor extends Actor { + def receive = { + case msg ⇒ sender ! msg + } + } + + /** + * An Actor that forwards every message to a next Actor + */ + class ForwardingActor(next: ActorRef) extends Actor { + def receive = { + case msg ⇒ next ! msg + } + } + + /** + * An Actor that only forwards certain messages to a next Actor + */ + class FilteringActor(next: ActorRef) extends Actor { + def receive = { + case msg: String ⇒ next ! msg + case _ ⇒ None + } + } + + /** + * An actor that sends a sequence of messages with a random head list, an + * interesting value and a random tail list. The idea is that you would + * like to test that the interesting value is received and that you cant + * be bothered with the rest + */ + class SequencingActor(next: ActorRef, head: Seq[String], tail: Seq[String]) + extends Actor { + def receive = { + case msg ⇒ { + head foreach { next ! _ } + next ! msg + tail foreach { next ! _ } + } + } + } +} +//#testkit-usage \ No newline at end of file diff --git a/akka-docs/scala/microkernel.rst b/akka-docs/scala/microkernel.rst index df0e623eee..c2bc95cb8b 100644 --- a/akka-docs/scala/microkernel.rst +++ b/akka-docs/scala/microkernel.rst @@ -1,5 +1,5 @@ -.. _microkernel: +.. _microkernel-scala: Microkernel (Scala) =================== diff --git a/akka-docs/scala/testing.rst b/akka-docs/scala/testing.rst index 15f73f4ef0..abb9e0d115 100644 --- a/akka-docs/scala/testing.rst +++ b/akka-docs/scala/testing.rst @@ -194,6 +194,8 @@ is a whole set of examination methods, e.g. receiving all consecutive messages matching certain criteria, receiving a whole sequence of fixed messages or classes, receiving nothing for some time, etc. +The ActorSystem passed in to the constructor of TestKit is accessible with +the the :obj:`system` member. Remember to shut down the actor system after the test is finished (also in case of failure) so that all actors—including the test actor—are stopped. diff --git a/akka-docs/scala/testkit-example.rst b/akka-docs/scala/testkit-example.rst index 54a848d267..7208de5828 100644 --- a/akka-docs/scala/testkit-example.rst +++ b/akka-docs/scala/testkit-example.rst @@ -6,142 +6,5 @@ TestKit Example (Scala) Ray Roestenburg's example code from `his blog `_ adapted to work with Akka 2.x. -.. code-block:: scala +.. includecode:: code/akka/docs/testkit/TestkitUsageSpec.scala#testkit-usage - package unit.akka - - import org.scalatest.matchers.ShouldMatchers - import org.scalatest.{WordSpec, BeforeAndAfterAll} - import akka.actor.Actor._ - import akka.util.duration._ - import akka.testkit.TestKit - import java.util.concurrent.TimeUnit - import akka.actor.{ActorRef, Actor} - import util.Random - - /** - * a Test to show some TestKit examples - */ - - class TestKitUsageSpec extends WordSpec with BeforeAndAfterAll with ShouldMatchers with TestKit { - val system = ActorSystem() - import system._ - val echoRef = actorOf(Props(new EchoActor)) - val forwardRef = actorOf(Props(new ForwardingActor(testActor))) - val filterRef = actorOf(Props(new FilteringActor(testActor))) - val randomHead = Random.nextInt(6) - val randomTail = Random.nextInt(10) - val headList = List().padTo(randomHead, "0") - val tailList = List().padTo(randomTail, "1") - val seqRef = actorOf(Props(new SequencingActor(testActor, headList, tailList))) - - override protected def afterAll(): scala.Unit = { - stopTestActor - echoRef.stop() - forwardRef.stop() - filterRef.stop() - seqRef.stop() - } - - "An EchoActor" should { - "Respond with the same message it receives" in { - within(100 millis) { - echoRef ! "test" - expectMsg("test") - } - } - } - "A ForwardingActor" should { - "Forward a message it receives" in { - within(100 millis) { - forwardRef ! "test" - expectMsg("test") - } - } - } - "A FilteringActor" should { - "Filter all messages, except expected messagetypes it receives" in { - var messages = List[String]() - within(100 millis) { - filterRef ! "test" - expectMsg("test") - filterRef ! 1 - expectNoMsg - filterRef ! "some" - filterRef ! "more" - filterRef ! 1 - filterRef ! "text" - filterRef ! 1 - - receiveWhile(500 millis) { - case msg: String => messages = msg :: messages - } - } - messages.length should be(3) - messages.reverse should be(List("some", "more", "text")) - } - } - "A SequencingActor" should { - "receive an interesting message at some point " in { - within(100 millis) { - seqRef ! "something" - ignoreMsg { - case msg: String => msg != "something" - } - expectMsg("something") - ignoreMsg { - case msg: String => msg == "1" - } - expectNoMsg - } - } - } - } - - /** - * An Actor that echoes everything you send to it - */ - class EchoActor extends Actor { - def receive = { - case msg => { - self.reply(msg) - } - } - } - - /** - * An Actor that forwards every message to a next Actor - */ - class ForwardingActor(next: ActorRef) extends Actor { - def receive = { - case msg => { - next ! msg - } - } - } - - /** - * An Actor that only forwards certain messages to a next Actor - */ - class FilteringActor(next: ActorRef) extends Actor { - def receive = { - case msg: String => { - next ! msg - } - case _ => None - } - } - - /** - * An actor that sends a sequence of messages with a random head list, an interesting value and a random tail list - * The idea is that you would like to test that the interesting value is received and that you cant be bothered with the rest - */ - class SequencingActor(next: ActorRef, head: List[String], tail: List[String]) extends Actor { - def receive = { - case msg => { - head map (next ! _) - next ! msg - tail map (next ! _) - } - } - } diff --git a/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/FileBasedMailboxSpec.scala b/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/FileBasedMailboxSpec.scala index be82e0fcb3..6c97142068 100644 --- a/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/FileBasedMailboxSpec.scala +++ b/akka-durable-mailboxes/akka-file-mailbox/src/test/scala/akka/actor/mailbox/FileBasedMailboxSpec.scala @@ -25,19 +25,17 @@ class FileBasedMailboxSpec extends DurableMailboxSpec("File", FileBasedMailboxSp } } - def isDurableMailbox(m: Mailbox): Boolean = m.messageQueue.isInstanceOf[FileBasedMessageQueue] - - def clean { + def clean() { FileUtils.deleteDirectory(new java.io.File(queuePath)) } override def atStartup() { - clean + clean() super.atStartup() } override def atTermination() { - clean + clean() super.atTermination() } } diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/main/protocol/MailboxProtocol.proto b/akka-durable-mailboxes/akka-mailboxes-common/src/main/protocol/MailboxProtocol.proto deleted file mode 100644 index 96fab2bf95..0000000000 --- a/akka-durable-mailboxes/akka-mailboxes-common/src/main/protocol/MailboxProtocol.proto +++ /dev/null @@ -1,30 +0,0 @@ -/** - * Copyright (C) 2009-2012 Typesafe Inc. - */ - -option java_package = "akka.actor.mailbox"; -option optimize_for = SPEED; - -/****************************************** - Compile with: - cd ./akka-durable-mailboxes/akka-mailboxes-common/src/main/protocol - protoc MailboxProtocol.proto --java_out ../java -*******************************************/ - -/** - * Defines the durable mailbox message. - */ -message DurableMailboxMessageProtocol { - required string ownerAddress = 1; - optional string senderAddress = 2; - optional UuidProtocol futureUuid = 3; - required bytes message = 4; -} - -/** - * Defines a UUID. - */ -message UuidProtocol { - required uint64 high = 1; - required uint64 low = 2; -} diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableMailbox.scala b/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableMailbox.scala index 41ec6d7307..0744215bae 100644 --- a/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableMailbox.scala +++ b/akka-durable-mailboxes/akka-mailboxes-common/src/main/scala/akka/actor/mailbox/DurableMailbox.scala @@ -28,6 +28,9 @@ trait DurableMessageSerialization { this: DurableMessageQueue ⇒ def serialize(durableMessage: Envelope): Array[Byte] = { + // It's alright to use ref.path.toString here + // When the sender is a LocalActorRef it should be local when deserialized also. + // When the sender is a RemoteActorRef the path.toString already contains remote address information. def serializeActorRef(ref: ActorRef): ActorRefProtocol = ActorRefProtocol.newBuilder.setPath(ref.path.toString).build val message = MessageSerializer.serialize(system, durableMessage.message.asInstanceOf[AnyRef]) diff --git a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala index ff436c227e..9081a5fcb0 100644 --- a/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala +++ b/akka-durable-mailboxes/akka-mailboxes-common/src/test/scala/akka/actor/mailbox/DurableMailboxSpec.scala @@ -3,14 +3,25 @@ */ package akka.actor.mailbox -import akka.testkit.AkkaSpec -import akka.testkit.TestLatch -import akka.util.duration._ -import java.io.InputStream -import scala.annotation.tailrec +import DurableMailboxSpecActorFactory.AccumulatorActor +import DurableMailboxSpecActorFactory.MailboxTestActor +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.ActorSystem +import akka.actor.LocalActorRef +import akka.actor.Props +import akka.actor.actorRef2Scala +import akka.dispatch.Mailbox +import akka.testkit.TestKit +import akka.util.duration.intToDurationInt import com.typesafe.config.Config -import akka.actor._ -import akka.dispatch.{ Mailbox, Await } +import com.typesafe.config.ConfigFactory +import java.io.InputStream +import java.util.concurrent.TimeoutException +import org.scalatest.BeforeAndAfterAll +import org.scalatest.WordSpec +import org.scalatest.matchers.MustMatchers +import scala.annotation.tailrec object DurableMailboxSpecActorFactory { @@ -28,13 +39,62 @@ object DurableMailboxSpecActorFactory { } +object DurableMailboxSpec { + def fallbackConfig: Config = ConfigFactory.parseString(""" + akka { + event-handlers = ["akka.testkit.TestEventListener"] + loglevel = "WARNING" + stdout-loglevel = "WARNING" + } + """) +} + /** + * Reusable test fixture for durable mailboxes. Implements a few basic tests. More + * tests can be added in concrete subclass. + * * Subclass must define dispatcher in the supplied config for the specific backend. * The id of the dispatcher must be the same as the `-dispatcher`. */ -abstract class DurableMailboxSpec(val backendName: String, config: String) extends AkkaSpec(config) { +abstract class DurableMailboxSpec(system: ActorSystem, val backendName: String) + extends TestKit(system) with WordSpec with MustMatchers with BeforeAndAfterAll { + import DurableMailboxSpecActorFactory._ + /** + * Subclass must define dispatcher in the supplied config for the specific backend. + * The id of the dispatcher must be the same as the `-dispatcher`. + */ + def this(backendName: String, config: String) = { + this(ActorSystem(backendName + "BasedDurableMailboxSpec", + ConfigFactory.parseString(config).withFallback(DurableMailboxSpec.fallbackConfig)), + backendName) + } + + final override def beforeAll { + atStartup() + } + + /** + * May be implemented in concrete subclass to do additional things once before test + * cases are run. + */ + protected def atStartup() {} + + final override def afterAll { + system.shutdown() + try system.awaitTermination(5 seconds) catch { + case _: TimeoutException ⇒ system.log.warning("Failed to stop [{}] within 5 seconds", system.name) + } + atTermination() + } + + /** + * May be implemented in concrete subclass to do additional things once after all + * test cases have been run. + */ + def atTermination() {} + protected def streamMustContain(in: InputStream, words: String): Unit = { val output = new Array[Byte](8192) @@ -60,7 +120,8 @@ abstract class DurableMailboxSpec(val backendName: String, config: String) exten case some ⇒ system.actorOf(props.withDispatcher(backendName + "-dispatcher"), some) } - def isDurableMailbox(m: Mailbox): Boolean + private def isDurableMailbox(m: Mailbox): Boolean = + m.messageQueue.isInstanceOf[DurableMessageQueue] "A " + backendName + " based mailbox backed actor" must { diff --git a/akka-kernel/src/main/dist/bin/akka-cluster b/akka-kernel/src/main/dist/bin/akka-cluster index ecca52fa9b..3e76cdbb11 100755 --- a/akka-kernel/src/main/dist/bin/akka-cluster +++ b/akka-kernel/src/main/dist/bin/akka-cluster @@ -3,7 +3,6 @@ # ============== Akka Cluster Administration Tool ============== # # This script is meant to be used from within the Akka distribution. -# Requires setting $AKKA_HOME to the root of the distribution. # # Add these options to the sbt or startup script: # java \ @@ -15,9 +14,12 @@ # FIXME support authentication? if so add: -Dcom.sun.management.jmxremote.password.file= AND tweak this script to support it (arg need 'user:passwd' instead of '-') -# NOTE: The 'cmdline-jmxclient' JAR is available as part of the Akka distribution. -# Provided by Typesafe Maven Repository: http://repo.typesafe.com/typesafe/releases/cmdline-jmxclient. -JMX_CLIENT="java -jar $AKKA_HOME/lib/akka/cmdline-jmxclient-0.10.3.jar -" +declare AKKA_HOME="$(cd "$(cd "$(dirname "$0")"; pwd -P)"/..; pwd)" + +[ -n "$JMX_CLIENT_CLASSPATH" ] || JMX_CLIENT_CLASSPATH="$AKKA_HOME/lib/akka/akka-kernel-*" + +# NOTE: The 'cmdline-jmxclient' is available as part of the Akka distribution. +JMX_CLIENT="java -cp $JMX_CLIENT_CLASSPATH akka.jmx.Client -" SELF=`basename $0` # script name HOST=$1 # cluster node:port to talk to through JMX @@ -168,7 +170,7 @@ case "$2" in ;; *) - printf "Usage: $SELF ...\n" + printf "Usage: bin/$SELF ...\n" printf "\n" printf "Supported commands are:\n" printf "%26s - %s\n" "join " "Sends request a JOIN node with the specified URL" @@ -183,9 +185,9 @@ case "$2" in printf "%26s - %s\n" has-convergence "Checks if there is a cluster convergence" printf "Where the should be on the format of 'akka://actor-system-name@hostname:port'\n" printf "\n" - printf "Examples: $SELF localhost:9999 is-available\n" - printf " $SELF localhost:9999 join akka://MySystem@darkstar:2552\n" - printf " $SELF localhost:9999 cluster-status\n" + printf "Examples: bin/$SELF localhost:9999 is-available\n" + printf " bin/$SELF localhost:9999 join akka://MySystem@darkstar:2552\n" + printf " bin/$SELF localhost:9999 cluster-status\n" exit 1 ;; esac diff --git a/akka-kernel/src/main/java/akka/jmx/Client.java b/akka-kernel/src/main/java/akka/jmx/Client.java new file mode 100644 index 0000000000..9ebf63e9eb --- /dev/null +++ b/akka-kernel/src/main/java/akka/jmx/Client.java @@ -0,0 +1,781 @@ +/* + * Client + * + * $Id$ + * + * Created on Nov 12, 2004 + * + * Copyright (C) 2004 Internet Archive. + * + * This file is part of the Heritrix web crawler (crawler.archive.org). + * + * Heritrix is free software; you can redistribute it and/or modify + * it under the terms of the GNU Lesser Public License as published by + * the Free Software Foundation; either version 2.1 of the License, or + * any later version. + * + * Heritrix is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with Heritrix; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ +package akka.jmx; + +import java.io.IOException; +import java.io.PrintWriter; +import java.io.StringWriter; +import java.text.FieldPosition; +import java.text.ParseException; +import java.text.SimpleDateFormat; +import java.util.Date; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; +import java.util.Set; +import java.util.logging.ConsoleHandler; +import java.util.logging.Handler; +import java.util.logging.LogRecord; +import java.util.logging.Logger; +import java.util.logging.SimpleFormatter; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import javax.management.Attribute; +import javax.management.AttributeList; +import javax.management.InstanceNotFoundException; +import javax.management.IntrospectionException; +import javax.management.MBeanAttributeInfo; +import javax.management.MBeanFeatureInfo; +import javax.management.MBeanInfo; +import javax.management.MBeanOperationInfo; +import javax.management.MBeanParameterInfo; +import javax.management.MBeanServerConnection; +import javax.management.MalformedObjectNameException; +import javax.management.ObjectInstance; +import javax.management.ObjectName; +import javax.management.ReflectionException; +import javax.management.openmbean.CompositeData; +import javax.management.openmbean.TabularData; +import javax.management.remote.JMXConnector; +import javax.management.remote.JMXConnectorFactory; +import javax.management.remote.JMXServiceURL; + + +/** + * A Simple Command-Line JMX Client. + * Tested against the JDK 1.5.0 JMX Agent. + * See Monitoring + * and Management Using JMX. + *

Can supply credentials and do primitive string representation of tabular + * and composite openmbeans. + * @author stack + */ +public class Client { + private static final Logger logger = + Logger.getLogger(Client.class.getName()); + + /** + * Usage string. + */ + private static final String USAGE = "Usage: java -jar" + + " cmdline-jmxclient.jar USER:PASS HOST:PORT [BEAN] [COMMAND]\n" + + "Options:\n" + + " USER:PASS Username and password. Required. If none, pass '-'.\n" + + " E.g. 'controlRole:secret'\n" + + " HOST:PORT Hostname and port to connect to. Required." + + " E.g. localhost:8081.\n" + + " Lists registered beans if only USER:PASS and this" + + " argument.\n" + + " BEAN Optional target bean name. If present we list" + + " available operations\n" + + " and attributes.\n" + + " COMMAND Optional operation to run or attribute to fetch. If" + + " none supplied,\n" + + " all operations and attributes are listed. Attributes" + + " begin with a\n" + + " capital letter: e.g. 'Status' or 'Started'." + + " Operations do not.\n" + + " Operations can take arguments by adding an '=' " + + "followed by\n" + + " comma-delimited params. Pass multiple " + + "attributes/operations to run\n" + + " more than one per invocation. Use commands 'create' and " + + "'destroy'\n" + + " to instantiate and unregister beans ('create' takes name " + + "of class).\n" + + " Pass 'Attributes' to get listing of all attributes and " + + "and their\n" + + " values.\n" + + "Requirements:\n" + + " JDK1.5.0. If connecting to a SUN 1.5.0 JDK JMX Agent, remote side" + + " must be\n" + + " started with system properties such as the following:\n" + + " -Dcom.sun.management.jmxremote.port=PORT\n" + + " -Dcom.sun.management.jmxremote.authenticate=false\n" + + " -Dcom.sun.management.jmxremote.ssl=false\n" + + " The above will start the remote server with no password. See\n" + + " http://java.sun.com/j2se/1.5.0/docs/guide/management/agent.html" + + " for more on\n" + + " 'Monitoring and Management via JMX'.\n" + + "Client Use Examples:\n" + + " To list MBeans on a non-password protected remote agent:\n" + + " % java -jar cmdline-jmxclient-X.X.jar - localhost:8081 \\\n" + + " org.archive.crawler:name=Heritrix,type=Service\n" + + " To list attributes and attributes of the Heritrix MBean:\n" + + " % java -jar cmdline-jmxclient-X.X.jar - localhost:8081 \\\n" + + " org.archive.crawler:name=Heritrix,type=Service \\\n" + + " schedule=http://www.archive.org\n" + + " To set set logging level to FINE on a password protected JVM:\n" + + " % java -jar cmdline-jmxclient-X.X.jar controlRole:secret" + + " localhost:8081 \\\n" + + " java.util.logging:type=Logging \\\n" + + " setLoggerLevel=org.archive.crawler.Heritrix,FINE"; + + /** + * Pattern that matches a command name followed by + * an optional equals and optional comma-delimited list + * of arguments. + */ + protected static final Pattern CMD_LINE_ARGS_PATTERN = + Pattern.compile("^([^=]+)(?:(?:\\=)(.+))?$"); + + private static final String CREATE_CMD_PREFIX = "create="; + + public static void main(String[] args) throws Exception { + Client client = new Client(); + // Set the logger to use our all-on-one-line formatter. + Logger l = Logger.getLogger(""); + Handler [] hs = l.getHandlers(); + for (int i = 0; i < hs.length; i++) { + Handler h = hs[0]; + if (h instanceof ConsoleHandler) { + h.setFormatter(client.new OneLineSimpleLogger()); + } + } + client.execute(args); + } + + protected static void usage() { + usage(0, null); + } + + protected static void usage(int exitCode, String message) { + if (message != null && message.length() > 0) { + System.out.println(message); + } + System.out.println(USAGE); + System.exit(exitCode); + } + + /** + * Constructor. + */ + public Client() { + super(); + } + + /** + * Parse a 'login:password' string. Assumption is that no + * colon in the login name. + * @param userpass + * @return Array of strings with login in first position. + */ + protected String [] parseUserpass(final String userpass) { + if (userpass == null || userpass.equals("-")) { + return null; + } + int index = userpass.indexOf(':'); + if (index <= 0) { + throw new RuntimeException("Unable to parse: " +userpass); + } + return new String [] {userpass.substring(0, index), + userpass.substring(index + 1)}; + } + + /** + * @param login + * @param password + * @return Credentials as map for RMI. + */ + protected Map formatCredentials(final String login, + final String password) { + Map env = null; + String[] creds = new String[] {login, password}; + env = new HashMap(1); + env.put(JMXConnector.CREDENTIALS, creds); + return env; + } + + protected JMXConnector getJMXConnector(final String hostport, + final String login, final String password) + throws IOException { + // Make up the jmx rmi URL and get a connector. + JMXServiceURL rmiurl = new JMXServiceURL("service:jmx:rmi://" + + hostport + "/jndi/rmi://" + hostport + "/jmxrmi"); + return JMXConnectorFactory.connect(rmiurl, + formatCredentials(login, password)); + } + + protected ObjectName getObjectName(final String beanname) + throws MalformedObjectNameException, NullPointerException { + return notEmpty(beanname)? new ObjectName(beanname): null; + } + + /** + * Version of execute called from the cmdline. + * Prints out result of execution on stdout. + * Parses cmdline args. Then calls {@link #execute(String, String, + * String, String, String[], boolean)}. + * @param args Cmdline args. + * @throws Exception + */ + protected void execute(final String [] args) + throws Exception { + // Process command-line. + if (args.length == 0 || args.length == 1) { + usage(); + } + String userpass = args[0]; + String hostport = args[1]; + String beanname = null; + String [] command = null; + if (args.length > 2) { + beanname = args[2]; + } + if (args.length > 3) { + command = new String [args.length - 3]; + for (int i = 3; i < args.length; i++) { + command[i - 3] = args[i]; + } + } + String [] loginPassword = parseUserpass(userpass); + Object [] result = execute(hostport, + ((loginPassword == null)? null: loginPassword[0]), + ((loginPassword == null)? null: loginPassword[1]), beanname, + command); + // Print out results on stdout. Only log if a result. + if (result != null) { + for (int i = 0; i < result.length; i++) { + if (result[i] != null && result[i].toString().length() > 0) { + if (command != null) { + logger.info(command[i] + ": " + result[i]); + } else { + logger.info("\n" + result[i].toString()); + } + } + } + } + } + + protected Object [] execute(final String hostport, final String login, + final String password, final String beanname, + final String [] command) + throws Exception { + return execute(hostport, login, password, beanname, command, false); + } + + public Object [] executeOneCmd(final String hostport, final String login, + final String password, final String beanname, + final String command) + throws Exception { + return execute(hostport, login, password, beanname, + new String[] {command}, true); + } + + /** + * Execute command against remote JMX agent. + * @param hostport 'host:port' combination. + * @param login RMI login to use. + * @param password RMI password to use. + * @param beanname Name of remote bean to run command against. + * @param command Array of commands to run. + * @param oneBeanOnly Set true if passed beanname is + * an exact name and the query for a bean is only supposed to return + * one bean instance. If not, we raise an exception (Otherwise, if false, + * then we deal with possibility of multiple bean instances coming back + * from query). Set to true when want to get an attribute or run an + * operation. + * @return Array of results -- one per command. + * @throws Exception + */ + protected Object [] execute(final String hostport, final String login, + final String password, final String beanname, + final String [] command, final boolean oneBeanOnly) + throws Exception { + JMXConnector jmxc = getJMXConnector(hostport, login, password); + Object [] result = null; + try { + result = doBeans(jmxc.getMBeanServerConnection(), + getObjectName(beanname), command, oneBeanOnly); + } finally { + jmxc.close(); + } + return result; + } + + protected boolean notEmpty(String s) { + return s != null && s.length() > 0; + } + + protected Object [] doBeans(final MBeanServerConnection mbsc, + final ObjectName objName, final String[] command, + final boolean oneBeanOnly) + throws Exception { + Object [] result = null; + Set beans = mbsc.queryMBeans(objName, null); + if (beans.size() == 0) { + // No bean found. Check if we are to create a bean? + if (command.length == 1 && notEmpty(command[0]) + && command[0].startsWith(CREATE_CMD_PREFIX)) { + String className = + command[0].substring(CREATE_CMD_PREFIX.length()); + mbsc.createMBean(className, objName); + } else { + // TODO: Is there a better JMX exception that RE for this + // scenario? + throw new RuntimeException(objName.getCanonicalName() + + " not registered."); + } + } else if (beans.size() == 1) { + result = doBean(mbsc, (ObjectInstance) beans.iterator().next(), + command); + } else { + if (oneBeanOnly) { + throw new RuntimeException("Only supposed to be one bean " + + "query result"); + } + // This is case of multiple beans in query results. + // Print name of each into a StringBuffer. Return as one + // result. + StringBuffer buffer = new StringBuffer(); + for (Iterator i = beans.iterator(); i.hasNext();) { + Object obj = i.next(); + if (obj instanceof ObjectName) { + buffer.append((((ObjectName) obj).getCanonicalName())); + } else if (obj instanceof ObjectInstance) { + buffer.append((((ObjectInstance) obj).getObjectName() + .getCanonicalName())); + } else { + throw new RuntimeException("Unexpected object type: " + obj); + } + buffer.append("\n"); + } + result = new String [] {buffer.toString()}; + } + return result; + } + + /** + * Get attribute or run operation against passed bean instance. + * + * @param mbsc Server connection. + * @param instance Bean instance we're to get attributes from or run + * operation against. + * @param command Command to run (May be null). + * @return Result. If multiple commands, multiple results. + * @throws Exception + */ + protected Object [] doBean(MBeanServerConnection mbsc, + ObjectInstance instance, String [] command) + throws Exception { + // If no command, then print out list of attributes and operations. + if (command == null || command.length <= 0) { + return new String [] {listOptions(mbsc, instance)}; + } + + // Maybe multiple attributes/operations listed on one command line. + Object [] result = new Object[command.length]; + for (int i = 0; i < command.length; i++) { + result[i] = doSubCommand(mbsc, instance, command[i]); + } + return result; + } + + public Object doSubCommand(MBeanServerConnection mbsc, + ObjectInstance instance, String subCommand) + throws Exception { + // First, handle special case of our being asked to destroy a bean. + if (subCommand.equals("destroy")) { + mbsc.unregisterMBean(instance.getObjectName()); + return null; + } else if (subCommand.startsWith(CREATE_CMD_PREFIX)) { + throw new IllegalArgumentException("You cannot call create " + + "on an already existing bean."); + } + + // Get attribute and operation info. + MBeanAttributeInfo [] attributeInfo = + mbsc.getMBeanInfo(instance.getObjectName()).getAttributes(); + MBeanOperationInfo [] operationInfo = + mbsc.getMBeanInfo(instance.getObjectName()).getOperations(); + // Now, bdbje JMX bean doesn't follow the convention of attributes + // having uppercase first letter and operations having lowercase + // first letter. But most beans do. Be prepared to handle the bdbje + // case. + Object result = null; + if (Character.isUpperCase(subCommand.charAt(0))) { + // Probably an attribute. + if (!isFeatureInfo(attributeInfo, subCommand) && + isFeatureInfo(operationInfo, subCommand)) { + // Its not an attribute name. Looks like its name of an + // operation. Try it. + result = + doBeanOperation(mbsc, instance, subCommand, operationInfo); + } else { + // Then it is an attribute OR its not an attribute name nor + // operation name and the below invocation will throw a + // AttributeNotFoundException. + result = doAttributeOperation(mbsc, instance, subCommand, + attributeInfo); + } + } else { + // Must be an operation. + if (!isFeatureInfo(operationInfo, subCommand) && + isFeatureInfo(attributeInfo, subCommand)) { + // Its not an operation name but looks like it could be an + // attribute name. Try it. + result = doAttributeOperation(mbsc, instance, subCommand, + attributeInfo); + } else { + // Its an operation name OR its neither operation nor attribute + // name and the below will throw a NoSuchMethodException. + result = + doBeanOperation(mbsc, instance, subCommand, operationInfo); + } + } + + // Look at the result. Is it of composite or tabular type? + // If so, convert to a String representation. + if (result instanceof CompositeData) { + result = recurseCompositeData(new StringBuffer("\n"), "", "", + (CompositeData)result); + } else if (result instanceof TabularData) { + result = recurseTabularData(new StringBuffer("\n"), "", "", + (TabularData)result); + } else if (result instanceof String []) { + String [] strs = (String [])result; + StringBuffer buffer = new StringBuffer("\n"); + for (int i = 0; i < strs.length; i++) { + buffer.append(strs[i]); + buffer.append("\n"); + } + result = buffer; + } else if (result instanceof AttributeList) { + AttributeList list = (AttributeList)result; + if (list.size() <= 0) { + result = null; + } else { + StringBuffer buffer = new StringBuffer("\n"); + for (Iterator ii = list.iterator(); ii.hasNext();) { + Attribute a = (Attribute)ii.next(); + buffer.append(a.getName()); + buffer.append(": "); + buffer.append(a.getValue()); + buffer.append("\n"); + } + result = buffer; + } + } + return result; + } + + protected boolean isFeatureInfo(MBeanFeatureInfo [] infos, String cmd) { + return getFeatureInfo(infos, cmd) != null; + } + + protected MBeanFeatureInfo getFeatureInfo(MBeanFeatureInfo [] infos, + String cmd) { + // Cmd may be carrying arguments. Don't count them in the compare. + int index = cmd.indexOf('='); + String name = (index > 0)? cmd.substring(0, index): cmd; + for (int i = 0; i < infos.length; i++) { + if (infos[i].getName().equals(name)) { + return infos[i]; + } + } + return null; + } + + protected StringBuffer recurseTabularData(StringBuffer buffer, + String indent, String name, TabularData data) { + addNameToBuffer(buffer, indent, name); + java.util.Collection c = data.values(); + for (Iterator i = c.iterator(); i.hasNext();) { + Object obj = i.next(); + if (obj instanceof CompositeData) { + recurseCompositeData(buffer, indent + " ", "", + (CompositeData)obj); + } else if (obj instanceof TabularData) { + recurseTabularData(buffer, indent, "", + (TabularData)obj); + } else { + buffer.append(obj); + } + } + return buffer; + } + + protected StringBuffer recurseCompositeData(StringBuffer buffer, + String indent, String name, CompositeData data) { + indent = addNameToBuffer(buffer, indent, name); + for (Iterator i = data.getCompositeType().keySet().iterator(); + i.hasNext();) { + String key = (String)i.next(); + Object o = data.get(key); + if (o instanceof CompositeData) { + recurseCompositeData(buffer, indent + " ", key, + (CompositeData)o); + } else if (o instanceof TabularData) { + recurseTabularData(buffer, indent, key, (TabularData)o); + } else { + buffer.append(indent); + buffer.append(key); + buffer.append(": "); + buffer.append(o); + buffer.append("\n"); + } + } + return buffer; + } + + protected String addNameToBuffer(StringBuffer buffer, String indent, + String name) { + if (name == null || name.length() == 0) { + return indent; + } + buffer.append(indent); + buffer.append(name); + buffer.append(":\n"); + // Move all that comes under this 'name' over by one space. + return indent + " "; + } + + /** + * Class that parses commandline arguments. + * Expected format is 'operationName=arg0,arg1,arg2...'. We are assuming no + * spaces nor comma's in argument values. + */ + protected class CommandParse { + private String cmd; + private String [] args; + + protected CommandParse(String command) throws ParseException { + parse(command); + } + + private void parse(String command) throws ParseException { + Matcher m = CMD_LINE_ARGS_PATTERN.matcher(command); + if (m == null || !m.matches()) { + throw new ParseException("Failed parse of " + command, 0); + } + + this.cmd = m.group(1); + if (m.group(2) != null && m.group(2).length() > 0) { + this.args = m.group(2).split(","); + } else { + this.args = null; + } + } + + protected String getCmd() { + return this.cmd; + } + + protected String [] getArgs() { + return this.args; + } + } + + protected Object doAttributeOperation(MBeanServerConnection mbsc, + ObjectInstance instance, String command, MBeanAttributeInfo [] infos) + throws Exception { + // Usually we get attributes. If an argument, then we're being asked + // to set attribute. + CommandParse parse = new CommandParse(command); + if (parse.getArgs() == null || parse.getArgs().length == 0) { + // Special-casing. If the subCommand is 'Attributes', then return + // list of all attributes. + if (command.equals("Attributes")) { + String [] names = new String[infos.length]; + for (int i = 0; i < infos.length; i++) { + names[i] = infos[i].getName(); + } + return mbsc.getAttributes(instance.getObjectName(), names); + } + return mbsc.getAttribute(instance.getObjectName(), parse.getCmd()); + } + if (parse.getArgs().length != 1) { + throw new IllegalArgumentException("One only argument setting " + + "attribute values: " + parse.getArgs()); + } + // Get first attribute of name 'cmd'. Assumption is no method + // overrides. Then, look at the attribute and use its type. + MBeanAttributeInfo info = + (MBeanAttributeInfo)getFeatureInfo(infos, parse.getCmd()); + java.lang.reflect.Constructor c = Class.forName( + info.getType()).getConstructor(new Class[] {String.class}); + Attribute a = new Attribute(parse.getCmd(), + c.newInstance(new Object[] {parse.getArgs()[0]})); + mbsc.setAttribute(instance.getObjectName(), a); + return null; + } + + protected Object doBeanOperation(MBeanServerConnection mbsc, + ObjectInstance instance, String command, MBeanOperationInfo [] infos) + throws Exception { + // Parse command line. + CommandParse parse = new CommandParse(command); + + // Get first method of name 'cmd'. Assumption is no method + // overrides. Then, look at the method and use its signature + // to make sure client sends over parameters of the correct type. + MBeanOperationInfo op = + (MBeanOperationInfo)getFeatureInfo(infos, parse.getCmd()); + Object result = null; + if (op == null) { + result = "Operation " + parse.getCmd() + " not found."; + } else { + MBeanParameterInfo [] paraminfos = op.getSignature(); + int paraminfosLength = (paraminfos == null)? 0: paraminfos.length; + int objsLength = (parse.getArgs() == null)? + 0: parse.getArgs().length; + if (paraminfosLength != objsLength) { + result = "Passed param count does not match signature count"; + } else { + String [] signature = new String[paraminfosLength]; + Object [] params = (paraminfosLength == 0)? null + : new Object[paraminfosLength]; + for (int i = 0; i < paraminfosLength; i++) { + MBeanParameterInfo paraminfo = paraminfos[i]; + java.lang.reflect.Constructor c = Class.forName( + paraminfo.getType()).getConstructor( + new Class[] {String.class}); + params[i] = + c.newInstance(new Object[] {parse.getArgs()[i]}); + signature[i] = paraminfo.getType(); + } + result = mbsc.invoke(instance.getObjectName(), parse.getCmd(), + params, signature); + } + } + return result; + } + + protected String listOptions(MBeanServerConnection mbsc, + ObjectInstance instance) + throws InstanceNotFoundException, IntrospectionException, + ReflectionException, IOException { + StringBuffer result = new StringBuffer(); + MBeanInfo info = mbsc.getMBeanInfo(instance.getObjectName()); + MBeanAttributeInfo [] attributes = info.getAttributes(); + if (attributes.length > 0) { + result.append("Attributes:"); + result.append("\n"); + for (int i = 0; i < attributes.length; i++) { + result.append(' ' + attributes[i].getName() + + ": " + attributes[i].getDescription() + + " (type=" + attributes[i].getType() + + ")"); + result.append("\n"); + } + } + MBeanOperationInfo [] operations = info.getOperations(); + if (operations.length > 0) { + result.append("Operations:"); + result.append("\n"); + for (int i = 0; i < operations.length; i++) { + MBeanParameterInfo [] params = operations[i].getSignature(); + StringBuffer paramsStrBuffer = new StringBuffer(); + if (params != null) { + for (int j = 0; j < params.length; j++) { + paramsStrBuffer.append("\n name="); + paramsStrBuffer.append(params[j].getName()); + paramsStrBuffer.append(" type="); + paramsStrBuffer.append(params[j].getType()); + paramsStrBuffer.append(" "); + paramsStrBuffer.append(params[j].getDescription()); + } + } + result.append(' ' + operations[i].getName() + + ": " + operations[i].getDescription() + + "\n Parameters " + params.length + + ", return type=" + operations[i].getReturnType() + + paramsStrBuffer.toString()); + result.append("\n"); + } + } + return result.toString(); + } + + /** + * Logger that writes entry on one line with less verbose date. + * Modelled on the OneLineSimpleLogger from Heritrix. + * + * @author stack + * @version $Revision$, $Date$ + */ + private class OneLineSimpleLogger extends SimpleFormatter { + /** + * Date instance. + * + * Keep around instance of date. + */ + private Date date = new Date(); + + /** + * Field position instance. + * + * Keep around this instance. + */ + private FieldPosition position = new FieldPosition(0); + + /** + * MessageFormatter for date. + */ + private SimpleDateFormat formatter = + new SimpleDateFormat("MM/dd/yyyy HH:mm:ss Z"); + + /** + * Persistent buffer in which we conjure the log. + */ + private StringBuffer buffer = new StringBuffer(); + + + public OneLineSimpleLogger() { + super(); + } + + public synchronized String format(LogRecord record) { + this.buffer.setLength(0); + this.date.setTime(record.getMillis()); + this.position.setBeginIndex(0); + this.formatter.format(this.date, this.buffer, this.position); + this.buffer.append(' '); + if (record.getSourceClassName() != null) { + this.buffer.append(record.getSourceClassName()); + } else { + this.buffer.append(record.getLoggerName()); + } + this.buffer.append(' '); + this.buffer.append(formatMessage(record)); + this.buffer.append(System.getProperty("line.separator")); + if (record.getThrown() != null) { + try { + StringWriter writer = new StringWriter(); + PrintWriter printer = new PrintWriter(writer); + record.getThrown().printStackTrace(printer); + writer.close(); + this.buffer.append(writer.toString()); + } catch (Exception e) { + this.buffer.append("Failed to get stack trace: " + + e.getMessage()); + } + } + return this.buffer.toString(); + } + } +} \ No newline at end of file diff --git a/akka-remote/src/main/java/akka/remote/RemoteProtocol.java b/akka-remote/src/main/java/akka/remote/RemoteProtocol.java index 21074a44c0..0794e54364 100644 --- a/akka-remote/src/main/java/akka/remote/RemoteProtocol.java +++ b/akka-remote/src/main/java/akka/remote/RemoteProtocol.java @@ -4172,115 +4172,166 @@ public final class RemoteProtocol { // @@protoc_insertion_point(class_scope:AddressProtocol) } - public interface DurableMailboxMessageProtocolOrBuilder + public interface DaemonMsgCreateProtocolOrBuilder extends com.google.protobuf.MessageOrBuilder { - // required .ActorRefProtocol recipient = 1; - boolean hasRecipient(); - akka.remote.RemoteProtocol.ActorRefProtocol getRecipient(); - akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getRecipientOrBuilder(); + // required .PropsProtocol props = 1; + boolean hasProps(); + akka.remote.RemoteProtocol.PropsProtocol getProps(); + akka.remote.RemoteProtocol.PropsProtocolOrBuilder getPropsOrBuilder(); - // optional .ActorRefProtocol sender = 2; - boolean hasSender(); - akka.remote.RemoteProtocol.ActorRefProtocol getSender(); - akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSenderOrBuilder(); + // required .DeployProtocol deploy = 2; + boolean hasDeploy(); + akka.remote.RemoteProtocol.DeployProtocol getDeploy(); + akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder(); - // required bytes message = 3; - boolean hasMessage(); - com.google.protobuf.ByteString getMessage(); + // required string path = 3; + boolean hasPath(); + String getPath(); + + // required .ActorRefProtocol supervisor = 4; + boolean hasSupervisor(); + akka.remote.RemoteProtocol.ActorRefProtocol getSupervisor(); + akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSupervisorOrBuilder(); } - public static final class DurableMailboxMessageProtocol extends + public static final class DaemonMsgCreateProtocol extends com.google.protobuf.GeneratedMessage - implements DurableMailboxMessageProtocolOrBuilder { - // Use DurableMailboxMessageProtocol.newBuilder() to construct. - private DurableMailboxMessageProtocol(Builder builder) { + implements DaemonMsgCreateProtocolOrBuilder { + // Use DaemonMsgCreateProtocol.newBuilder() to construct. + private DaemonMsgCreateProtocol(Builder builder) { super(builder); } - private DurableMailboxMessageProtocol(boolean noInit) {} + private DaemonMsgCreateProtocol(boolean noInit) {} - private static final DurableMailboxMessageProtocol defaultInstance; - public static DurableMailboxMessageProtocol getDefaultInstance() { + private static final DaemonMsgCreateProtocol defaultInstance; + public static DaemonMsgCreateProtocol getDefaultInstance() { return defaultInstance; } - public DurableMailboxMessageProtocol getDefaultInstanceForType() { + public DaemonMsgCreateProtocol getDefaultInstanceForType() { return defaultInstance; } public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return akka.remote.RemoteProtocol.internal_static_DurableMailboxMessageProtocol_descriptor; + return akka.remote.RemoteProtocol.internal_static_DaemonMsgCreateProtocol_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return akka.remote.RemoteProtocol.internal_static_DurableMailboxMessageProtocol_fieldAccessorTable; + return akka.remote.RemoteProtocol.internal_static_DaemonMsgCreateProtocol_fieldAccessorTable; } private int bitField0_; - // required .ActorRefProtocol recipient = 1; - public static final int RECIPIENT_FIELD_NUMBER = 1; - private akka.remote.RemoteProtocol.ActorRefProtocol recipient_; - public boolean hasRecipient() { + // required .PropsProtocol props = 1; + public static final int PROPS_FIELD_NUMBER = 1; + private akka.remote.RemoteProtocol.PropsProtocol props_; + public boolean hasProps() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public akka.remote.RemoteProtocol.ActorRefProtocol getRecipient() { - return recipient_; + public akka.remote.RemoteProtocol.PropsProtocol getProps() { + return props_; } - public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getRecipientOrBuilder() { - return recipient_; + public akka.remote.RemoteProtocol.PropsProtocolOrBuilder getPropsOrBuilder() { + return props_; } - // optional .ActorRefProtocol sender = 2; - public static final int SENDER_FIELD_NUMBER = 2; - private akka.remote.RemoteProtocol.ActorRefProtocol sender_; - public boolean hasSender() { + // required .DeployProtocol deploy = 2; + public static final int DEPLOY_FIELD_NUMBER = 2; + private akka.remote.RemoteProtocol.DeployProtocol deploy_; + public boolean hasDeploy() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public akka.remote.RemoteProtocol.ActorRefProtocol getSender() { - return sender_; + public akka.remote.RemoteProtocol.DeployProtocol getDeploy() { + return deploy_; } - public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSenderOrBuilder() { - return sender_; + public akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder() { + return deploy_; } - // required bytes message = 3; - public static final int MESSAGE_FIELD_NUMBER = 3; - private com.google.protobuf.ByteString message_; - public boolean hasMessage() { + // required string path = 3; + public static final int PATH_FIELD_NUMBER = 3; + private java.lang.Object path_; + public boolean hasPath() { return ((bitField0_ & 0x00000004) == 0x00000004); } - public com.google.protobuf.ByteString getMessage() { - return message_; + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .ActorRefProtocol supervisor = 4; + public static final int SUPERVISOR_FIELD_NUMBER = 4; + private akka.remote.RemoteProtocol.ActorRefProtocol supervisor_; + public boolean hasSupervisor() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public akka.remote.RemoteProtocol.ActorRefProtocol getSupervisor() { + return supervisor_; + } + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSupervisorOrBuilder() { + return supervisor_; } private void initFields() { - recipient_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); - sender_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); - message_ = com.google.protobuf.ByteString.EMPTY; + props_ = akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance(); + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + path_ = ""; + supervisor_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); } private byte memoizedIsInitialized = -1; public final boolean isInitialized() { byte isInitialized = memoizedIsInitialized; if (isInitialized != -1) return isInitialized == 1; - if (!hasRecipient()) { + if (!hasProps()) { memoizedIsInitialized = 0; return false; } - if (!hasMessage()) { + if (!hasDeploy()) { memoizedIsInitialized = 0; return false; } - if (!getRecipient().isInitialized()) { + if (!hasPath()) { memoizedIsInitialized = 0; return false; } - if (hasSender()) { - if (!getSender().isInitialized()) { - memoizedIsInitialized = 0; - return false; - } + if (!hasSupervisor()) { + memoizedIsInitialized = 0; + return false; + } + if (!getProps().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (!getDeploy().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (!getSupervisor().isInitialized()) { + memoizedIsInitialized = 0; + return false; } memoizedIsInitialized = 1; return true; @@ -4290,13 +4341,16 @@ public final class RemoteProtocol { throws java.io.IOException { getSerializedSize(); if (((bitField0_ & 0x00000001) == 0x00000001)) { - output.writeMessage(1, recipient_); + output.writeMessage(1, props_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { - output.writeMessage(2, sender_); + output.writeMessage(2, deploy_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { - output.writeBytes(3, message_); + output.writeBytes(3, getPathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeMessage(4, supervisor_); } getUnknownFields().writeTo(output); } @@ -4309,15 +4363,19 @@ public final class RemoteProtocol { size = 0; if (((bitField0_ & 0x00000001) == 0x00000001)) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(1, recipient_); + .computeMessageSize(1, props_); } if (((bitField0_ & 0x00000002) == 0x00000002)) { size += com.google.protobuf.CodedOutputStream - .computeMessageSize(2, sender_); + .computeMessageSize(2, deploy_); } if (((bitField0_ & 0x00000004) == 0x00000004)) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(3, message_); + .computeBytesSize(3, getPathBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, supervisor_); } size += getUnknownFields().getSerializedSize(); memoizedSerializedSize = size; @@ -4331,41 +4389,41 @@ public final class RemoteProtocol { return super.writeReplace(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( com.google.protobuf.ByteString data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( com.google.protobuf.ByteString data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom(byte[] data) + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom(byte[] data) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data).buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( byte[] data, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws com.google.protobuf.InvalidProtocolBufferException { return newBuilder().mergeFrom(data, extensionRegistry) .buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom(java.io.InputStream input) + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom(java.io.InputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { return newBuilder().mergeFrom(input, extensionRegistry) .buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseDelimitedFrom(java.io.InputStream input) + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseDelimitedFrom(java.io.InputStream input) throws java.io.IOException { Builder builder = newBuilder(); if (builder.mergeDelimitedFrom(input)) { @@ -4374,7 +4432,7 @@ public final class RemoteProtocol { return null; } } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseDelimitedFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseDelimitedFrom( java.io.InputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -4385,12 +4443,12 @@ public final class RemoteProtocol { return null; } } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( com.google.protobuf.CodedInputStream input) throws java.io.IOException { return newBuilder().mergeFrom(input).buildParsed(); } - public static akka.remote.RemoteProtocol.DurableMailboxMessageProtocol parseFrom( + public static akka.remote.RemoteProtocol.DaemonMsgCreateProtocol parseFrom( com.google.protobuf.CodedInputStream input, com.google.protobuf.ExtensionRegistryLite extensionRegistry) throws java.io.IOException { @@ -4400,7 +4458,7 @@ public final class RemoteProtocol { public static Builder newBuilder() { return Builder.create(); } public Builder newBuilderForType() { return newBuilder(); } - public static Builder newBuilder(akka.remote.RemoteProtocol.DurableMailboxMessageProtocol prototype) { + public static Builder newBuilder(akka.remote.RemoteProtocol.DaemonMsgCreateProtocol prototype) { return newBuilder().mergeFrom(prototype); } public Builder toBuilder() { return newBuilder(this); } @@ -4413,18 +4471,18 @@ public final class RemoteProtocol { } public static final class Builder extends com.google.protobuf.GeneratedMessage.Builder - implements akka.remote.RemoteProtocol.DurableMailboxMessageProtocolOrBuilder { + implements akka.remote.RemoteProtocol.DaemonMsgCreateProtocolOrBuilder { public static final com.google.protobuf.Descriptors.Descriptor getDescriptor() { - return akka.remote.RemoteProtocol.internal_static_DurableMailboxMessageProtocol_descriptor; + return akka.remote.RemoteProtocol.internal_static_DaemonMsgCreateProtocol_descriptor; } protected com.google.protobuf.GeneratedMessage.FieldAccessorTable internalGetFieldAccessorTable() { - return akka.remote.RemoteProtocol.internal_static_DurableMailboxMessageProtocol_fieldAccessorTable; + return akka.remote.RemoteProtocol.internal_static_DaemonMsgCreateProtocol_fieldAccessorTable; } - // Construct using akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.newBuilder() + // Construct using akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.newBuilder() private Builder() { maybeForceBuilderInitialization(); } @@ -4435,8 +4493,9 @@ public final class RemoteProtocol { } private void maybeForceBuilderInitialization() { if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { - getRecipientFieldBuilder(); - getSenderFieldBuilder(); + getPropsFieldBuilder(); + getDeployFieldBuilder(); + getSupervisorFieldBuilder(); } } private static Builder create() { @@ -4445,20 +4504,26 @@ public final class RemoteProtocol { public Builder clear() { super.clear(); - if (recipientBuilder_ == null) { - recipient_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + if (propsBuilder_ == null) { + props_ = akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance(); } else { - recipientBuilder_.clear(); + propsBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); - if (senderBuilder_ == null) { - sender_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + if (deployBuilder_ == null) { + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); } else { - senderBuilder_.clear(); + deployBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); - message_ = com.google.protobuf.ByteString.EMPTY; + path_ = ""; bitField0_ = (bitField0_ & ~0x00000004); + if (supervisorBuilder_ == null) { + supervisor_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + } else { + supervisorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); return this; } @@ -4468,24 +4533,24 @@ public final class RemoteProtocol { public com.google.protobuf.Descriptors.Descriptor getDescriptorForType() { - return akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.getDescriptor(); + return akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.getDescriptor(); } - public akka.remote.RemoteProtocol.DurableMailboxMessageProtocol getDefaultInstanceForType() { - return akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.getDefaultInstance(); + public akka.remote.RemoteProtocol.DaemonMsgCreateProtocol getDefaultInstanceForType() { + return akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.getDefaultInstance(); } - public akka.remote.RemoteProtocol.DurableMailboxMessageProtocol build() { - akka.remote.RemoteProtocol.DurableMailboxMessageProtocol result = buildPartial(); + public akka.remote.RemoteProtocol.DaemonMsgCreateProtocol build() { + akka.remote.RemoteProtocol.DaemonMsgCreateProtocol result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException(result); } return result; } - private akka.remote.RemoteProtocol.DurableMailboxMessageProtocol buildParsed() + private akka.remote.RemoteProtocol.DaemonMsgCreateProtocol buildParsed() throws com.google.protobuf.InvalidProtocolBufferException { - akka.remote.RemoteProtocol.DurableMailboxMessageProtocol result = buildPartial(); + akka.remote.RemoteProtocol.DaemonMsgCreateProtocol result = buildPartial(); if (!result.isInitialized()) { throw newUninitializedMessageException( result).asInvalidProtocolBufferException(); @@ -4493,78 +4558,2157 @@ public final class RemoteProtocol { return result; } - public akka.remote.RemoteProtocol.DurableMailboxMessageProtocol buildPartial() { - akka.remote.RemoteProtocol.DurableMailboxMessageProtocol result = new akka.remote.RemoteProtocol.DurableMailboxMessageProtocol(this); + public akka.remote.RemoteProtocol.DaemonMsgCreateProtocol buildPartial() { + akka.remote.RemoteProtocol.DaemonMsgCreateProtocol result = new akka.remote.RemoteProtocol.DaemonMsgCreateProtocol(this); int from_bitField0_ = bitField0_; int to_bitField0_ = 0; if (((from_bitField0_ & 0x00000001) == 0x00000001)) { to_bitField0_ |= 0x00000001; } - if (recipientBuilder_ == null) { - result.recipient_ = recipient_; + if (propsBuilder_ == null) { + result.props_ = props_; } else { - result.recipient_ = recipientBuilder_.build(); + result.props_ = propsBuilder_.build(); } if (((from_bitField0_ & 0x00000002) == 0x00000002)) { to_bitField0_ |= 0x00000002; } - if (senderBuilder_ == null) { - result.sender_ = sender_; + if (deployBuilder_ == null) { + result.deploy_ = deploy_; } else { - result.sender_ = senderBuilder_.build(); + result.deploy_ = deployBuilder_.build(); } if (((from_bitField0_ & 0x00000004) == 0x00000004)) { to_bitField0_ |= 0x00000004; } - result.message_ = message_; + result.path_ = path_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + if (supervisorBuilder_ == null) { + result.supervisor_ = supervisor_; + } else { + result.supervisor_ = supervisorBuilder_.build(); + } result.bitField0_ = to_bitField0_; onBuilt(); return result; } public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof akka.remote.RemoteProtocol.DurableMailboxMessageProtocol) { - return mergeFrom((akka.remote.RemoteProtocol.DurableMailboxMessageProtocol)other); + if (other instanceof akka.remote.RemoteProtocol.DaemonMsgCreateProtocol) { + return mergeFrom((akka.remote.RemoteProtocol.DaemonMsgCreateProtocol)other); } else { super.mergeFrom(other); return this; } } - public Builder mergeFrom(akka.remote.RemoteProtocol.DurableMailboxMessageProtocol other) { - if (other == akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.getDefaultInstance()) return this; - if (other.hasRecipient()) { - mergeRecipient(other.getRecipient()); + public Builder mergeFrom(akka.remote.RemoteProtocol.DaemonMsgCreateProtocol other) { + if (other == akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.getDefaultInstance()) return this; + if (other.hasProps()) { + mergeProps(other.getProps()); } - if (other.hasSender()) { - mergeSender(other.getSender()); + if (other.hasDeploy()) { + mergeDeploy(other.getDeploy()); } - if (other.hasMessage()) { - setMessage(other.getMessage()); + if (other.hasPath()) { + setPath(other.getPath()); + } + if (other.hasSupervisor()) { + mergeSupervisor(other.getSupervisor()); } this.mergeUnknownFields(other.getUnknownFields()); return this; } public final boolean isInitialized() { - if (!hasRecipient()) { + if (!hasProps()) { return false; } - if (!hasMessage()) { + if (!hasDeploy()) { return false; } - if (!getRecipient().isInitialized()) { + if (!hasPath()) { return false; } - if (hasSender()) { - if (!getSender().isInitialized()) { - - return false; + if (!hasSupervisor()) { + + return false; + } + if (!getProps().isInitialized()) { + + return false; + } + if (!getDeploy().isInitialized()) { + + return false; + } + if (!getSupervisor().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + akka.remote.RemoteProtocol.PropsProtocol.Builder subBuilder = akka.remote.RemoteProtocol.PropsProtocol.newBuilder(); + if (hasProps()) { + subBuilder.mergeFrom(getProps()); + } + input.readMessage(subBuilder, extensionRegistry); + setProps(subBuilder.buildPartial()); + break; + } + case 18: { + akka.remote.RemoteProtocol.DeployProtocol.Builder subBuilder = akka.remote.RemoteProtocol.DeployProtocol.newBuilder(); + if (hasDeploy()) { + subBuilder.mergeFrom(getDeploy()); + } + input.readMessage(subBuilder, extensionRegistry); + setDeploy(subBuilder.buildPartial()); + break; + } + case 26: { + bitField0_ |= 0x00000004; + path_ = input.readBytes(); + break; + } + case 34: { + akka.remote.RemoteProtocol.ActorRefProtocol.Builder subBuilder = akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(); + if (hasSupervisor()) { + subBuilder.mergeFrom(getSupervisor()); + } + input.readMessage(subBuilder, extensionRegistry); + setSupervisor(subBuilder.buildPartial()); + break; + } } } + } + + private int bitField0_; + + // required .PropsProtocol props = 1; + private akka.remote.RemoteProtocol.PropsProtocol props_ = akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.PropsProtocol, akka.remote.RemoteProtocol.PropsProtocol.Builder, akka.remote.RemoteProtocol.PropsProtocolOrBuilder> propsBuilder_; + public boolean hasProps() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public akka.remote.RemoteProtocol.PropsProtocol getProps() { + if (propsBuilder_ == null) { + return props_; + } else { + return propsBuilder_.getMessage(); + } + } + public Builder setProps(akka.remote.RemoteProtocol.PropsProtocol value) { + if (propsBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + props_ = value; + onChanged(); + } else { + propsBuilder_.setMessage(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder setProps( + akka.remote.RemoteProtocol.PropsProtocol.Builder builderForValue) { + if (propsBuilder_ == null) { + props_ = builderForValue.build(); + onChanged(); + } else { + propsBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder mergeProps(akka.remote.RemoteProtocol.PropsProtocol value) { + if (propsBuilder_ == null) { + if (((bitField0_ & 0x00000001) == 0x00000001) && + props_ != akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance()) { + props_ = + akka.remote.RemoteProtocol.PropsProtocol.newBuilder(props_).mergeFrom(value).buildPartial(); + } else { + props_ = value; + } + onChanged(); + } else { + propsBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000001; + return this; + } + public Builder clearProps() { + if (propsBuilder_ == null) { + props_ = akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance(); + onChanged(); + } else { + propsBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + return this; + } + public akka.remote.RemoteProtocol.PropsProtocol.Builder getPropsBuilder() { + bitField0_ |= 0x00000001; + onChanged(); + return getPropsFieldBuilder().getBuilder(); + } + public akka.remote.RemoteProtocol.PropsProtocolOrBuilder getPropsOrBuilder() { + if (propsBuilder_ != null) { + return propsBuilder_.getMessageOrBuilder(); + } else { + return props_; + } + } + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.PropsProtocol, akka.remote.RemoteProtocol.PropsProtocol.Builder, akka.remote.RemoteProtocol.PropsProtocolOrBuilder> + getPropsFieldBuilder() { + if (propsBuilder_ == null) { + propsBuilder_ = new com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.PropsProtocol, akka.remote.RemoteProtocol.PropsProtocol.Builder, akka.remote.RemoteProtocol.PropsProtocolOrBuilder>( + props_, + getParentForChildren(), + isClean()); + props_ = null; + } + return propsBuilder_; + } + + // required .DeployProtocol deploy = 2; + private akka.remote.RemoteProtocol.DeployProtocol deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder> deployBuilder_; + public boolean hasDeploy() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public akka.remote.RemoteProtocol.DeployProtocol getDeploy() { + if (deployBuilder_ == null) { + return deploy_; + } else { + return deployBuilder_.getMessage(); + } + } + public Builder setDeploy(akka.remote.RemoteProtocol.DeployProtocol value) { + if (deployBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deploy_ = value; + onChanged(); + } else { + deployBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setDeploy( + akka.remote.RemoteProtocol.DeployProtocol.Builder builderForValue) { + if (deployBuilder_ == null) { + deploy_ = builderForValue.build(); + onChanged(); + } else { + deployBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeDeploy(akka.remote.RemoteProtocol.DeployProtocol value) { + if (deployBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + deploy_ != akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance()) { + deploy_ = + akka.remote.RemoteProtocol.DeployProtocol.newBuilder(deploy_).mergeFrom(value).buildPartial(); + } else { + deploy_ = value; + } + onChanged(); + } else { + deployBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearDeploy() { + if (deployBuilder_ == null) { + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + onChanged(); + } else { + deployBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public akka.remote.RemoteProtocol.DeployProtocol.Builder getDeployBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getDeployFieldBuilder().getBuilder(); + } + public akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder() { + if (deployBuilder_ != null) { + return deployBuilder_.getMessageOrBuilder(); + } else { + return deploy_; + } + } + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder> + getDeployFieldBuilder() { + if (deployBuilder_ == null) { + deployBuilder_ = new com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder>( + deploy_, + getParentForChildren(), + isClean()); + deploy_ = null; + } + return deployBuilder_; + } + + // required string path = 3; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000004); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + path_ = value; + onChanged(); + } + + // required .ActorRefProtocol supervisor = 4; + private akka.remote.RemoteProtocol.ActorRefProtocol supervisor_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> supervisorBuilder_; + public boolean hasSupervisor() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public akka.remote.RemoteProtocol.ActorRefProtocol getSupervisor() { + if (supervisorBuilder_ == null) { + return supervisor_; + } else { + return supervisorBuilder_.getMessage(); + } + } + public Builder setSupervisor(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (supervisorBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + supervisor_ = value; + onChanged(); + } else { + supervisorBuilder_.setMessage(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder setSupervisor( + akka.remote.RemoteProtocol.ActorRefProtocol.Builder builderForValue) { + if (supervisorBuilder_ == null) { + supervisor_ = builderForValue.build(); + onChanged(); + } else { + supervisorBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder mergeSupervisor(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (supervisorBuilder_ == null) { + if (((bitField0_ & 0x00000008) == 0x00000008) && + supervisor_ != akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) { + supervisor_ = + akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(supervisor_).mergeFrom(value).buildPartial(); + } else { + supervisor_ = value; + } + onChanged(); + } else { + supervisorBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000008; + return this; + } + public Builder clearSupervisor() { + if (supervisorBuilder_ == null) { + supervisor_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + onChanged(); + } else { + supervisorBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + public akka.remote.RemoteProtocol.ActorRefProtocol.Builder getSupervisorBuilder() { + bitField0_ |= 0x00000008; + onChanged(); + return getSupervisorFieldBuilder().getBuilder(); + } + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSupervisorOrBuilder() { + if (supervisorBuilder_ != null) { + return supervisorBuilder_.getMessageOrBuilder(); + } else { + return supervisor_; + } + } + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> + getSupervisorFieldBuilder() { + if (supervisorBuilder_ == null) { + supervisorBuilder_ = new com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder>( + supervisor_, + getParentForChildren(), + isClean()); + supervisor_ = null; + } + return supervisorBuilder_; + } + + // @@protoc_insertion_point(builder_scope:DaemonMsgCreateProtocol) + } + + static { + defaultInstance = new DaemonMsgCreateProtocol(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:DaemonMsgCreateProtocol) + } + + public interface PropsProtocolOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string dispatcher = 1; + boolean hasDispatcher(); + String getDispatcher(); + + // required .DeployProtocol deploy = 2; + boolean hasDeploy(); + akka.remote.RemoteProtocol.DeployProtocol getDeploy(); + akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder(); + + // optional string fromClassCreator = 3; + boolean hasFromClassCreator(); + String getFromClassCreator(); + + // optional bytes creator = 4; + boolean hasCreator(); + com.google.protobuf.ByteString getCreator(); + + // optional bytes routerConfig = 5; + boolean hasRouterConfig(); + com.google.protobuf.ByteString getRouterConfig(); + } + public static final class PropsProtocol extends + com.google.protobuf.GeneratedMessage + implements PropsProtocolOrBuilder { + // Use PropsProtocol.newBuilder() to construct. + private PropsProtocol(Builder builder) { + super(builder); + } + private PropsProtocol(boolean noInit) {} + + private static final PropsProtocol defaultInstance; + public static PropsProtocol getDefaultInstance() { + return defaultInstance; + } + + public PropsProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_PropsProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_PropsProtocol_fieldAccessorTable; + } + + private int bitField0_; + // required string dispatcher = 1; + public static final int DISPATCHER_FIELD_NUMBER = 1; + private java.lang.Object dispatcher_; + public boolean hasDispatcher() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getDispatcher() { + java.lang.Object ref = dispatcher_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + dispatcher_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getDispatcherBytes() { + java.lang.Object ref = dispatcher_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + dispatcher_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // required .DeployProtocol deploy = 2; + public static final int DEPLOY_FIELD_NUMBER = 2; + private akka.remote.RemoteProtocol.DeployProtocol deploy_; + public boolean hasDeploy() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public akka.remote.RemoteProtocol.DeployProtocol getDeploy() { + return deploy_; + } + public akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder() { + return deploy_; + } + + // optional string fromClassCreator = 3; + public static final int FROMCLASSCREATOR_FIELD_NUMBER = 3; + private java.lang.Object fromClassCreator_; + public boolean hasFromClassCreator() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getFromClassCreator() { + java.lang.Object ref = fromClassCreator_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + fromClassCreator_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getFromClassCreatorBytes() { + java.lang.Object ref = fromClassCreator_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + fromClassCreator_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes creator = 4; + public static final int CREATOR_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString creator_; + public boolean hasCreator() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getCreator() { + return creator_; + } + + // optional bytes routerConfig = 5; + public static final int ROUTERCONFIG_FIELD_NUMBER = 5; + private com.google.protobuf.ByteString routerConfig_; + public boolean hasRouterConfig() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.google.protobuf.ByteString getRouterConfig() { + return routerConfig_; + } + + private void initFields() { + dispatcher_ = ""; + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + fromClassCreator_ = ""; + creator_ = com.google.protobuf.ByteString.EMPTY; + routerConfig_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasDispatcher()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasDeploy()) { + memoizedIsInitialized = 0; + return false; + } + if (!getDeploy().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getDispatcherBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, deploy_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, getFromClassCreatorBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, creator_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + output.writeBytes(5, routerConfig_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getDispatcherBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, deploy_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, getFromClassCreatorBytes()); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, creator_); + } + if (((bitField0_ & 0x00000010) == 0x00000010)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(5, routerConfig_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.PropsProtocol parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.PropsProtocol parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(akka.remote.RemoteProtocol.PropsProtocol prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements akka.remote.RemoteProtocol.PropsProtocolOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_PropsProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_PropsProtocol_fieldAccessorTable; + } + + // Construct using akka.remote.RemoteProtocol.PropsProtocol.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getDeployFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + dispatcher_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + if (deployBuilder_ == null) { + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + } else { + deployBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + fromClassCreator_ = ""; + bitField0_ = (bitField0_ & ~0x00000004); + creator_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + routerConfig_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000010); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return akka.remote.RemoteProtocol.PropsProtocol.getDescriptor(); + } + + public akka.remote.RemoteProtocol.PropsProtocol getDefaultInstanceForType() { + return akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance(); + } + + public akka.remote.RemoteProtocol.PropsProtocol build() { + akka.remote.RemoteProtocol.PropsProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private akka.remote.RemoteProtocol.PropsProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + akka.remote.RemoteProtocol.PropsProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public akka.remote.RemoteProtocol.PropsProtocol buildPartial() { + akka.remote.RemoteProtocol.PropsProtocol result = new akka.remote.RemoteProtocol.PropsProtocol(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.dispatcher_ = dispatcher_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (deployBuilder_ == null) { + result.deploy_ = deploy_; + } else { + result.deploy_ = deployBuilder_.build(); + } + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.fromClassCreator_ = fromClassCreator_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.creator_ = creator_; + if (((from_bitField0_ & 0x00000010) == 0x00000010)) { + to_bitField0_ |= 0x00000010; + } + result.routerConfig_ = routerConfig_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof akka.remote.RemoteProtocol.PropsProtocol) { + return mergeFrom((akka.remote.RemoteProtocol.PropsProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.remote.RemoteProtocol.PropsProtocol other) { + if (other == akka.remote.RemoteProtocol.PropsProtocol.getDefaultInstance()) return this; + if (other.hasDispatcher()) { + setDispatcher(other.getDispatcher()); + } + if (other.hasDeploy()) { + mergeDeploy(other.getDeploy()); + } + if (other.hasFromClassCreator()) { + setFromClassCreator(other.getFromClassCreator()); + } + if (other.hasCreator()) { + setCreator(other.getCreator()); + } + if (other.hasRouterConfig()) { + setRouterConfig(other.getRouterConfig()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasDispatcher()) { + + return false; + } + if (!hasDeploy()) { + + return false; + } + if (!getDeploy().isInitialized()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + dispatcher_ = input.readBytes(); + break; + } + case 18: { + akka.remote.RemoteProtocol.DeployProtocol.Builder subBuilder = akka.remote.RemoteProtocol.DeployProtocol.newBuilder(); + if (hasDeploy()) { + subBuilder.mergeFrom(getDeploy()); + } + input.readMessage(subBuilder, extensionRegistry); + setDeploy(subBuilder.buildPartial()); + break; + } + case 26: { + bitField0_ |= 0x00000004; + fromClassCreator_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + creator_ = input.readBytes(); + break; + } + case 42: { + bitField0_ |= 0x00000010; + routerConfig_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string dispatcher = 1; + private java.lang.Object dispatcher_ = ""; + public boolean hasDispatcher() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getDispatcher() { + java.lang.Object ref = dispatcher_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + dispatcher_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setDispatcher(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + dispatcher_ = value; + onChanged(); + return this; + } + public Builder clearDispatcher() { + bitField0_ = (bitField0_ & ~0x00000001); + dispatcher_ = getDefaultInstance().getDispatcher(); + onChanged(); + return this; + } + void setDispatcher(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + dispatcher_ = value; + onChanged(); + } + + // required .DeployProtocol deploy = 2; + private akka.remote.RemoteProtocol.DeployProtocol deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder> deployBuilder_; + public boolean hasDeploy() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public akka.remote.RemoteProtocol.DeployProtocol getDeploy() { + if (deployBuilder_ == null) { + return deploy_; + } else { + return deployBuilder_.getMessage(); + } + } + public Builder setDeploy(akka.remote.RemoteProtocol.DeployProtocol value) { + if (deployBuilder_ == null) { + if (value == null) { + throw new NullPointerException(); + } + deploy_ = value; + onChanged(); + } else { + deployBuilder_.setMessage(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder setDeploy( + akka.remote.RemoteProtocol.DeployProtocol.Builder builderForValue) { + if (deployBuilder_ == null) { + deploy_ = builderForValue.build(); + onChanged(); + } else { + deployBuilder_.setMessage(builderForValue.build()); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder mergeDeploy(akka.remote.RemoteProtocol.DeployProtocol value) { + if (deployBuilder_ == null) { + if (((bitField0_ & 0x00000002) == 0x00000002) && + deploy_ != akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance()) { + deploy_ = + akka.remote.RemoteProtocol.DeployProtocol.newBuilder(deploy_).mergeFrom(value).buildPartial(); + } else { + deploy_ = value; + } + onChanged(); + } else { + deployBuilder_.mergeFrom(value); + } + bitField0_ |= 0x00000002; + return this; + } + public Builder clearDeploy() { + if (deployBuilder_ == null) { + deploy_ = akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + onChanged(); + } else { + deployBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + public akka.remote.RemoteProtocol.DeployProtocol.Builder getDeployBuilder() { + bitField0_ |= 0x00000002; + onChanged(); + return getDeployFieldBuilder().getBuilder(); + } + public akka.remote.RemoteProtocol.DeployProtocolOrBuilder getDeployOrBuilder() { + if (deployBuilder_ != null) { + return deployBuilder_.getMessageOrBuilder(); + } else { + return deploy_; + } + } + private com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder> + getDeployFieldBuilder() { + if (deployBuilder_ == null) { + deployBuilder_ = new com.google.protobuf.SingleFieldBuilder< + akka.remote.RemoteProtocol.DeployProtocol, akka.remote.RemoteProtocol.DeployProtocol.Builder, akka.remote.RemoteProtocol.DeployProtocolOrBuilder>( + deploy_, + getParentForChildren(), + isClean()); + deploy_ = null; + } + return deployBuilder_; + } + + // optional string fromClassCreator = 3; + private java.lang.Object fromClassCreator_ = ""; + public boolean hasFromClassCreator() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public String getFromClassCreator() { + java.lang.Object ref = fromClassCreator_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + fromClassCreator_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setFromClassCreator(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + fromClassCreator_ = value; + onChanged(); + return this; + } + public Builder clearFromClassCreator() { + bitField0_ = (bitField0_ & ~0x00000004); + fromClassCreator_ = getDefaultInstance().getFromClassCreator(); + onChanged(); + return this; + } + void setFromClassCreator(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000004; + fromClassCreator_ = value; + onChanged(); + } + + // optional bytes creator = 4; + private com.google.protobuf.ByteString creator_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasCreator() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getCreator() { + return creator_; + } + public Builder setCreator(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + creator_ = value; + onChanged(); + return this; + } + public Builder clearCreator() { + bitField0_ = (bitField0_ & ~0x00000008); + creator_ = getDefaultInstance().getCreator(); + onChanged(); + return this; + } + + // optional bytes routerConfig = 5; + private com.google.protobuf.ByteString routerConfig_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRouterConfig() { + return ((bitField0_ & 0x00000010) == 0x00000010); + } + public com.google.protobuf.ByteString getRouterConfig() { + return routerConfig_; + } + public Builder setRouterConfig(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000010; + routerConfig_ = value; + onChanged(); + return this; + } + public Builder clearRouterConfig() { + bitField0_ = (bitField0_ & ~0x00000010); + routerConfig_ = getDefaultInstance().getRouterConfig(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:PropsProtocol) + } + + static { + defaultInstance = new PropsProtocol(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:PropsProtocol) + } + + public interface DeployProtocolOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required string path = 1; + boolean hasPath(); + String getPath(); + + // optional bytes config = 2; + boolean hasConfig(); + com.google.protobuf.ByteString getConfig(); + + // optional bytes routerConfig = 3; + boolean hasRouterConfig(); + com.google.protobuf.ByteString getRouterConfig(); + + // optional bytes scope = 4; + boolean hasScope(); + com.google.protobuf.ByteString getScope(); + } + public static final class DeployProtocol extends + com.google.protobuf.GeneratedMessage + implements DeployProtocolOrBuilder { + // Use DeployProtocol.newBuilder() to construct. + private DeployProtocol(Builder builder) { + super(builder); + } + private DeployProtocol(boolean noInit) {} + + private static final DeployProtocol defaultInstance; + public static DeployProtocol getDefaultInstance() { + return defaultInstance; + } + + public DeployProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_DeployProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_DeployProtocol_fieldAccessorTable; + } + + private int bitField0_; + // required string path = 1; + public static final int PATH_FIELD_NUMBER = 1; + private java.lang.Object path_; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (ref instanceof String) { + return (String) ref; + } else { + com.google.protobuf.ByteString bs = + (com.google.protobuf.ByteString) ref; + String s = bs.toStringUtf8(); + if (com.google.protobuf.Internal.isValidUtf8(bs)) { + path_ = s; + } + return s; + } + } + private com.google.protobuf.ByteString getPathBytes() { + java.lang.Object ref = path_; + if (ref instanceof String) { + com.google.protobuf.ByteString b = + com.google.protobuf.ByteString.copyFromUtf8((String) ref); + path_ = b; + return b; + } else { + return (com.google.protobuf.ByteString) ref; + } + } + + // optional bytes config = 2; + public static final int CONFIG_FIELD_NUMBER = 2; + private com.google.protobuf.ByteString config_; + public boolean hasConfig() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getConfig() { + return config_; + } + + // optional bytes routerConfig = 3; + public static final int ROUTERCONFIG_FIELD_NUMBER = 3; + private com.google.protobuf.ByteString routerConfig_; + public boolean hasRouterConfig() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getRouterConfig() { + return routerConfig_; + } + + // optional bytes scope = 4; + public static final int SCOPE_FIELD_NUMBER = 4; + private com.google.protobuf.ByteString scope_; + public boolean hasScope() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getScope() { + return scope_; + } + + private void initFields() { + path_ = ""; + config_ = com.google.protobuf.ByteString.EMPTY; + routerConfig_ = com.google.protobuf.ByteString.EMPTY; + scope_ = com.google.protobuf.ByteString.EMPTY; + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasPath()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeBytes(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeBytes(2, config_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + output.writeBytes(3, routerConfig_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + output.writeBytes(4, scope_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(1, getPathBytes()); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(2, config_); + } + if (((bitField0_ & 0x00000004) == 0x00000004)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(3, routerConfig_); + } + if (((bitField0_ & 0x00000008) == 0x00000008)) { + size += com.google.protobuf.CodedOutputStream + .computeBytesSize(4, scope_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.DeployProtocol parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.DeployProtocol parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(akka.remote.RemoteProtocol.DeployProtocol prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements akka.remote.RemoteProtocol.DeployProtocolOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_DeployProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_DeployProtocol_fieldAccessorTable; + } + + // Construct using akka.remote.RemoteProtocol.DeployProtocol.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + path_ = ""; + bitField0_ = (bitField0_ & ~0x00000001); + config_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000002); + routerConfig_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000004); + scope_ = com.google.protobuf.ByteString.EMPTY; + bitField0_ = (bitField0_ & ~0x00000008); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return akka.remote.RemoteProtocol.DeployProtocol.getDescriptor(); + } + + public akka.remote.RemoteProtocol.DeployProtocol getDefaultInstanceForType() { + return akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance(); + } + + public akka.remote.RemoteProtocol.DeployProtocol build() { + akka.remote.RemoteProtocol.DeployProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private akka.remote.RemoteProtocol.DeployProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + akka.remote.RemoteProtocol.DeployProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public akka.remote.RemoteProtocol.DeployProtocol buildPartial() { + akka.remote.RemoteProtocol.DeployProtocol result = new akka.remote.RemoteProtocol.DeployProtocol(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + result.path_ = path_; + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + result.config_ = config_; + if (((from_bitField0_ & 0x00000004) == 0x00000004)) { + to_bitField0_ |= 0x00000004; + } + result.routerConfig_ = routerConfig_; + if (((from_bitField0_ & 0x00000008) == 0x00000008)) { + to_bitField0_ |= 0x00000008; + } + result.scope_ = scope_; + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof akka.remote.RemoteProtocol.DeployProtocol) { + return mergeFrom((akka.remote.RemoteProtocol.DeployProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.remote.RemoteProtocol.DeployProtocol other) { + if (other == akka.remote.RemoteProtocol.DeployProtocol.getDefaultInstance()) return this; + if (other.hasPath()) { + setPath(other.getPath()); + } + if (other.hasConfig()) { + setConfig(other.getConfig()); + } + if (other.hasRouterConfig()) { + setRouterConfig(other.getRouterConfig()); + } + if (other.hasScope()) { + setScope(other.getScope()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasPath()) { + + return false; + } + return true; + } + + public Builder mergeFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + com.google.protobuf.UnknownFieldSet.Builder unknownFields = + com.google.protobuf.UnknownFieldSet.newBuilder( + this.getUnknownFields()); + while (true) { + int tag = input.readTag(); + switch (tag) { + case 0: + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + this.setUnknownFields(unknownFields.build()); + onChanged(); + return this; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + path_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + config_ = input.readBytes(); + break; + } + case 26: { + bitField0_ |= 0x00000004; + routerConfig_ = input.readBytes(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + scope_ = input.readBytes(); + break; + } + } + } + } + + private int bitField0_; + + // required string path = 1; + private java.lang.Object path_ = ""; + public boolean hasPath() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public String getPath() { + java.lang.Object ref = path_; + if (!(ref instanceof String)) { + String s = ((com.google.protobuf.ByteString) ref).toStringUtf8(); + path_ = s; + return s; + } else { + return (String) ref; + } + } + public Builder setPath(String value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + return this; + } + public Builder clearPath() { + bitField0_ = (bitField0_ & ~0x00000001); + path_ = getDefaultInstance().getPath(); + onChanged(); + return this; + } + void setPath(com.google.protobuf.ByteString value) { + bitField0_ |= 0x00000001; + path_ = value; + onChanged(); + } + + // optional bytes config = 2; + private com.google.protobuf.ByteString config_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasConfig() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public com.google.protobuf.ByteString getConfig() { + return config_; + } + public Builder setConfig(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000002; + config_ = value; + onChanged(); + return this; + } + public Builder clearConfig() { + bitField0_ = (bitField0_ & ~0x00000002); + config_ = getDefaultInstance().getConfig(); + onChanged(); + return this; + } + + // optional bytes routerConfig = 3; + private com.google.protobuf.ByteString routerConfig_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasRouterConfig() { + return ((bitField0_ & 0x00000004) == 0x00000004); + } + public com.google.protobuf.ByteString getRouterConfig() { + return routerConfig_; + } + public Builder setRouterConfig(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000004; + routerConfig_ = value; + onChanged(); + return this; + } + public Builder clearRouterConfig() { + bitField0_ = (bitField0_ & ~0x00000004); + routerConfig_ = getDefaultInstance().getRouterConfig(); + onChanged(); + return this; + } + + // optional bytes scope = 4; + private com.google.protobuf.ByteString scope_ = com.google.protobuf.ByteString.EMPTY; + public boolean hasScope() { + return ((bitField0_ & 0x00000008) == 0x00000008); + } + public com.google.protobuf.ByteString getScope() { + return scope_; + } + public Builder setScope(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + bitField0_ |= 0x00000008; + scope_ = value; + onChanged(); + return this; + } + public Builder clearScope() { + bitField0_ = (bitField0_ & ~0x00000008); + scope_ = getDefaultInstance().getScope(); + onChanged(); + return this; + } + + // @@protoc_insertion_point(builder_scope:DeployProtocol) + } + + static { + defaultInstance = new DeployProtocol(true); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:DeployProtocol) + } + + public interface DaemonMsgWatchProtocolOrBuilder + extends com.google.protobuf.MessageOrBuilder { + + // required .ActorRefProtocol watcher = 1; + boolean hasWatcher(); + akka.remote.RemoteProtocol.ActorRefProtocol getWatcher(); + akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatcherOrBuilder(); + + // required .ActorRefProtocol watched = 2; + boolean hasWatched(); + akka.remote.RemoteProtocol.ActorRefProtocol getWatched(); + akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatchedOrBuilder(); + } + public static final class DaemonMsgWatchProtocol extends + com.google.protobuf.GeneratedMessage + implements DaemonMsgWatchProtocolOrBuilder { + // Use DaemonMsgWatchProtocol.newBuilder() to construct. + private DaemonMsgWatchProtocol(Builder builder) { + super(builder); + } + private DaemonMsgWatchProtocol(boolean noInit) {} + + private static final DaemonMsgWatchProtocol defaultInstance; + public static DaemonMsgWatchProtocol getDefaultInstance() { + return defaultInstance; + } + + public DaemonMsgWatchProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_DaemonMsgWatchProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_DaemonMsgWatchProtocol_fieldAccessorTable; + } + + private int bitField0_; + // required .ActorRefProtocol watcher = 1; + public static final int WATCHER_FIELD_NUMBER = 1; + private akka.remote.RemoteProtocol.ActorRefProtocol watcher_; + public boolean hasWatcher() { + return ((bitField0_ & 0x00000001) == 0x00000001); + } + public akka.remote.RemoteProtocol.ActorRefProtocol getWatcher() { + return watcher_; + } + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatcherOrBuilder() { + return watcher_; + } + + // required .ActorRefProtocol watched = 2; + public static final int WATCHED_FIELD_NUMBER = 2; + private akka.remote.RemoteProtocol.ActorRefProtocol watched_; + public boolean hasWatched() { + return ((bitField0_ & 0x00000002) == 0x00000002); + } + public akka.remote.RemoteProtocol.ActorRefProtocol getWatched() { + return watched_; + } + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatchedOrBuilder() { + return watched_; + } + + private void initFields() { + watcher_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + watched_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + } + private byte memoizedIsInitialized = -1; + public final boolean isInitialized() { + byte isInitialized = memoizedIsInitialized; + if (isInitialized != -1) return isInitialized == 1; + + if (!hasWatcher()) { + memoizedIsInitialized = 0; + return false; + } + if (!hasWatched()) { + memoizedIsInitialized = 0; + return false; + } + if (!getWatcher().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + if (!getWatched().isInitialized()) { + memoizedIsInitialized = 0; + return false; + } + memoizedIsInitialized = 1; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (((bitField0_ & 0x00000001) == 0x00000001)) { + output.writeMessage(1, watcher_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + output.writeMessage(2, watched_); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (((bitField0_ & 0x00000001) == 0x00000001)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(1, watcher_); + } + if (((bitField0_ & 0x00000002) == 0x00000002)) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(2, watched_); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + private static final long serialVersionUID = 0L; + @java.lang.Override + protected java.lang.Object writeReplace() + throws java.io.ObjectStreamException { + return super.writeReplace(); + } + + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + com.google.protobuf.ByteString data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + byte[] data, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseDelimitedFrom(java.io.InputStream input) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseDelimitedFrom( + java.io.InputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + Builder builder = newBuilder(); + if (builder.mergeDelimitedFrom(input, extensionRegistry)) { + return builder.buildParsed(); + } else { + return null; + } + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static akka.remote.RemoteProtocol.DaemonMsgWatchProtocol parseFrom( + com.google.protobuf.CodedInputStream input, + com.google.protobuf.ExtensionRegistryLite extensionRegistry) + throws java.io.IOException { + return newBuilder().mergeFrom(input, extensionRegistry) + .buildParsed(); + } + + public static Builder newBuilder() { return Builder.create(); } + public Builder newBuilderForType() { return newBuilder(); } + public static Builder newBuilder(akka.remote.RemoteProtocol.DaemonMsgWatchProtocol prototype) { + return newBuilder().mergeFrom(prototype); + } + public Builder toBuilder() { return newBuilder(this); } + + @java.lang.Override + protected Builder newBuilderForType( + com.google.protobuf.GeneratedMessage.BuilderParent parent) { + Builder builder = new Builder(parent); + return builder; + } + public static final class Builder extends + com.google.protobuf.GeneratedMessage.Builder + implements akka.remote.RemoteProtocol.DaemonMsgWatchProtocolOrBuilder { + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.RemoteProtocol.internal_static_DaemonMsgWatchProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.RemoteProtocol.internal_static_DaemonMsgWatchProtocol_fieldAccessorTable; + } + + // Construct using akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.newBuilder() + private Builder() { + maybeForceBuilderInitialization(); + } + + private Builder(com.google.protobuf.GeneratedMessage.BuilderParent parent) { + super(parent); + maybeForceBuilderInitialization(); + } + private void maybeForceBuilderInitialization() { + if (com.google.protobuf.GeneratedMessage.alwaysUseFieldBuilders) { + getWatcherFieldBuilder(); + getWatchedFieldBuilder(); + } + } + private static Builder create() { + return new Builder(); + } + + public Builder clear() { + super.clear(); + if (watcherBuilder_ == null) { + watcher_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + } else { + watcherBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000001); + if (watchedBuilder_ == null) { + watched_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + } else { + watchedBuilder_.clear(); + } + bitField0_ = (bitField0_ & ~0x00000002); + return this; + } + + public Builder clone() { + return create().mergeFrom(buildPartial()); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.getDescriptor(); + } + + public akka.remote.RemoteProtocol.DaemonMsgWatchProtocol getDefaultInstanceForType() { + return akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.getDefaultInstance(); + } + + public akka.remote.RemoteProtocol.DaemonMsgWatchProtocol build() { + akka.remote.RemoteProtocol.DaemonMsgWatchProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException(result); + } + return result; + } + + private akka.remote.RemoteProtocol.DaemonMsgWatchProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + akka.remote.RemoteProtocol.DaemonMsgWatchProtocol result = buildPartial(); + if (!result.isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return result; + } + + public akka.remote.RemoteProtocol.DaemonMsgWatchProtocol buildPartial() { + akka.remote.RemoteProtocol.DaemonMsgWatchProtocol result = new akka.remote.RemoteProtocol.DaemonMsgWatchProtocol(this); + int from_bitField0_ = bitField0_; + int to_bitField0_ = 0; + if (((from_bitField0_ & 0x00000001) == 0x00000001)) { + to_bitField0_ |= 0x00000001; + } + if (watcherBuilder_ == null) { + result.watcher_ = watcher_; + } else { + result.watcher_ = watcherBuilder_.build(); + } + if (((from_bitField0_ & 0x00000002) == 0x00000002)) { + to_bitField0_ |= 0x00000002; + } + if (watchedBuilder_ == null) { + result.watched_ = watched_; + } else { + result.watched_ = watchedBuilder_.build(); + } + result.bitField0_ = to_bitField0_; + onBuilt(); + return result; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof akka.remote.RemoteProtocol.DaemonMsgWatchProtocol) { + return mergeFrom((akka.remote.RemoteProtocol.DaemonMsgWatchProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(akka.remote.RemoteProtocol.DaemonMsgWatchProtocol other) { + if (other == akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.getDefaultInstance()) return this; + if (other.hasWatcher()) { + mergeWatcher(other.getWatcher()); + } + if (other.hasWatched()) { + mergeWatched(other.getWatched()); + } + this.mergeUnknownFields(other.getUnknownFields()); + return this; + } + + public final boolean isInitialized() { + if (!hasWatcher()) { + + return false; + } + if (!hasWatched()) { + + return false; + } + if (!getWatcher().isInitialized()) { + + return false; + } + if (!getWatched().isInitialized()) { + + return false; + } return true; } @@ -4593,25 +6737,20 @@ public final class RemoteProtocol { } case 10: { akka.remote.RemoteProtocol.ActorRefProtocol.Builder subBuilder = akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(); - if (hasRecipient()) { - subBuilder.mergeFrom(getRecipient()); + if (hasWatcher()) { + subBuilder.mergeFrom(getWatcher()); } input.readMessage(subBuilder, extensionRegistry); - setRecipient(subBuilder.buildPartial()); + setWatcher(subBuilder.buildPartial()); break; } case 18: { akka.remote.RemoteProtocol.ActorRefProtocol.Builder subBuilder = akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(); - if (hasSender()) { - subBuilder.mergeFrom(getSender()); + if (hasWatched()) { + subBuilder.mergeFrom(getWatched()); } input.readMessage(subBuilder, extensionRegistry); - setSender(subBuilder.buildPartial()); - break; - } - case 26: { - bitField0_ |= 0x00000004; - message_ = input.readBytes(); + setWatched(subBuilder.buildPartial()); break; } } @@ -4620,219 +6759,195 @@ public final class RemoteProtocol { private int bitField0_; - // required .ActorRefProtocol recipient = 1; - private akka.remote.RemoteProtocol.ActorRefProtocol recipient_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + // required .ActorRefProtocol watcher = 1; + private akka.remote.RemoteProtocol.ActorRefProtocol watcher_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> recipientBuilder_; - public boolean hasRecipient() { + akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> watcherBuilder_; + public boolean hasWatcher() { return ((bitField0_ & 0x00000001) == 0x00000001); } - public akka.remote.RemoteProtocol.ActorRefProtocol getRecipient() { - if (recipientBuilder_ == null) { - return recipient_; + public akka.remote.RemoteProtocol.ActorRefProtocol getWatcher() { + if (watcherBuilder_ == null) { + return watcher_; } else { - return recipientBuilder_.getMessage(); + return watcherBuilder_.getMessage(); } } - public Builder setRecipient(akka.remote.RemoteProtocol.ActorRefProtocol value) { - if (recipientBuilder_ == null) { + public Builder setWatcher(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (watcherBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - recipient_ = value; + watcher_ = value; onChanged(); } else { - recipientBuilder_.setMessage(value); + watcherBuilder_.setMessage(value); } bitField0_ |= 0x00000001; return this; } - public Builder setRecipient( + public Builder setWatcher( akka.remote.RemoteProtocol.ActorRefProtocol.Builder builderForValue) { - if (recipientBuilder_ == null) { - recipient_ = builderForValue.build(); + if (watcherBuilder_ == null) { + watcher_ = builderForValue.build(); onChanged(); } else { - recipientBuilder_.setMessage(builderForValue.build()); + watcherBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000001; return this; } - public Builder mergeRecipient(akka.remote.RemoteProtocol.ActorRefProtocol value) { - if (recipientBuilder_ == null) { + public Builder mergeWatcher(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (watcherBuilder_ == null) { if (((bitField0_ & 0x00000001) == 0x00000001) && - recipient_ != akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) { - recipient_ = - akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(recipient_).mergeFrom(value).buildPartial(); + watcher_ != akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) { + watcher_ = + akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(watcher_).mergeFrom(value).buildPartial(); } else { - recipient_ = value; + watcher_ = value; } onChanged(); } else { - recipientBuilder_.mergeFrom(value); + watcherBuilder_.mergeFrom(value); } bitField0_ |= 0x00000001; return this; } - public Builder clearRecipient() { - if (recipientBuilder_ == null) { - recipient_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + public Builder clearWatcher() { + if (watcherBuilder_ == null) { + watcher_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); onChanged(); } else { - recipientBuilder_.clear(); + watcherBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000001); return this; } - public akka.remote.RemoteProtocol.ActorRefProtocol.Builder getRecipientBuilder() { + public akka.remote.RemoteProtocol.ActorRefProtocol.Builder getWatcherBuilder() { bitField0_ |= 0x00000001; onChanged(); - return getRecipientFieldBuilder().getBuilder(); + return getWatcherFieldBuilder().getBuilder(); } - public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getRecipientOrBuilder() { - if (recipientBuilder_ != null) { - return recipientBuilder_.getMessageOrBuilder(); + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatcherOrBuilder() { + if (watcherBuilder_ != null) { + return watcherBuilder_.getMessageOrBuilder(); } else { - return recipient_; + return watcher_; } } private com.google.protobuf.SingleFieldBuilder< akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> - getRecipientFieldBuilder() { - if (recipientBuilder_ == null) { - recipientBuilder_ = new com.google.protobuf.SingleFieldBuilder< + getWatcherFieldBuilder() { + if (watcherBuilder_ == null) { + watcherBuilder_ = new com.google.protobuf.SingleFieldBuilder< akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder>( - recipient_, + watcher_, getParentForChildren(), isClean()); - recipient_ = null; + watcher_ = null; } - return recipientBuilder_; + return watcherBuilder_; } - // optional .ActorRefProtocol sender = 2; - private akka.remote.RemoteProtocol.ActorRefProtocol sender_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + // required .ActorRefProtocol watched = 2; + private akka.remote.RemoteProtocol.ActorRefProtocol watched_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); private com.google.protobuf.SingleFieldBuilder< - akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> senderBuilder_; - public boolean hasSender() { + akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> watchedBuilder_; + public boolean hasWatched() { return ((bitField0_ & 0x00000002) == 0x00000002); } - public akka.remote.RemoteProtocol.ActorRefProtocol getSender() { - if (senderBuilder_ == null) { - return sender_; + public akka.remote.RemoteProtocol.ActorRefProtocol getWatched() { + if (watchedBuilder_ == null) { + return watched_; } else { - return senderBuilder_.getMessage(); + return watchedBuilder_.getMessage(); } } - public Builder setSender(akka.remote.RemoteProtocol.ActorRefProtocol value) { - if (senderBuilder_ == null) { + public Builder setWatched(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (watchedBuilder_ == null) { if (value == null) { throw new NullPointerException(); } - sender_ = value; + watched_ = value; onChanged(); } else { - senderBuilder_.setMessage(value); + watchedBuilder_.setMessage(value); } bitField0_ |= 0x00000002; return this; } - public Builder setSender( + public Builder setWatched( akka.remote.RemoteProtocol.ActorRefProtocol.Builder builderForValue) { - if (senderBuilder_ == null) { - sender_ = builderForValue.build(); + if (watchedBuilder_ == null) { + watched_ = builderForValue.build(); onChanged(); } else { - senderBuilder_.setMessage(builderForValue.build()); + watchedBuilder_.setMessage(builderForValue.build()); } bitField0_ |= 0x00000002; return this; } - public Builder mergeSender(akka.remote.RemoteProtocol.ActorRefProtocol value) { - if (senderBuilder_ == null) { + public Builder mergeWatched(akka.remote.RemoteProtocol.ActorRefProtocol value) { + if (watchedBuilder_ == null) { if (((bitField0_ & 0x00000002) == 0x00000002) && - sender_ != akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) { - sender_ = - akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(sender_).mergeFrom(value).buildPartial(); + watched_ != akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance()) { + watched_ = + akka.remote.RemoteProtocol.ActorRefProtocol.newBuilder(watched_).mergeFrom(value).buildPartial(); } else { - sender_ = value; + watched_ = value; } onChanged(); } else { - senderBuilder_.mergeFrom(value); + watchedBuilder_.mergeFrom(value); } bitField0_ |= 0x00000002; return this; } - public Builder clearSender() { - if (senderBuilder_ == null) { - sender_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); + public Builder clearWatched() { + if (watchedBuilder_ == null) { + watched_ = akka.remote.RemoteProtocol.ActorRefProtocol.getDefaultInstance(); onChanged(); } else { - senderBuilder_.clear(); + watchedBuilder_.clear(); } bitField0_ = (bitField0_ & ~0x00000002); return this; } - public akka.remote.RemoteProtocol.ActorRefProtocol.Builder getSenderBuilder() { + public akka.remote.RemoteProtocol.ActorRefProtocol.Builder getWatchedBuilder() { bitField0_ |= 0x00000002; onChanged(); - return getSenderFieldBuilder().getBuilder(); + return getWatchedFieldBuilder().getBuilder(); } - public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getSenderOrBuilder() { - if (senderBuilder_ != null) { - return senderBuilder_.getMessageOrBuilder(); + public akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder getWatchedOrBuilder() { + if (watchedBuilder_ != null) { + return watchedBuilder_.getMessageOrBuilder(); } else { - return sender_; + return watched_; } } private com.google.protobuf.SingleFieldBuilder< akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder> - getSenderFieldBuilder() { - if (senderBuilder_ == null) { - senderBuilder_ = new com.google.protobuf.SingleFieldBuilder< + getWatchedFieldBuilder() { + if (watchedBuilder_ == null) { + watchedBuilder_ = new com.google.protobuf.SingleFieldBuilder< akka.remote.RemoteProtocol.ActorRefProtocol, akka.remote.RemoteProtocol.ActorRefProtocol.Builder, akka.remote.RemoteProtocol.ActorRefProtocolOrBuilder>( - sender_, + watched_, getParentForChildren(), isClean()); - sender_ = null; + watched_ = null; } - return senderBuilder_; + return watchedBuilder_; } - // required bytes message = 3; - private com.google.protobuf.ByteString message_ = com.google.protobuf.ByteString.EMPTY; - public boolean hasMessage() { - return ((bitField0_ & 0x00000004) == 0x00000004); - } - public com.google.protobuf.ByteString getMessage() { - return message_; - } - public Builder setMessage(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - bitField0_ |= 0x00000004; - message_ = value; - onChanged(); - return this; - } - public Builder clearMessage() { - bitField0_ = (bitField0_ & ~0x00000004); - message_ = getDefaultInstance().getMessage(); - onChanged(); - return this; - } - - // @@protoc_insertion_point(builder_scope:DurableMailboxMessageProtocol) + // @@protoc_insertion_point(builder_scope:DaemonMsgWatchProtocol) } static { - defaultInstance = new DurableMailboxMessageProtocol(true); + defaultInstance = new DaemonMsgWatchProtocol(true); defaultInstance.initFields(); } - // @@protoc_insertion_point(class_scope:DurableMailboxMessageProtocol) + // @@protoc_insertion_point(class_scope:DaemonMsgWatchProtocol) } private static com.google.protobuf.Descriptors.Descriptor @@ -4871,10 +6986,25 @@ public final class RemoteProtocol { com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_AddressProtocol_fieldAccessorTable; private static com.google.protobuf.Descriptors.Descriptor - internal_static_DurableMailboxMessageProtocol_descriptor; + internal_static_DaemonMsgCreateProtocol_descriptor; private static com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_DurableMailboxMessageProtocol_fieldAccessorTable; + internal_static_DaemonMsgCreateProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_PropsProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_PropsProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_DeployProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_DeployProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_DaemonMsgWatchProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_DaemonMsgWatchProtocol_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -4900,12 +7030,20 @@ public final class RemoteProtocol { "anifest\030\003 \001(\014\"3\n\025MetadataEntryProtocol\022\013" + "\n\003key\030\001 \002(\t\022\r\n\005value\030\002 \002(\014\"A\n\017AddressPro" + "tocol\022\016\n\006system\030\001 \002(\t\022\020\n\010hostname\030\002 \002(\t\022" + - "\014\n\004port\030\003 \002(\r\"y\n\035DurableMailboxMessagePr" + - "otocol\022$\n\trecipient\030\001 \002(\0132\021.ActorRefProt" + - "ocol\022!\n\006sender\030\002 \001(\0132\021.ActorRefProtocol\022" + - "\017\n\007message\030\003 \002(\014*7\n\013CommandType\022\013\n\007CONNE", - "CT\020\001\022\014\n\010SHUTDOWN\020\002\022\r\n\tHEARTBEAT\020\003B\017\n\013akk" + - "a.remoteH\001" + "\014\n\004port\030\003 \002(\r\"\216\001\n\027DaemonMsgCreateProtoco" + + "l\022\035\n\005props\030\001 \002(\0132\016.PropsProtocol\022\037\n\006depl" + + "oy\030\002 \002(\0132\017.DeployProtocol\022\014\n\004path\030\003 \002(\t\022" + + "%\n\nsupervisor\030\004 \002(\0132\021.ActorRefProtocol\"\205", + "\001\n\rPropsProtocol\022\022\n\ndispatcher\030\001 \002(\t\022\037\n\006" + + "deploy\030\002 \002(\0132\017.DeployProtocol\022\030\n\020fromCla" + + "ssCreator\030\003 \001(\t\022\017\n\007creator\030\004 \001(\014\022\024\n\014rout" + + "erConfig\030\005 \001(\014\"S\n\016DeployProtocol\022\014\n\004path" + + "\030\001 \002(\t\022\016\n\006config\030\002 \001(\014\022\024\n\014routerConfig\030\003" + + " \001(\014\022\r\n\005scope\030\004 \001(\014\"`\n\026DaemonMsgWatchPro" + + "tocol\022\"\n\007watcher\030\001 \002(\0132\021.ActorRefProtoco" + + "l\022\"\n\007watched\030\002 \002(\0132\021.ActorRefProtocol*7\n" + + "\013CommandType\022\013\n\007CONNECT\020\001\022\014\n\010SHUTDOWN\020\002\022" + + "\r\n\tHEARTBEAT\020\003B\017\n\013akka.remoteH\001" }; com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner = new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() { @@ -4968,14 +7106,38 @@ public final class RemoteProtocol { new java.lang.String[] { "System", "Hostname", "Port", }, akka.remote.RemoteProtocol.AddressProtocol.class, akka.remote.RemoteProtocol.AddressProtocol.Builder.class); - internal_static_DurableMailboxMessageProtocol_descriptor = + internal_static_DaemonMsgCreateProtocol_descriptor = getDescriptor().getMessageTypes().get(7); - internal_static_DurableMailboxMessageProtocol_fieldAccessorTable = new + internal_static_DaemonMsgCreateProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_DurableMailboxMessageProtocol_descriptor, - new java.lang.String[] { "Recipient", "Sender", "Message", }, - akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.class, - akka.remote.RemoteProtocol.DurableMailboxMessageProtocol.Builder.class); + internal_static_DaemonMsgCreateProtocol_descriptor, + new java.lang.String[] { "Props", "Deploy", "Path", "Supervisor", }, + akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.class, + akka.remote.RemoteProtocol.DaemonMsgCreateProtocol.Builder.class); + internal_static_PropsProtocol_descriptor = + getDescriptor().getMessageTypes().get(8); + internal_static_PropsProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_PropsProtocol_descriptor, + new java.lang.String[] { "Dispatcher", "Deploy", "FromClassCreator", "Creator", "RouterConfig", }, + akka.remote.RemoteProtocol.PropsProtocol.class, + akka.remote.RemoteProtocol.PropsProtocol.Builder.class); + internal_static_DeployProtocol_descriptor = + getDescriptor().getMessageTypes().get(9); + internal_static_DeployProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_DeployProtocol_descriptor, + new java.lang.String[] { "Path", "Config", "RouterConfig", "Scope", }, + akka.remote.RemoteProtocol.DeployProtocol.class, + akka.remote.RemoteProtocol.DeployProtocol.Builder.class); + internal_static_DaemonMsgWatchProtocol_descriptor = + getDescriptor().getMessageTypes().get(10); + internal_static_DaemonMsgWatchProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_DaemonMsgWatchProtocol_descriptor, + new java.lang.String[] { "Watcher", "Watched", }, + akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.class, + akka.remote.RemoteProtocol.DaemonMsgWatchProtocol.Builder.class); return null; } }; diff --git a/akka-remote/src/main/protocol/RemoteProtocol.proto b/akka-remote/src/main/protocol/RemoteProtocol.proto index 730c3a5883..72b04caa57 100644 --- a/akka-remote/src/main/protocol/RemoteProtocol.proto +++ b/akka-remote/src/main/protocol/RemoteProtocol.proto @@ -79,10 +79,40 @@ message AddressProtocol { } /** - * Defines the durable mailbox message. + * Defines akka.remote.DaemonMsgCreate */ -message DurableMailboxMessageProtocol { - required ActorRefProtocol recipient= 1; - optional ActorRefProtocol sender = 2; - required bytes message = 3; +message DaemonMsgCreateProtocol { + required PropsProtocol props = 1; + required DeployProtocol deploy = 2; + required string path = 3; + required ActorRefProtocol supervisor = 4; +} + +/** + * Serialization of akka.actor.Props + */ +message PropsProtocol { + required string dispatcher = 1; + required DeployProtocol deploy = 2; + optional string fromClassCreator = 3; + optional bytes creator = 4; + optional bytes routerConfig = 5; +} + +/** + * Serialization of akka.actor.Deploy + */ +message DeployProtocol { + required string path = 1; + optional bytes config = 2; + optional bytes routerConfig = 3; + optional bytes scope = 4; +} + +/** + * Serialization of akka.remote.DaemonMsgWatch + */ +message DaemonMsgWatchProtocol { + required ActorRefProtocol watcher = 1; + required ActorRefProtocol watched = 2; } diff --git a/akka-remote/src/main/resources/reference.conf b/akka-remote/src/main/resources/reference.conf index 4512ea3a98..11a4da0711 100644 --- a/akka-remote/src/main/resources/reference.conf +++ b/akka-remote/src/main/resources/reference.conf @@ -14,6 +14,8 @@ akka { serializers { proto = "akka.serialization.ProtobufSerializer" + daemon-create = "akka.serialization.DaemonMsgCreateSerializer" + daemon-watch = "akka.serialization.DaemonMsgWatchSerializer" } @@ -21,6 +23,8 @@ akka { # Since com.google.protobuf.Message does not extend Serializable but GeneratedMessage # does, need to use the more specific one here in order to avoid ambiguity "com.google.protobuf.GeneratedMessage" = proto + "akka.remote.DaemonMsgCreate" = daemon-create + "akka.remote.DaemonMsgWatch" = daemon-watch } deployment { diff --git a/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala b/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala new file mode 100644 index 0000000000..ce54ff5adb --- /dev/null +++ b/akka-remote/src/main/scala/akka/serialization/DaemonMsgCreateSerializer.scala @@ -0,0 +1,152 @@ +/** + * Copyright (C) 2009-2012 Typesafe Inc. + */ + +package akka.serialization + +import java.io.Serializable +import com.google.protobuf.ByteString +import com.typesafe.config.Config +import com.typesafe.config.ConfigFactory +import akka.actor.Actor +import akka.actor.ActorRef +import akka.actor.Deploy +import akka.actor.ExtendedActorSystem +import akka.actor.NoScopeGiven +import akka.actor.Props +import akka.actor.Scope +import akka.remote.DaemonMsgCreate +import akka.remote.RemoteProtocol.ActorRefProtocol +import akka.remote.RemoteProtocol.DaemonMsgCreateProtocol +import akka.remote.RemoteProtocol.DeployProtocol +import akka.remote.RemoteProtocol.PropsProtocol +import akka.routing.NoRouter +import akka.routing.RouterConfig +import akka.actor.FromClassCreator + +/** + * Serializes akka's internal DaemonMsgCreate using protobuf + * for the core structure of DaemonMsgCreate, Props and Deploy. + * Serialization of contained RouterConfig, Config, and Scope + * is done with configured serializer for those classes, by + * default java.io.Serializable. + */ +class DaemonMsgCreateSerializer(val system: ExtendedActorSystem) extends Serializer { + import ProtobufSerializer.serializeActorRef + import ProtobufSerializer.deserializeActorRef + + def includeManifest: Boolean = false + def identifier = 3 + lazy val serialization = SerializationExtension(system) + + def toBinary(obj: AnyRef): Array[Byte] = obj match { + case DaemonMsgCreate(props, deploy, path, supervisor) ⇒ + + def deployProto(d: Deploy): DeployProtocol = { + val builder = DeployProtocol.newBuilder.setPath(d.path) + if (d.config != ConfigFactory.empty) + builder.setConfig(serialize(d.config)) + if (d.routerConfig != NoRouter) + builder.setRouterConfig(serialize(d.routerConfig)) + if (d.scope != NoScopeGiven) + builder.setScope(serialize(d.scope)) + builder.build + } + + def propsProto = { + val builder = PropsProtocol.newBuilder. + setDispatcher(props.dispatcher). + setDeploy(deployProto(props.deploy)) + props.creator match { + case FromClassCreator(clazz) ⇒ builder.setFromClassCreator(clazz.getName) + case creator ⇒ builder.setCreator(serialize(creator)) + } + if (props.routerConfig != NoRouter) + builder.setRouterConfig(serialize(props.routerConfig)) + builder.build + } + + DaemonMsgCreateProtocol.newBuilder. + setProps(propsProto). + setDeploy(deployProto(deploy)). + setPath(path). + setSupervisor(serializeActorRef(supervisor)). + build.toByteArray + + case _ ⇒ + throw new IllegalArgumentException( + "Can't serialize a non-DaemonMsgCreate message using DaemonMsgCreateSerializer [%s]".format(obj)) + } + + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + val proto = DaemonMsgCreateProtocol.parseFrom(bytes) + + def deploy(protoDeploy: DeployProtocol) = { + val config = + if (protoDeploy.hasConfig) deserialize(protoDeploy.getConfig, classOf[Config]) + else ConfigFactory.empty + val routerConfig = + if (protoDeploy.hasRouterConfig) deserialize(protoDeploy.getRouterConfig, classOf[RouterConfig]) + else NoRouter + val scope = + if (protoDeploy.hasScope) deserialize(protoDeploy.getScope, classOf[Scope]) + else NoScopeGiven + Deploy(protoDeploy.getPath, config, routerConfig, scope) + } + + def props = { + val creator = + if (proto.getProps.hasFromClassCreator) { + system.dynamicAccess.getClassFor(proto.getProps.getFromClassCreator) match { + case Right(clazz) ⇒ FromClassCreator(clazz) + case Left(e) ⇒ throw e + } + } else { + deserialize(proto.getProps.getCreator, classOf[() ⇒ Actor]) + } + + val routerConfig = + if (proto.getProps.hasRouterConfig) deserialize(proto.getProps.getRouterConfig, classOf[RouterConfig]) + else NoRouter + + Props( + creator = creator, + dispatcher = proto.getProps.getDispatcher, + routerConfig = routerConfig, + deploy = deploy(proto.getProps.getDeploy)) + } + + DaemonMsgCreate( + props = props, + deploy = deploy(proto.getDeploy), + path = proto.getPath, + supervisor = deserializeActorRef(system, proto.getSupervisor)) + } + + protected def serialize(any: AnyRef): ByteString = + serialization.serialize(any) match { + case Right(bytes) ⇒ ByteString.copyFrom(bytes) + case Left(e) ⇒ throw e + } + + protected def deserialize[T: ClassManifest](data: ByteString, clazz: Class[T]): T = { + val bytes = data.toByteArray + serialization.deserialize(bytes, clazz) match { + case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T] + case Right(other) ⇒ throw new IllegalArgumentException("Can't deserialize to [%s], got [%s]". + format(clazz.getName, other)) + case Left(e) ⇒ + // Fallback to the java serializer, because some interfaces don't implement java.io.Serializable, + // but the impl instance does. This could be optimized by adding java serializers in reference.conf: + // com.typesafe.config.Config + // akka.routing.RouterConfig + // akka.actor.Scope + serialization.deserialize(bytes, classOf[java.io.Serializable]) match { + case Right(x) if classManifest[T].erasure.isInstance(x) ⇒ x.asInstanceOf[T] + case _ ⇒ throw e // the first exception + } + } + + } + +} \ No newline at end of file diff --git a/akka-remote/src/main/scala/akka/serialization/DaemonMsgWatchSerializer.scala b/akka-remote/src/main/scala/akka/serialization/DaemonMsgWatchSerializer.scala new file mode 100644 index 0000000000..0ca5216da0 --- /dev/null +++ b/akka-remote/src/main/scala/akka/serialization/DaemonMsgWatchSerializer.scala @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2009-2012 Typesafe Inc. + */ + +package akka.serialization + +import akka.actor.ActorRef +import akka.remote.DaemonMsgWatch +import akka.remote.RemoteProtocol.ActorRefProtocol +import akka.remote.RemoteProtocol.DaemonMsgWatchProtocol +import akka.actor.ExtendedActorSystem + +/** + * Serializes akka's internal DaemonMsgWatch using protobuf. + */ +class DaemonMsgWatchSerializer(val system: ExtendedActorSystem) extends Serializer { + import ProtobufSerializer.serializeActorRef + import ProtobufSerializer.deserializeActorRef + + def includeManifest: Boolean = false + def identifier = 4 + + def toBinary(obj: AnyRef): Array[Byte] = obj match { + case DaemonMsgWatch(watcher, watched) ⇒ + DaemonMsgWatchProtocol.newBuilder. + setWatcher(serializeActorRef(watcher)). + setWatched(serializeActorRef(watched)). + build.toByteArray + case _ ⇒ + throw new IllegalArgumentException( + "Can't serialize a non-DaemonMsgWatch message using DaemonMsgWatchSerializer [%s]".format(obj)) + } + + def fromBinary(bytes: Array[Byte], clazz: Option[Class[_]]): AnyRef = { + val proto = DaemonMsgWatchProtocol.parseFrom(bytes) + DaemonMsgWatch( + watcher = deserializeActorRef(system, proto.getWatcher), + watched = deserializeActorRef(system, proto.getWatched)) + } + +} \ No newline at end of file diff --git a/akka-remote/src/main/scala/akka/serialization/ProtobufSerializer.scala b/akka-remote/src/main/scala/akka/serialization/ProtobufSerializer.scala index 813a22fba4..d9a5c7b0c4 100644 --- a/akka-remote/src/main/scala/akka/serialization/ProtobufSerializer.scala +++ b/akka-remote/src/main/scala/akka/serialization/ProtobufSerializer.scala @@ -6,6 +6,32 @@ package akka.serialization import com.google.protobuf.Message import akka.actor.DynamicAccess +import akka.remote.RemoteProtocol.ActorRefProtocol +import akka.actor.ActorSystem +import akka.actor.ActorRef + +object ProtobufSerializer { + + /** + * Helper to serialize an [[akka.actor.ActorRef]] to Akka's + * protobuf representation. + */ + def serializeActorRef(ref: ActorRef): ActorRefProtocol = { + val identifier: String = Serialization.currentTransportAddress.value match { + case null ⇒ ref.path.toString + case address ⇒ ref.path.toStringWithAddress(address) + } + ActorRefProtocol.newBuilder.setPath(identifier).build + } + + /** + * Helper to materialize (lookup) an [[akka.actor.ActorRef]] + * from Akka's protobuf representation in the supplied + * [[akka.actor.ActorSystem]. + */ + def deserializeActorRef(system: ActorSystem, refProtocol: ActorRefProtocol): ActorRef = + system.actorFor(refProtocol.getPath) +} /** * This Serializer serializes `com.google.protobuf.Message`s diff --git a/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala b/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala new file mode 100644 index 0000000000..e38a3e1d1f --- /dev/null +++ b/akka-remote/src/test/scala/akka/serialization/DaemonMsgCreateSerializerSpec.scala @@ -0,0 +1,113 @@ +/** + * Copyright (C) 2009-2012 Typesafe Inc. + */ + +package akka.serialization + +import com.typesafe.config.ConfigFactory +import akka.testkit.AkkaSpec +import akka.actor.Actor +import akka.actor.Address +import akka.actor.Props +import akka.actor.Deploy +import akka.actor.OneForOneStrategy +import akka.actor.SupervisorStrategy +import akka.remote.DaemonMsgCreate +import akka.remote.RemoteScope +import akka.routing.RoundRobinRouter +import akka.routing.FromConfig +import akka.util.duration._ +import akka.actor.FromClassCreator + +object DaemonMsgCreateSerializerSpec { + class MyActor extends Actor { + def receive = { + case _ ⇒ + } + } +} + +@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) +class DaemonMsgCreateSerializerSpec extends AkkaSpec { + + import DaemonMsgCreateSerializerSpec._ + val ser = SerializationExtension(system) + val supervisor = system.actorOf(Props[MyActor], "supervisor") + + "Serialization" must { + + "resolve DaemonMsgCreateSerializer" in { + ser.serializerFor(classOf[DaemonMsgCreate]).getClass must be(classOf[DaemonMsgCreateSerializer]) + } + + "serialize and de-serialize DaemonMsgCreate with FromClassCreator" in { + verifySerialization { + DaemonMsgCreate( + props = Props[MyActor], + deploy = Deploy(), + path = "foo", + supervisor = supervisor) + } + } + + "serialize and de-serialize DaemonMsgCreate with function creator" in { + verifySerialization { + DaemonMsgCreate( + props = Props().withCreator(new MyActor), + deploy = Deploy(), + path = "foo", + supervisor = supervisor) + } + } + + "serialize and de-serialize DaemonMsgCreate with Deploy and RouterConfig" in { + verifySerialization { + // Duration.Inf doesn't equal Duration.Inf, so we use another for test + val supervisorStrategy = OneForOneStrategy(3, 10 seconds) { + case _ ⇒ SupervisorStrategy.Escalate + } + val deploy1 = Deploy( + path = "path1", + config = ConfigFactory.parseString("a=1"), + routerConfig = RoundRobinRouter(nrOfInstances = 5, supervisorStrategy = supervisorStrategy), + scope = RemoteScope(Address("akka", "Test", "host1", 1921))) + val deploy2 = Deploy( + path = "path2", + config = ConfigFactory.parseString("a=2"), + routerConfig = FromConfig, + scope = RemoteScope(Address("akka", "Test", "host2", 1922))) + DaemonMsgCreate( + props = Props[MyActor].withDispatcher("my-disp").withDeploy(deploy1), + deploy = deploy2, + path = "foo", + supervisor = supervisor) + } + } + + def verifySerialization(msg: DaemonMsgCreate): Unit = { + val bytes = ser.serialize(msg) match { + case Left(exception) ⇒ fail(exception) + case Right(bytes) ⇒ bytes + } + ser.deserialize(bytes.asInstanceOf[Array[Byte]], classOf[DaemonMsgCreate]) match { + case Left(exception) ⇒ fail(exception) + case Right(m: DaemonMsgCreate) ⇒ assertDaemonMsgCreate(msg, m) + } + } + + def assertDaemonMsgCreate(expected: DaemonMsgCreate, got: DaemonMsgCreate): Unit = { + // can't compare props.creator when function + if (expected.props.creator.isInstanceOf[FromClassCreator]) + assert(got.props.creator === expected.props.creator) + assert(got.props.dispatcher === expected.props.dispatcher) + assert(got.props.dispatcher === expected.props.dispatcher) + assert(got.props.routerConfig === expected.props.routerConfig) + assert(got.props.deploy === expected.props.deploy) + assert(got.deploy === expected.deploy) + assert(got.path === expected.path) + assert(got.supervisor === expected.supervisor) + } + + } +} + diff --git a/akka-remote/src/test/scala/akka/serialization/DaemonMsgWatchSerializerSpec.scala b/akka-remote/src/test/scala/akka/serialization/DaemonMsgWatchSerializerSpec.scala new file mode 100644 index 0000000000..a6069beac1 --- /dev/null +++ b/akka-remote/src/test/scala/akka/serialization/DaemonMsgWatchSerializerSpec.scala @@ -0,0 +1,49 @@ +/** + * Copyright (C) 2009-2012 Typesafe Inc. + */ + +package akka.serialization + +import akka.testkit.AkkaSpec +import akka.remote.DaemonMsgWatch +import akka.actor.Actor +import akka.actor.Props + +object DaemonMsgWatchSerializerSpec { + class MyActor extends Actor { + def receive = { + case _ ⇒ + } + } +} + +@org.junit.runner.RunWith(classOf[org.scalatest.junit.JUnitRunner]) +class DaemonMsgWatchSerializerSpec extends AkkaSpec { + + import DaemonMsgWatchSerializerSpec._ + + val ser = SerializationExtension(system) + + "Serialization" must { + + "resolve DaemonMsgWatchSerializer" in { + ser.serializerFor(classOf[DaemonMsgWatch]).getClass must be(classOf[DaemonMsgWatchSerializer]) + } + + "serialize and de-serialize DaemonMsgWatch" in { + val watcher = system.actorOf(Props[MyActor], "watcher") + val watched = system.actorOf(Props[MyActor], "watched") + val msg = DaemonMsgWatch(watcher, watched) + val bytes = ser.serialize(msg) match { + case Left(exception) ⇒ fail(exception) + case Right(bytes) ⇒ bytes + } + ser.deserialize(bytes.asInstanceOf[Array[Byte]], classOf[DaemonMsgWatch]) match { + case Left(exception) ⇒ fail(exception) + case Right(m) ⇒ assert(m === msg) + } + } + + } +} + diff --git a/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala index fd763e6bad..f24ea49b8c 100644 --- a/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala +++ b/akka-testkit/src/test/scala/akka/testkit/AkkaSpec.scala @@ -5,7 +5,7 @@ package akka.testkit import org.scalatest.{ WordSpec, BeforeAndAfterAll, Tag } import org.scalatest.matchers.MustMatchers -import akka.actor.{ ActorSystem, ActorSystemImpl } +import akka.actor.ActorSystem import akka.actor.{ Actor, ActorRef, Props } import akka.event.{ Logging, LoggingAdapter } import akka.util.duration._ @@ -72,7 +72,7 @@ abstract class AkkaSpec(_system: ActorSystem) final override def afterAll { system.shutdown() - try Await.ready(system.asInstanceOf[ActorSystemImpl].terminationFuture, 5 seconds) catch { + try system.awaitTermination(5 seconds) catch { case _: TimeoutException ⇒ system.log.warning("Failed to stop [{}] within 5 seconds", system.name) } atTermination() diff --git a/project/AkkaBuild.scala b/project/AkkaBuild.scala index 4804c0f796..d216464fde 100644 --- a/project/AkkaBuild.scala +++ b/project/AkkaBuild.scala @@ -154,7 +154,9 @@ object AkkaBuild extends Build { base = file("akka-durable-mailboxes/akka-mailboxes-common"), dependencies = Seq(remote, testkit % "compile;test->test"), settings = defaultSettings ++ Seq( - libraryDependencies ++= Dependencies.mailboxes + libraryDependencies ++= Dependencies.mailboxes, + // DurableMailboxSpec published in akka-mailboxes-common-test + publishArtifact in Test := true ) ) @@ -257,7 +259,8 @@ object AkkaBuild extends Build { lazy val docs = Project( id = "akka-docs", base = file("akka-docs"), - dependencies = Seq(actor, testkit % "test->test", remote, cluster, slf4j, agent, transactor, fileMailbox, zeroMQ, camel), + dependencies = Seq(actor, testkit % "test->test", mailboxesCommon % "compile;test->test", + remote, cluster, slf4j, agent, transactor, fileMailbox, zeroMQ, camel), settings = defaultSettings ++ Sphinx.settings ++ Seq( unmanagedSourceDirectories in Test <<= baseDirectory { _ ** "code" get }, libraryDependencies ++= Dependencies.docs, @@ -380,7 +383,7 @@ object Dependencies { val fileMailbox = Seq(Test.commonsIo, Test.scalatest, Test.junit) - val kernel = Seq(jmxClient, Test.scalatest, Test.junit) + val kernel = Seq(Test.scalatest, Test.junit) val camel = Seq(camelCore, Test.scalatest, Test.junit, Test.mockito) @@ -408,7 +411,6 @@ object Dependency { // Compile val camelCore = "org.apache.camel" % "camel-core" % V.Camel // ApacheV2 - val jmxClient = "cmdline-jmxclient" % "cmdline-jmxclient" % "0.10.3" // LGPL val netty = "io.netty" % "netty" % V.Netty // ApacheV2 val protobuf = "com.google.protobuf" % "protobuf-java" % V.Protobuf // New BSD val scalaStm = "org.scala-tools" % "scala-stm_2.9.1" % V.ScalaStm // Modified BSD (Scala)