diff --git a/akka-active-object-test/pom.xml b/akka-active-object-test/pom.xml
index dffacd8db0..e498c34d32 100644
--- a/akka-active-object-test/pom.xml
+++ b/akka-active-object-test/pom.xml
@@ -3,7 +3,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
4.0.0
- Akka Active Object Tests in Java
+ Akka TypedActor Tests in Javaakka-active-object-testse.scalablesolutions.akka0.9
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/AllTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/AllTest.java
index 465c9da182..77739f6ff1 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/AllTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/AllTest.java
@@ -10,7 +10,7 @@ public class AllTest extends TestCase {
suite.addTestSuite(InMemoryStateTest.class);
suite.addTestSuite(InMemNestedStateTest.class);
suite.addTestSuite(RemoteInMemoryStateTest.class);
- suite.addTestSuite(ActiveObjectGuiceConfiguratorTest.class);
+ suite.addTestSuite(TypedActorGuiceConfiguratorTest.class);
return suite;
}
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java
index 746df950bf..db9d4d4146 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemNestedStateTest.java
@@ -6,7 +6,7 @@ package se.scalablesolutions.akka.api;
import se.scalablesolutions.akka.config.*;
import se.scalablesolutions.akka.config.Config;
-import se.scalablesolutions.akka.config.ActiveObjectConfigurator;
+import se.scalablesolutions.akka.config.TypedActorConfigurator;
import static se.scalablesolutions.akka.config.JavaConfig.*;
import se.scalablesolutions.akka.actor.*;
import junit.framework.TestCase;
@@ -14,7 +14,7 @@ import junit.framework.TestCase;
public class InMemNestedStateTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectConfigurator conf = new ActiveObjectConfigurator();
+ final private TypedActorConfigurator conf = new TypedActorConfigurator();
public InMemNestedStateTest() {
conf.configure(
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
index 3708d58acc..6562d0d611 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/InMemoryStateTest.java
@@ -8,7 +8,7 @@ import junit.framework.TestCase;
import se.scalablesolutions.akka.config.Config;
import se.scalablesolutions.akka.config.*;
-import se.scalablesolutions.akka.config.ActiveObjectConfigurator;
+import se.scalablesolutions.akka.config.TypedActorConfigurator;
import static se.scalablesolutions.akka.config.JavaConfig.*;
@@ -17,7 +17,7 @@ import se.scalablesolutions.akka.actor.*;
public class InMemoryStateTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectConfigurator conf = new ActiveObjectConfigurator();
+ final private TypedActorConfigurator conf = new TypedActorConfigurator();
public InMemoryStateTest() {
Config.config();
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/MiscActiveObjectTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/MiscActiveObjectTest.java
index e61b8ac07d..aaa97d3587 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/MiscActiveObjectTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/MiscActiveObjectTest.java
@@ -1,7 +1,7 @@
package se.scalablesolutions.akka.api;
-import static se.scalablesolutions.akka.actor.ActiveObject.link;
-import static se.scalablesolutions.akka.actor.ActiveObject.newInstance;
+import static se.scalablesolutions.akka.actor.TypedActor.link;
+import static se.scalablesolutions.akka.actor.TypedActor.newInstance;
import org.junit.Assert;
import org.junit.Test;
@@ -15,7 +15,7 @@ import junit.framework.TestCase;
* @author johanrask
*
*/
-public class MiscActiveObjectTest extends TestCase {
+public class MiscTypedActorTest extends TestCase {
/**
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/RemoteInMemoryStateTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/RemoteInMemoryStateTest.java
index d4b4fd7687..3ae8b647ab 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/RemoteInMemoryStateTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/RemoteInMemoryStateTest.java
@@ -5,8 +5,8 @@
package se.scalablesolutions.akka.api;
import se.scalablesolutions.akka.config.Config;
-import se.scalablesolutions.akka.actor.ActiveObject;
-import se.scalablesolutions.akka.config.ActiveObjectConfigurator;
+import se.scalablesolutions.akka.actor.TypedActor;
+import se.scalablesolutions.akka.config.TypedActorConfigurator;
import se.scalablesolutions.akka.remote.RemoteNode;
import junit.framework.TestCase;
@@ -23,14 +23,14 @@ public class RemoteInMemoryStateTest extends TestCase {
try { Thread.currentThread().sleep(1000); } catch (Exception e) {}
Config.config();
}
- final ActiveObjectConfigurator conf = new ActiveObjectConfigurator();
+ final TypedActorConfigurator conf = new TypedActorConfigurator();
protected void tearDown() {
conf.stop();
}
public void testMapShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 1000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 1000, "localhost", 9999);
stateful.init();
stateful.setMapState("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "init"); // set init state
stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state"); // transactionrequired
@@ -38,10 +38,10 @@ public class RemoteInMemoryStateTest extends TestCase {
}
public void testMapShouldRollbackStateForStatefulServerInCaseOfFailure() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
stateful.init();
stateful.setMapState("testShouldRollbackStateForStatefulServerInCaseOfFailure", "init"); // set init state
- InMemFailer failer = ActiveObject.newRemoteInstance(InMemFailer.class, 1000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
+ InMemFailer failer = TypedActor.newRemoteInstance(InMemFailer.class, 1000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
try {
stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer); // call failing transactionrequired method
fail("should have thrown an exception");
@@ -51,7 +51,7 @@ public class RemoteInMemoryStateTest extends TestCase {
}
public void testVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
stateful.init();
stateful.setVectorState("init"); // set init state
stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state"); // transactionrequired
@@ -59,10 +59,10 @@ public class RemoteInMemoryStateTest extends TestCase {
}
public void testVectorShouldRollbackStateForStatefulServerInCaseOfFailure() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
stateful.init();
stateful.setVectorState("init"); // set init state
- InMemFailer failer = ActiveObject.newRemoteInstance(InMemFailer.class, 10000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
+ InMemFailer failer = TypedActor.newRemoteInstance(InMemFailer.class, 10000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
try {
stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer); // call failing transactionrequired method
fail("should have thrown an exception");
@@ -72,7 +72,7 @@ public class RemoteInMemoryStateTest extends TestCase {
}
public void testRefShouldNotRollbackStateForStatefulServerInCaseOfSuccess() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
stateful.init();
stateful.setRefState("init"); // set init state
stateful.success("testShouldNotRollbackStateForStatefulServerInCaseOfSuccess", "new state"); // transactionrequired
@@ -80,10 +80,10 @@ public class RemoteInMemoryStateTest extends TestCase {
}
public void testRefShouldRollbackStateForStatefulServerInCaseOfFailure() {
- InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
+ InMemStateful stateful = TypedActor.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999);
stateful.init();
stateful.setRefState("init"); // set init state
- InMemFailer failer = ActiveObject.newRemoteInstance(InMemFailer.class, 10000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
+ InMemFailer failer = TypedActor.newRemoteInstance(InMemFailer.class, 10000, "localhost", 9999); //conf.getInstance(InMemFailer.class);
try {
stateful.failure("testShouldRollbackStateForStatefulServerInCaseOfFailure", "new state", failer); // call failing transactionrequired method
fail("should have thrown an exception");
diff --git a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/TypedActorGuiceConfiguratorTest.java
similarity index 87%
rename from akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java
rename to akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/TypedActorGuiceConfiguratorTest.java
index 69f74ec537..e604b4da69 100644
--- a/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/ActiveObjectGuiceConfiguratorTest.java
+++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/TypedActorGuiceConfiguratorTest.java
@@ -10,14 +10,14 @@ import com.google.inject.Scopes;
import junit.framework.TestCase;
import se.scalablesolutions.akka.config.Config;
-import se.scalablesolutions.akka.config.ActiveObjectConfigurator;
+import se.scalablesolutions.akka.config.TypedActorConfigurator;
import static se.scalablesolutions.akka.config.JavaConfig.*;
import se.scalablesolutions.akka.dispatch.*;
-public class ActiveObjectGuiceConfiguratorTest extends TestCase {
+public class TypedActorGuiceConfiguratorTest extends TestCase {
static String messageLog = "";
- final private ActiveObjectConfigurator conf = new ActiveObjectConfigurator();
+ final private TypedActorConfigurator conf = new TypedActorConfigurator();
protected void setUp() {
Config.config();
@@ -46,7 +46,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
}
- public void testGuiceActiveObjectInjection() {
+ public void testGuiceTypedActorInjection() {
messageLog = "";
Foo foo = conf.getInstance(Foo.class);
Bar bar = conf.getInstance(Bar.class);
@@ -69,7 +69,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
}
}
- public void testActiveObjectInvocation() throws InterruptedException {
+ public void testTypedActorInvocation() throws InterruptedException {
messageLog = "";
Foo foo = conf.getInstance(Foo.class);
messageLog += foo.foo("foo ");
@@ -79,7 +79,7 @@ public class ActiveObjectGuiceConfiguratorTest extends TestCase {
assertEquals("foo return_foo before_bar ", messageLog);
}
- public void testActiveObjectInvocationsInvocation() throws InterruptedException {
+ public void testTypedActorInvocationsInvocation() throws InterruptedException {
messageLog = "";
Foo foo = conf.getInstance(Foo.class);
Bar bar = conf.getInstance(Bar.class);
diff --git a/akka-camel/src/main/resources/META-INF/services/org/apache/camel/component/active-object b/akka-camel/src/main/resources/META-INF/services/org/apache/camel/component/active-object
index 5dd88a0671..e004d887b3 100644
--- a/akka-camel/src/main/resources/META-INF/services/org/apache/camel/component/active-object
+++ b/akka-camel/src/main/resources/META-INF/services/org/apache/camel/component/active-object
@@ -1 +1 @@
-class=se.scalablesolutions.akka.camel.component.ActiveObjectComponent
\ No newline at end of file
+class=se.scalablesolutions.akka.camel.component.TypedActorComponent
\ No newline at end of file
diff --git a/akka-camel/src/main/scala/CamelContextLifecycle.scala b/akka-camel/src/main/scala/CamelContextLifecycle.scala
index 640ba14e36..d1683a9464 100644
--- a/akka-camel/src/main/scala/CamelContextLifecycle.scala
+++ b/akka-camel/src/main/scala/CamelContextLifecycle.scala
@@ -9,7 +9,7 @@ import java.util.Map
import org.apache.camel.{ProducerTemplate, CamelContext}
import org.apache.camel.impl.DefaultCamelContext
-import se.scalablesolutions.akka.camel.component.ActiveObjectComponent
+import se.scalablesolutions.akka.camel.component.TypedActorComponent
import se.scalablesolutions.akka.util.Logging
/**
@@ -29,13 +29,13 @@ trait CamelContextLifecycle extends Logging {
private var _started = false
/**
- * Camel component for accessing active objects.
+ * Camel component for accessing typed actors.
*/
- private[camel] var activeObjectComponent: ActiveObjectComponent = _
+ private[camel] var activeObjectComponent: TypedActorComponent = _
/**
- * Registry in which active objects are TEMPORARILY registered during
- * creation of Camel routes to active objects.
+ * Registry in which typed actors are TEMPORARILY registered during
+ * creation of Camel routes to typed actors.
*/
private[camel] var activeObjectRegistry: Map[String, AnyRef] = _
@@ -93,15 +93,15 @@ trait CamelContextLifecycle extends Logging {
* CamelContext stream-caching is enabled. If applications want to disable stream-
* caching they can do so after this method returned and prior to calling start.
* This method also registers a new
- * {@link se.scalablesolutions.akka.camel.component.ActiveObjectComponent} at
- * context under a name defined by ActiveObjectComponent.InternalSchema.
+ * {@link se.scalablesolutions.akka.camel.component.TypedActorComponent} at
+ * context under a name defined by TypedActorComponent.InternalSchema.
*/
def init(context: CamelContext) {
- this.activeObjectComponent = new ActiveObjectComponent
+ this.activeObjectComponent = new TypedActorComponent
this.activeObjectRegistry = activeObjectComponent.activeObjectRegistry
this.context = context
this.context.setStreamCaching(true)
- this.context.addComponent(ActiveObjectComponent.InternalSchema, activeObjectComponent)
+ this.context.addComponent(TypedActorComponent.InternalSchema, activeObjectComponent)
this.template = context.createProducerTemplate
_initialized = true
log.info("Camel context initialized")
diff --git a/akka-camel/src/main/scala/CamelService.scala b/akka-camel/src/main/scala/CamelService.scala
index 11f2907c4d..0fbbceee2e 100644
--- a/akka-camel/src/main/scala/CamelService.scala
+++ b/akka-camel/src/main/scala/CamelService.scala
@@ -10,7 +10,7 @@ import se.scalablesolutions.akka.actor.{AspectInitRegistry, ActorRegistry}
import se.scalablesolutions.akka.util.{Bootable, Logging}
/**
- * Used by applications (and the Kernel) to publish consumer actors and active objects via
+ * Used by applications (and the Kernel) to publish consumer actors and typed actors via
* Camel endpoints and to manage the life cycle of a a global CamelContext which can be
* accessed via se.scalablesolutions.akka.camel.CamelContextManager.context.
*
@@ -33,8 +33,8 @@ trait CamelService extends Bootable with Logging {
* Starts the CamelService. Any started actor that is a consumer actor will be (asynchronously)
* published as Camel endpoint. Consumer actors that are started after this method returned will
* be published as well. Actor publishing is done asynchronously. A started (loaded) CamelService
- * also publishes @consume annotated methods of active objects that have been created
- * with ActiveObject.newInstance(..) (and ActiveObject.newInstance(..)
+ * also publishes @consume annotated methods of typed actors that have been created
+ * with TypedActor.newInstance(..) (and TypedActor.newInstance(..)
* on a remote node).
*/
abstract override def onLoad = {
@@ -44,7 +44,7 @@ trait CamelService extends Bootable with Logging {
if (!initialized) init
if (!started) start
- // start actor that exposes consumer actors and active objects via Camel endpoints
+ // start actor that exposes consumer actors and typed actors via Camel endpoints
consumerPublisher.start
// init publishRequestor so that buffered and future events are delivered to consumerPublisher
diff --git a/akka-camel/src/main/scala/ConsumerPublisher.scala b/akka-camel/src/main/scala/ConsumerPublisher.scala
index e50c625639..6ca863a561 100644
--- a/akka-camel/src/main/scala/ConsumerPublisher.scala
+++ b/akka-camel/src/main/scala/ConsumerPublisher.scala
@@ -13,7 +13,7 @@ import org.apache.camel.builder.RouteBuilder
import se.scalablesolutions.akka.actor._
import se.scalablesolutions.akka.actor.annotation.consume
-import se.scalablesolutions.akka.camel.component.ActiveObjectComponent
+import se.scalablesolutions.akka.camel.component.TypedActorComponent
import se.scalablesolutions.akka.util.Logging
/**
@@ -37,7 +37,7 @@ private[camel] object ConsumerPublisher extends Logging {
}
/**
- * Creates a route to an active object method.
+ * Creates a route to an typed actor method.
*/
def handleConsumerMethodRegistered(event: ConsumerMethodRegistered) {
val targetMethod = event.method.getName
@@ -62,7 +62,7 @@ private[camel] object ConsumerPublisher extends Logging {
}
/**
- * Actor that publishes consumer actors and active object methods at Camel endpoints.
+ * Actor that publishes consumer actors and typed actor methods at Camel endpoints.
* The Camel context used for publishing is CamelContextManager.context. This actor
* accepts messages of type
* se.scalablesolutions.akka.camel.ConsumerRegistered,
@@ -111,10 +111,10 @@ private[camel] case class SetExpectedRegistrationCount(num: Int)
private[camel] case class SetExpectedUnregistrationCount(num: Int)
/**
- * Defines an abstract route to a target which is either an actor or an active object method..
+ * Defines an abstract route to a target which is either an actor or an typed actor method..
*
- * @param endpointUri endpoint URI of the consumer actor or active object method.
- * @param id actor identifier or active object identifier (registry key).
+ * @param endpointUri endpoint URI of the consumer actor or typed actor method.
+ * @param id actor identifier or typed actor identifier (registry key).
*
* @author Martin Krasser
*/
@@ -149,20 +149,20 @@ private[camel] class ConsumerActorRoute(endpointUri: String, uuid: String, block
}
/**
- * Defines the route to an active object method..
+ * Defines the route to an typed actor method..
*
* @param endpointUri endpoint URI of the consumer actor method
- * @param id active object identifier
+ * @param id typed actor identifier
* @param method name of the method to invoke.
*
* @author Martin Krasser
*/
private[camel] class ConsumerMethodRoute(val endpointUri: String, id: String, method: String) extends ConsumerRoute(endpointUri, id) {
- protected override def targetUri = "%s:%s?method=%s" format (ActiveObjectComponent.InternalSchema, id, method)
+ protected override def targetUri = "%s:%s?method=%s" format (TypedActorComponent.InternalSchema, id, method)
}
/**
- * A registration listener that triggers publication of consumer actors and active object
+ * A registration listener that triggers publication of consumer actors and typed actor
* methods as well as un-publication of consumer actors. This actor needs to be initialized
* with a PublishRequestorInit command message for obtaining a reference to
* a publisher actor. Before initialization it buffers all outbound messages
@@ -209,7 +209,7 @@ private[camel] class PublishRequestor extends Actor {
/**
* Command message to initialize a PublishRequestor to use consumerPublisher
- * for publishing actors or active object methods.
+ * for publishing actors or typed actor methods.
*/
private[camel] case class PublishRequestorInit(consumerPublisher: ActorRef)
@@ -244,13 +244,13 @@ private[camel] case class ConsumerRegistered(actorRef: ActorRef, uri: String, uu
private[camel] case class ConsumerUnregistered(actorRef: ActorRef, uri: String, uuid: String) extends ConsumerEvent
/**
- * Event indicating that an active object proxy has been created for a POJO. For each
+ * Event indicating that an typed actor proxy has been created for a POJO. For each
* @consume annotated POJO method a separate instance of this class is
* created.
*
- * @param activeObject active object (proxy).
+ * @param activeObject typed actor (proxy).
* @param init
- * @param uri endpoint URI of the active object method
+ * @param uri endpoint URI of the typed actor method
* @param method method to be published.
*
* @author Martin Krasser
@@ -258,13 +258,13 @@ private[camel] case class ConsumerUnregistered(actorRef: ActorRef, uri: String,
private[camel] case class ConsumerMethodRegistered(activeObject: AnyRef, init: AspectInit, uri: String, method: Method) extends ConsumerEvent
/**
- * Event indicating that an active object has been stopped. For each
+ * Event indicating that an typed actor has been stopped. For each
* @consume annotated POJO method a separate instance of this class is
* created.
*
- * @param activeObject active object (proxy).
+ * @param activeObject typed actor (proxy).
* @param init
- * @param uri endpoint URI of the active object method
+ * @param uri endpoint URI of the typed actor method
* @param method method to be un-published.
*
* @author Martin Krasser
@@ -308,14 +308,14 @@ private[camel] object ConsumerMethod {
/**
* Applies a function f to each consumer method of activeObject and
* returns the function results as a list. A consumer method is one that is annotated with
- * @consume. If activeObject is a proxy for a remote active object
+ * @consume. If activeObject is a proxy for a remote typed actor
* f is never called and Nil is returned.
*/
def forConsumer[T](activeObject: AnyRef, init: AspectInit)(f: Method => T): List[T] = {
// TODO: support consumer annotation inheritance
// - visit overridden methods in superclasses
// - visit implemented method declarations in interfaces
- if (init.remoteAddress.isDefined) Nil // let remote node publish active object methods on endpoints
+ if (init.remoteAddress.isDefined) Nil // let remote node publish typed actor methods on endpoints
else for (m <- activeObject.getClass.getMethods.toList; if (m.isAnnotationPresent(classOf[consume])))
yield f(m)
}
@@ -326,8 +326,8 @@ private[camel] object ConsumerMethod {
*/
private[camel] object ConsumerMethodRegistered {
/**
- * Creates a list of ConsumerMethodRegistered event messages for an active object or an empty
- * list if the active object is a proxy for an remote active object or the active object doesn't
+ * Creates a list of ConsumerMethodRegistered event messages for an typed actor or an empty
+ * list if the typed actor is a proxy for an remote typed actor or the typed actor doesn't
* have any @consume annotated methods.
*/
def forConsumer(activeObject: AnyRef, init: AspectInit): List[ConsumerMethodRegistered] = {
@@ -342,8 +342,8 @@ private[camel] object ConsumerMethodRegistered {
*/
private[camel] object ConsumerMethodUnregistered {
/**
- * Creates a list of ConsumerMethodUnregistered event messages for an active object or an empty
- * list if the active object is a proxy for an remote active object or the active object doesn't
+ * Creates a list of ConsumerMethodUnregistered event messages for an typed actor or an empty
+ * list if the typed actor is a proxy for an remote typed actor or the typed actor doesn't
* have any @consume annotated methods.
*/
def forConsumer(activeObject: AnyRef, init: AspectInit): List[ConsumerMethodUnregistered] = {
diff --git a/akka-camel/src/main/scala/component/ActorComponent.scala b/akka-camel/src/main/scala/component/ActorComponent.scala
index 01e96b6e20..6baeaf8b3e 100644
--- a/akka-camel/src/main/scala/component/ActorComponent.scala
+++ b/akka-camel/src/main/scala/component/ActorComponent.scala
@@ -132,10 +132,8 @@ class ActorProducer(val ep: ActorEndpoint) extends DefaultProducer(ep) with Asyn
result match {
case Some(msg: Failure) => exchange.fromFailureMessage(msg)
case Some(msg) => exchange.fromResponseMessage(Message.canonicalize(msg))
- case None => {
- throw new TimeoutException("timeout (%d ms) while waiting response from %s"
- format (actor.timeout, ep.getEndpointUri))
- }
+ case None => throw new TimeoutException("timeout (%d ms) while waiting response from %s"
+ format (actor.timeout, ep.getEndpointUri))
}
}
diff --git a/akka-camel/src/main/scala/component/ActiveObjectComponent.scala b/akka-camel/src/main/scala/component/TypedActorComponent.scala
similarity index 71%
rename from akka-camel/src/main/scala/component/ActiveObjectComponent.scala
rename to akka-camel/src/main/scala/component/TypedActorComponent.scala
index 05fa026e04..aff6326beb 100644
--- a/akka-camel/src/main/scala/component/ActiveObjectComponent.scala
+++ b/akka-camel/src/main/scala/component/TypedActorComponent.scala
@@ -12,31 +12,31 @@ import org.apache.camel.component.bean._
/**
* @author Martin Krasser
*/
-object ActiveObjectComponent {
+object TypedActorComponent {
/**
- * Default schema name for active object endpoint URIs.
+ * Default schema name for typed actor endpoint URIs.
*/
val InternalSchema = "active-object-internal"
}
/**
- * Camel component for exchanging messages with active objects. This component
- * tries to obtain the active object from the activeObjectRegistry
+ * Camel component for exchanging messages with typed actors. This component
+ * tries to obtain the typed actor from the activeObjectRegistry
* first. If it's not there it tries to obtain it from the CamelContext's registry.
*
* @see org.apache.camel.component.bean.BeanComponent
*
* @author Martin Krasser
*/
-class ActiveObjectComponent extends BeanComponent {
+class TypedActorComponent extends BeanComponent {
val activeObjectRegistry = new ConcurrentHashMap[String, AnyRef]
/**
* Creates a {@link org.apache.camel.component.bean.BeanEndpoint} with a custom
* bean holder that uses activeObjectRegistry for getting access to
- * active objects (beans).
+ * typed actors (beans).
*
- * @see se.scalablesolutions.akka.camel.component.ActiveObjectHolder
+ * @see se.scalablesolutions.akka.camel.component.TypedActorHolder
*/
override def createEndpoint(uri: String, remaining: String, parameters: Map[String, AnyRef]) = {
val endpoint = new BeanEndpoint(uri, this)
@@ -47,26 +47,26 @@ class ActiveObjectComponent extends BeanComponent {
}
private def createBeanHolder(beanName: String) =
- new ActiveObjectHolder(activeObjectRegistry, getCamelContext, beanName).createCacheHolder
+ new TypedActorHolder(activeObjectRegistry, getCamelContext, beanName).createCacheHolder
}
/**
* {@link org.apache.camel.component.bean.BeanHolder} implementation that uses a custom
- * registry for getting access to active objects.
+ * registry for getting access to typed actors.
*
* @author Martin Krasser
*/
-class ActiveObjectHolder(activeObjectRegistry: Map[String, AnyRef], context: CamelContext, name: String)
+class TypedActorHolder(activeObjectRegistry: Map[String, AnyRef], context: CamelContext, name: String)
extends RegistryBean(context, name) {
/**
- * Returns an {@link se.scalablesolutions.akka.camel.component.ActiveObjectInfo} instance.
+ * Returns an {@link se.scalablesolutions.akka.camel.component.TypedActorInfo} instance.
*/
override def getBeanInfo: BeanInfo =
- new ActiveObjectInfo(getContext, getBean.getClass, getParameterMappingStrategy)
+ new TypedActorInfo(getContext, getBean.getClass, getParameterMappingStrategy)
/**
- * Obtains an active object from activeObjectRegistry.
+ * Obtains an typed actor from activeObjectRegistry.
*/
override def getBean: AnyRef = {
val bean = activeObjectRegistry.get(getName)
@@ -75,11 +75,11 @@ class ActiveObjectHolder(activeObjectRegistry: Map[String, AnyRef], context: Cam
}
/**
- * Provides active object meta information.
+ * Provides typed actor meta information.
*
* @author Martin Krasser
*/
-class ActiveObjectInfo(context: CamelContext, clazz: Class[_], strategy: ParameterMappingStrategy)
+class TypedActorInfo(context: CamelContext, clazz: Class[_], strategy: ParameterMappingStrategy)
extends BeanInfo(context, clazz, strategy) {
/**
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBase.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBase.java
index 05bf1625bb..7a9b5c95cc 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBase.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBase.java
@@ -4,11 +4,12 @@ import org.apache.camel.Body;
import org.apache.camel.Header;
import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
/**
* @author Martin Krasser
*/
-public class PojoBase {
+public class PojoBase extends TypedActor implements PojoBaseIntf {
public String m1(String b, String h) {
return "m1base: " + b + " " + h;
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBaseIntf.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBaseIntf.java
new file mode 100644
index 0000000000..2ca8ef4360
--- /dev/null
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoBaseIntf.java
@@ -0,0 +1,21 @@
+package se.scalablesolutions.akka.camel;
+
+import org.apache.camel.Body;
+import org.apache.camel.Header;
+
+import se.scalablesolutions.akka.actor.annotation.consume;
+
+/**
+ * @author Martin Krasser
+ */
+public interface PojoBaseIntf {
+
+ public String m1(String b, String h);
+ @consume("direct:m2base")
+ public String m2(@Body String b, @Header("test") String h);
+ @consume("direct:m3base")
+ public String m3(@Body String b, @Header("test") String h);
+ @consume("direct:m4base")
+ public String m4(@Body String b, @Header("test") String h);
+ public void m5(@Body String b, @Header("test") String h);
+}
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoImpl.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoImpl.java
index b48202d4dc..8866acf573 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoImpl.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoImpl.java
@@ -4,11 +4,12 @@ import org.apache.camel.Body;
import org.apache.camel.Header;
import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
/**
* @author Martin Krasser
*/
-public class PojoImpl implements PojoIntf {
+public class PojoImpl extends TypedActor implements PojoIntf {
public String m1(String b, String h) {
return "m1impl: " + b + " " + h;
@@ -18,6 +19,4 @@ public class PojoImpl implements PojoIntf {
public String m2(@Body String b, @Header("test") String h) {
return "m2impl: " + b + " " + h;
}
-
-
}
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/Pojo.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumer.java
similarity index 57%
rename from akka-camel/src/test/java/se/scalablesolutions/akka/camel/Pojo.java
rename to akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumer.java
index d1848c49ee..fc6ea834fd 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/Pojo.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumer.java
@@ -1,11 +1,11 @@
package se.scalablesolutions.akka.camel;
-import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
/**
* @author Martin Krasser
*/
-public class Pojo {
+public class PojoNonConsumer extends TypedActor implements PojoNonConsumerIntf {
public String foo(String s) {
return String.format("foo: %s", s);
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumerIntf.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumerIntf.java
new file mode 100644
index 0000000000..aec8caaf19
--- /dev/null
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoNonConsumerIntf.java
@@ -0,0 +1,9 @@
+package se.scalablesolutions.akka.camel;
+
+/**
+ * @author Martin Krasser
+ */
+public interface PojoNonConsumerIntf {
+
+ public String foo(String s);
+}
\ No newline at end of file
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemote.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemote.java
index 57b0999b8f..61ea4d7a17 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemote.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemote.java
@@ -1,15 +1,16 @@
package se.scalablesolutions.akka.camel;
import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
/**
* @author Martin Krasser
*/
-public class PojoRemote {
+public class PojoRemote extends TypedActor implements PojoRemoteIntf {
@consume("direct:remote-active-object")
public String foo(String s) {
- return String.format("remote active object: %s", s);
+ return String.format("remote typed actor: %s", s);
}
}
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemoteIntf.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemoteIntf.java
new file mode 100644
index 0000000000..639a440598
--- /dev/null
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoRemoteIntf.java
@@ -0,0 +1,12 @@
+package se.scalablesolutions.akka.camel;
+
+import se.scalablesolutions.akka.actor.annotation.consume;
+
+/**
+ * @author Martin Krasser
+ */
+public interface PojoRemoteIntf {
+
+ @consume("direct:remote-active-object")
+ public String foo(String s);
+}
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingle.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingle.java
index 7d577535b2..d4cbe1aabe 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingle.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingle.java
@@ -1,11 +1,12 @@
package se.scalablesolutions.akka.camel;
import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
/**
* @author Martin Krasser
*/
-public class PojoSingle {
+public class PojoSingle extends TypedActor implements PojoSingleIntf {
@consume("direct:foo")
public void foo(String b) {
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingleIntf.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingleIntf.java
new file mode 100644
index 0000000000..22a25325a3
--- /dev/null
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSingleIntf.java
@@ -0,0 +1,12 @@
+package se.scalablesolutions.akka.camel;
+
+import se.scalablesolutions.akka.actor.annotation.consume;
+
+/**
+ * @author Martin Krasser
+ */
+public interface PojoSingleIntf {
+
+ @consume("direct:foo")
+ public void foo(String b);
+}
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSub.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSub.java
index be5b453698..24caf37348 100644
--- a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSub.java
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSub.java
@@ -4,8 +4,9 @@ import org.apache.camel.Body;
import org.apache.camel.Header;
import se.scalablesolutions.akka.actor.annotation.consume;
+import se.scalablesolutions.akka.actor.*;
-public class PojoSub extends PojoBase {
+public class PojoSub extends PojoBase implements PojoSubIntf {
@Override
@consume("direct:m1sub")
diff --git a/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSubIntf.java b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSubIntf.java
new file mode 100644
index 0000000000..08a153b124
--- /dev/null
+++ b/akka-camel/src/test/java/se/scalablesolutions/akka/camel/PojoSubIntf.java
@@ -0,0 +1,18 @@
+package se.scalablesolutions.akka.camel;
+
+import org.apache.camel.Body;
+import org.apache.camel.Header;
+
+import se.scalablesolutions.akka.actor.annotation.consume;
+
+public interface PojoSubIntf extends PojoBaseIntf {
+ @consume("direct:m1sub")
+ public String m1(@Body String b, @Header("test") String h);
+
+ @Override
+ public String m2(String b, String h);
+
+ @Override
+ @consume("direct:m3sub")
+ public String m3(@Body String b, @Header("test") String h);
+}
diff --git a/akka-camel/src/test/scala/CamelServiceFeatureTest.scala b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala
index 09d386c383..1fcbcadd64 100644
--- a/akka-camel/src/test/scala/CamelServiceFeatureTest.scala
+++ b/akka-camel/src/test/scala/CamelServiceFeatureTest.scala
@@ -7,7 +7,7 @@ import org.apache.camel.builder.RouteBuilder
import org.scalatest.{GivenWhenThen, BeforeAndAfterAll, FeatureSpec}
import se.scalablesolutions.akka.actor.Actor._
-import se.scalablesolutions.akka.actor.{ActiveObject, Actor, ActorRegistry}
+import se.scalablesolutions.akka.actor.{TypedActor, Actor, ActorRegistry}
class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with GivenWhenThen {
import CamelServiceFeatureTest._
@@ -116,13 +116,13 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi
}
}
- feature("Publish active object methods in the global CamelContext") {
+ feature("Publish typed actor methods in the global CamelContext") {
- scenario("access active object methods via Camel direct-endpoints") {
+ scenario("access typed actor methods via Camel direct-endpoints") {
- given("an active object registered after CamelService startup")
+ given("an typed actor registered after CamelService startup")
var latch = service.expectEndpointActivationCount(3)
- val obj = ActiveObject.newInstance(classOf[PojoBase])
+ val obj = TypedActor.newInstance(classOf[PojoBaseIntf], classOf[PojoBase])
assert(latch.await(5000, TimeUnit.MILLISECONDS))
when("requests are sent to published methods")
@@ -137,23 +137,23 @@ class CamelServiceFeatureTest extends FeatureSpec with BeforeAndAfterAll with Gi
// cleanup to avoid conflicts with next test (i.e. avoid multiple consumers on direct-endpoints)
latch = service.expectEndpointDeactivationCount(3)
- ActiveObject.stop(obj)
+ TypedActor.stop(obj)
assert(latch.await(5000, TimeUnit.MILLISECONDS))
}
}
- feature("Unpublish active object method from the global CamelContext") {
+ feature("Unpublish typed actor method from the global CamelContext") {
- scenario("access to unregistered active object method via Camel direct-endpoint fails") {
+ scenario("access to unregistered typed actor method via Camel direct-endpoint fails") {
- given("an active object registered after CamelService startup")
+ given("an typed actor registered after CamelService startup")
var latch = service.expectEndpointActivationCount(3)
- val obj = ActiveObject.newInstance(classOf[PojoBase])
+ val obj = TypedActor.newInstance(classOf[PojoBaseIntf], classOf[PojoBase])
assert(latch.await(5000, TimeUnit.MILLISECONDS))
- when("the active object is stopped")
+ when("the typed actor is stopped")
latch = service.expectEndpointDeactivationCount(3)
- ActiveObject.stop(obj)
+ TypedActor.stop(obj)
assert(latch.await(5000, TimeUnit.MILLISECONDS))
then("the associated endpoints aren't accessible any more")
@@ -180,7 +180,7 @@ object CamelServiceFeatureTest {
}
class TestBlocker(uri: String) extends Actor with Consumer {
- self.timeout = 1
+ self.timeout = 1000
def endpointUri = uri
override def blocking = true
protected def receive = {
diff --git a/akka-camel/src/test/scala/ConsumerMethodRegisteredTest.scala b/akka-camel/src/test/scala/ConsumerMethodRegisteredTest.scala
index 7c28c7d8ee..964fe8e7bf 100644
--- a/akka-camel/src/test/scala/ConsumerMethodRegisteredTest.scala
+++ b/akka-camel/src/test/scala/ConsumerMethodRegisteredTest.scala
@@ -4,7 +4,7 @@ import java.net.InetSocketAddress
import org.scalatest.junit.JUnitSuite
-import se.scalablesolutions.akka.actor.{AspectInit, ActiveObject}
+import se.scalablesolutions.akka.actor.{AspectInit, TypedActor}
import se.scalablesolutions.akka.camel.ConsumerMethodRegistered._
import org.junit.{AfterClass, Test}
@@ -12,8 +12,8 @@ class ConsumerMethodRegisteredTest extends JUnitSuite {
import ConsumerMethodRegisteredTest._
val remoteAddress = new InetSocketAddress("localhost", 8888);
- val remoteAspectInit = AspectInit(classOf[String], null, Some(remoteAddress), 1000)
- val localAspectInit = AspectInit(classOf[String], null, None, 1000)
+ val remoteAspectInit = AspectInit(classOf[String], null, null, Some(remoteAddress), 1000)
+ val localAspectInit = AspectInit(classOf[String], null, null, None, 1000)
val ascendingMethodName = (r1: ConsumerMethodRegistered, r2: ConsumerMethodRegistered) =>
r1.method.getName < r2.method.getName
@@ -44,14 +44,14 @@ class ConsumerMethodRegisteredTest extends JUnitSuite {
}
object ConsumerMethodRegisteredTest {
- val activePojoBase = ActiveObject.newInstance(classOf[PojoBase])
- val activePojoSub = ActiveObject.newInstance(classOf[PojoSub])
- val activePojoIntf = ActiveObject.newInstance(classOf[PojoIntf], new PojoImpl)
+ val activePojoBase = TypedActor.newInstance(classOf[PojoBaseIntf], classOf[PojoBase])
+ val activePojoSub = TypedActor.newInstance(classOf[PojoSubIntf], classOf[PojoSub])
+ val activePojoIntf = TypedActor.newInstance(classOf[PojoIntf], classOf[PojoImpl])
@AfterClass
def afterClass = {
- ActiveObject.stop(activePojoBase)
- ActiveObject.stop(activePojoSub)
- ActiveObject.stop(activePojoIntf)
+ TypedActor.stop(activePojoBase)
+ TypedActor.stop(activePojoSub)
+ TypedActor.stop(activePojoIntf)
}
}
diff --git a/akka-camel/src/test/scala/PublishRequestorTest.scala b/akka-camel/src/test/scala/PublishRequestorTest.scala
index 131f4fe2b5..984f856875 100644
--- a/akka-camel/src/test/scala/PublishRequestorTest.scala
+++ b/akka-camel/src/test/scala/PublishRequestorTest.scala
@@ -32,8 +32,8 @@ class PublishRequestorTest extends JUnitSuite {
}
@Test def shouldReceiveConsumerMethodRegisteredEvent = {
- val obj = ActiveObject.newInstance(classOf[PojoSingle])
- val init = AspectInit(classOf[PojoSingle], null, None, 1000)
+ val obj = TypedActor.newInstance(classOf[PojoSingleIntf], classOf[PojoSingle])
+ val init = AspectInit(classOf[PojoSingleIntf], null, null, None, 1000)
val latch = (publisher !! SetExpectedTestMessageCount(1)).as[CountDownLatch].get
requestor ! AspectInitRegistered(obj, init)
assert(latch.await(5000, TimeUnit.MILLISECONDS))
@@ -45,8 +45,8 @@ class PublishRequestorTest extends JUnitSuite {
}
@Test def shouldReceiveConsumerMethodUnregisteredEvent = {
- val obj = ActiveObject.newInstance(classOf[PojoSingle])
- val init = AspectInit(classOf[PojoSingle], null, None, 1000)
+ val obj = TypedActor.newInstance(classOf[PojoSingleIntf], classOf[PojoSingle])
+ val init = AspectInit(classOf[PojoSingleIntf], null, null, None, 1000)
val latch = (publisher !! SetExpectedTestMessageCount(1)).as[CountDownLatch].get
requestor ! AspectInitUnregistered(obj, init)
assert(latch.await(5000, TimeUnit.MILLISECONDS))
diff --git a/akka-camel/src/test/scala/RemoteConsumerTest.scala b/akka-camel/src/test/scala/RemoteConsumerTest.scala
index 25c6d6b975..3f0770127f 100644
--- a/akka-camel/src/test/scala/RemoteConsumerTest.scala
+++ b/akka-camel/src/test/scala/RemoteConsumerTest.scala
@@ -5,7 +5,7 @@ import java.util.concurrent.{CountDownLatch, TimeUnit}
import org.scalatest.{GivenWhenThen, BeforeAndAfterAll, FeatureSpec}
import se.scalablesolutions.akka.actor.Actor._
-import se.scalablesolutions.akka.actor.{ActiveObject, ActorRegistry, RemoteActor}
+import se.scalablesolutions.akka.actor.{TypedActor, ActorRegistry, RemoteActor}
import se.scalablesolutions.akka.remote.{RemoteClient, RemoteServer}
/**
@@ -55,10 +55,10 @@ class RemoteConsumerTest extends FeatureSpec with BeforeAndAfterAll with GivenWh
}
}
- feature("Client-initiated remote consumer active object") {
+ feature("Client-initiated remote consumer typed actor") {
scenario("access published remote consumer method") {
- given("a client-initiated remote consumer active object")
- val consumer = ActiveObject.newRemoteInstance(classOf[PojoRemote], host, port)
+ given("a client-initiated remote consumer typed actor")
+ val consumer = TypedActor.newRemoteInstance(classOf[PojoRemoteIntf], classOf[PojoRemote], host, port)
when("remote consumer publication is triggered")
var latch = service.expectEndpointActivationCount(1)
@@ -67,7 +67,7 @@ class RemoteConsumerTest extends FeatureSpec with BeforeAndAfterAll with GivenWh
then("the published method is accessible via its endpoint URI")
val response = CamelContextManager.template.requestBody("direct:remote-active-object", "test")
- assert(response === "remote active object: test")
+ assert(response === "remote typed actor: test")
}
}
}
diff --git a/akka-camel/src/test/scala/component/ActiveObjectComponentFeatureTest.scala b/akka-camel/src/test/scala/component/TypedActorComponentFeatureTest.scala
similarity index 76%
rename from akka-camel/src/test/scala/component/ActiveObjectComponentFeatureTest.scala
rename to akka-camel/src/test/scala/component/TypedActorComponentFeatureTest.scala
index d80eedfd7a..4a2c4e8e28 100644
--- a/akka-camel/src/test/scala/component/ActiveObjectComponentFeatureTest.scala
+++ b/akka-camel/src/test/scala/component/TypedActorComponentFeatureTest.scala
@@ -4,7 +4,7 @@ import org.scalatest.{BeforeAndAfterEach, BeforeAndAfterAll, FeatureSpec}
import org.apache.camel.builder.RouteBuilder
import se.scalablesolutions.akka.actor.Actor._
-import se.scalablesolutions.akka.actor.{ActorRegistry, ActiveObject}
+import se.scalablesolutions.akka.actor.{ActorRegistry, TypedActor}
import se.scalablesolutions.akka.camel._
import org.apache.camel.impl.{DefaultCamelContext, SimpleRegistry}
import org.apache.camel.{ResolveEndpointFailedException, ExchangePattern, Exchange, Processor}
@@ -12,14 +12,14 @@ import org.apache.camel.{ResolveEndpointFailedException, ExchangePattern, Exchan
/**
* @author Martin Krasser
*/
-class ActiveObjectComponentFeatureTest extends FeatureSpec with BeforeAndAfterAll with BeforeAndAfterEach {
- import ActiveObjectComponentFeatureTest._
+class TypedActorComponentFeatureTest extends FeatureSpec with BeforeAndAfterAll with BeforeAndAfterEach {
+ import TypedActorComponentFeatureTest._
import CamelContextManager.template
override protected def beforeAll = {
- val activePojo = ActiveObject.newInstance(classOf[Pojo]) // not a consumer
- val activePojoBase = ActiveObject.newInstance(classOf[PojoBase])
- val activePojoIntf = ActiveObject.newInstance(classOf[PojoIntf], new PojoImpl)
+ val activePojo = TypedActor.newInstance(classOf[PojoNonConsumerIntf], classOf[PojoNonConsumer]) // not a consumer
+ val activePojoBase = TypedActor.newInstance(classOf[PojoBaseIntf], classOf[PojoBase])
+ val activePojoIntf = TypedActor.newInstance(classOf[PojoIntf], classOf[PojoImpl])
val registry = new SimpleRegistry
registry.put("pojo", activePojo)
@@ -37,8 +37,8 @@ class ActiveObjectComponentFeatureTest extends FeatureSpec with BeforeAndAfterAl
ActorRegistry.shutdownAll
}
- feature("Communicate with an active object from a Camel application using active object endpoint URIs") {
- import ActiveObjectComponent.InternalSchema
+ feature("Communicate with an typed actor from a Camel application using typed actor endpoint URIs") {
+ import TypedActorComponent.InternalSchema
import ExchangePattern._
scenario("in-out exchange with proxy created from interface and method returning String") {
@@ -81,14 +81,14 @@ class ActiveObjectComponentFeatureTest extends FeatureSpec with BeforeAndAfterAl
}
}
- feature("Communicate with an active object from a Camel application from a custom Camel route") {
+ feature("Communicate with an typed actor from a Camel application from a custom Camel route") {
- scenario("in-out exchange with externally registered active object") {
+ scenario("in-out exchange with externally registered typed actor") {
val result = template.requestBody("direct:test", "test")
assert(result === "foo: test")
}
- scenario("in-out exchange with internally registered active object not possible") {
+ scenario("in-out exchange with internally registered typed actor not possible") {
intercept[ResolveEndpointFailedException] {
template.requestBodyAndHeader("active-object:intf?method=m2", "x", "test", "y")
}
@@ -96,7 +96,7 @@ class ActiveObjectComponentFeatureTest extends FeatureSpec with BeforeAndAfterAl
}
}
-object ActiveObjectComponentFeatureTest {
+object TypedActorComponentFeatureTest {
class CustomRouteBuilder extends RouteBuilder {
def configure = {
from("direct:test").to("active-object:pojo?method=foo")
diff --git a/akka-core/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java b/akka-core/src/main/java/se/scalablesolutions/akka/config/TypedActorGuiceModule.java
similarity index 85%
rename from akka-core/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java
rename to akka-core/src/main/java/se/scalablesolutions/akka/config/TypedActorGuiceModule.java
index 60dfd4cadd..0c2ed11402 100644
--- a/akka-core/src/main/java/se/scalablesolutions/akka/config/ActiveObjectGuiceModule.java
+++ b/akka-core/src/main/java/se/scalablesolutions/akka/config/TypedActorGuiceModule.java
@@ -13,10 +13,10 @@ import com.google.inject.Singleton;
/**
* @author Jonas Bonér
*/
-public class ActiveObjectGuiceModule extends AbstractModule {
+public class TypedActorGuiceModule extends AbstractModule {
private final List bindings;
- public ActiveObjectGuiceModule(final List bindings) {
+ public TypedActorGuiceModule(final List bindings) {
this.bindings = bindings;
}
diff --git a/akka-core/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java b/akka-core/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java
index 9af73c6c77..8babc16770 100644
--- a/akka-core/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java
+++ b/akka-core/src/main/java/se/scalablesolutions/akka/remote/protocol/RemoteProtocol.java
@@ -8,6 +8,75 @@ public final class RemoteProtocol {
public static void registerAllExtensions(
com.google.protobuf.ExtensionRegistry registry) {
}
+ public enum ActorType
+ implements com.google.protobuf.ProtocolMessageEnum {
+ SCALA_ACTOR(0, 1),
+ JAVA_ACTOR(1, 2),
+ TYPED_ACTOR(2, 3),
+ ;
+
+
+ public final int getNumber() { return value; }
+
+ public static ActorType valueOf(int value) {
+ switch (value) {
+ case 1: return SCALA_ACTOR;
+ case 2: return JAVA_ACTOR;
+ case 3: return TYPED_ACTOR;
+ default: return null;
+ }
+ }
+
+ public static com.google.protobuf.Internal.EnumLiteMap
+ internalGetValueMap() {
+ return internalValueMap;
+ }
+ private static com.google.protobuf.Internal.EnumLiteMap
+ internalValueMap =
+ new com.google.protobuf.Internal.EnumLiteMap() {
+ public ActorType findValueByNumber(int number) {
+ return ActorType.valueOf(number)
+ ; }
+ };
+
+ public final com.google.protobuf.Descriptors.EnumValueDescriptor
+ getValueDescriptor() {
+ return getDescriptor().getValues().get(index);
+ }
+ public final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptorForType() {
+ return getDescriptor();
+ }
+ public static final com.google.protobuf.Descriptors.EnumDescriptor
+ getDescriptor() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor().getEnumTypes().get(0);
+ }
+
+ private static final ActorType[] VALUES = {
+ SCALA_ACTOR, JAVA_ACTOR, TYPED_ACTOR,
+ };
+ public static ActorType valueOf(
+ com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+ if (desc.getType() != getDescriptor()) {
+ throw new java.lang.IllegalArgumentException(
+ "EnumValueDescriptor is not for this type.");
+ }
+ return VALUES[desc.getIndex()];
+ }
+ private final int index;
+ private final int value;
+ private ActorType(int index, int value) {
+ this.index = index;
+ this.value = value;
+ }
+
+ static {
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor();
+ }
+
+ // @@protoc_insertion_point(enum_scope:ActorType)
+ }
+
public enum SerializationSchemeType
implements com.google.protobuf.ProtocolMessageEnum {
JAVA(0, 1),
@@ -53,7 +122,7 @@ public final class RemoteProtocol {
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
- return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor().getEnumTypes().get(0);
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor().getEnumTypes().get(1);
}
private static final SerializationSchemeType[] VALUES = {
@@ -120,7 +189,7 @@ public final class RemoteProtocol {
}
public static final com.google.protobuf.Descriptors.EnumDescriptor
getDescriptor() {
- return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor().getEnumTypes().get(1);
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.getDescriptor().getEnumTypes().get(2);
}
private static final LifeCycleType[] VALUES = {
@@ -1870,6 +1939,825 @@ public final class RemoteProtocol {
// @@protoc_insertion_point(class_scope:MessageProtocol)
}
+ public static final class ActorInfoProtocol extends
+ com.google.protobuf.GeneratedMessage {
+ // Use ActorInfoProtocol.newBuilder() to construct.
+ private ActorInfoProtocol() {
+ initFields();
+ }
+ private ActorInfoProtocol(boolean noInit) {}
+
+ private static final ActorInfoProtocol defaultInstance;
+ public static ActorInfoProtocol getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public ActorInfoProtocol getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ActorInfoProtocol_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ActorInfoProtocol_fieldAccessorTable;
+ }
+
+ // required string uuid = 1;
+ public static final int UUID_FIELD_NUMBER = 1;
+ private boolean hasUuid;
+ private java.lang.String uuid_ = "";
+ public boolean hasUuid() { return hasUuid; }
+ public java.lang.String getUuid() { return uuid_; }
+
+ // required string target = 2;
+ public static final int TARGET_FIELD_NUMBER = 2;
+ private boolean hasTarget;
+ private java.lang.String target_ = "";
+ public boolean hasTarget() { return hasTarget; }
+ public java.lang.String getTarget() { return target_; }
+
+ // required uint64 timeout = 3;
+ public static final int TIMEOUT_FIELD_NUMBER = 3;
+ private boolean hasTimeout;
+ private long timeout_ = 0L;
+ public boolean hasTimeout() { return hasTimeout; }
+ public long getTimeout() { return timeout_; }
+
+ // required .ActorType actorType = 4;
+ public static final int ACTORTYPE_FIELD_NUMBER = 4;
+ private boolean hasActorType;
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType actorType_;
+ public boolean hasActorType() { return hasActorType; }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType getActorType() { return actorType_; }
+
+ // optional .TypedActorInfoProtocol typedActorInfo = 5;
+ public static final int TYPEDACTORINFO_FIELD_NUMBER = 5;
+ private boolean hasTypedActorInfo;
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol typedActorInfo_;
+ public boolean hasTypedActorInfo() { return hasTypedActorInfo; }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol getTypedActorInfo() { return typedActorInfo_; }
+
+ private void initFields() {
+ actorType_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.SCALA_ACTOR;
+ typedActorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance();
+ }
+ public final boolean isInitialized() {
+ if (!hasUuid) return false;
+ if (!hasTarget) return false;
+ if (!hasTimeout) return false;
+ if (!hasActorType) return false;
+ if (hasTypedActorInfo()) {
+ if (!getTypedActorInfo().isInitialized()) return false;
+ }
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (hasUuid()) {
+ output.writeString(1, getUuid());
+ }
+ if (hasTarget()) {
+ output.writeString(2, getTarget());
+ }
+ if (hasTimeout()) {
+ output.writeUInt64(3, getTimeout());
+ }
+ if (hasActorType()) {
+ output.writeEnum(4, getActorType().getNumber());
+ }
+ if (hasTypedActorInfo()) {
+ output.writeMessage(5, getTypedActorInfo());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasUuid()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(1, getUuid());
+ }
+ if (hasTarget()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(2, getTarget());
+ }
+ if (hasTimeout()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeUInt64Size(3, getTimeout());
+ }
+ if (hasActorType()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeEnumSize(4, getActorType().getNumber());
+ }
+ if (hasTypedActorInfo()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeMessageSize(5, getTypedActorInfo());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol 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 se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol 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(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder {
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol result;
+
+ // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.newBuilder()
+ private Builder() {}
+
+ private static Builder create() {
+ Builder builder = new Builder();
+ builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol();
+ return builder;
+ }
+
+ protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol internalGetResult() {
+ return result;
+ }
+
+ public Builder clear() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "Cannot call clear() after build().");
+ }
+ result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(result);
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDescriptor();
+ }
+
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol getDefaultInstanceForType() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance();
+ }
+
+ public boolean isInitialized() {
+ return result.isInitialized();
+ }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol build() {
+ if (result != null && !isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return buildPartial();
+ }
+
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ if (!isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return buildPartial();
+ }
+
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol buildPartial() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "build() has already been called on this Builder.");
+ }
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol returnMe = result;
+ result = null;
+ return returnMe;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol) {
+ return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol other) {
+ if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance()) return this;
+ if (other.hasUuid()) {
+ setUuid(other.getUuid());
+ }
+ if (other.hasTarget()) {
+ setTarget(other.getTarget());
+ }
+ if (other.hasTimeout()) {
+ setTimeout(other.getTimeout());
+ }
+ if (other.hasActorType()) {
+ setActorType(other.getActorType());
+ }
+ if (other.hasTypedActorInfo()) {
+ mergeTypedActorInfo(other.getTypedActorInfo());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ 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());
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ return this;
+ }
+ break;
+ }
+ case 10: {
+ setUuid(input.readString());
+ break;
+ }
+ case 18: {
+ setTarget(input.readString());
+ break;
+ }
+ case 24: {
+ setTimeout(input.readUInt64());
+ break;
+ }
+ case 32: {
+ int rawValue = input.readEnum();
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType value = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.valueOf(rawValue);
+ if (value == null) {
+ unknownFields.mergeVarintField(4, rawValue);
+ } else {
+ setActorType(value);
+ }
+ break;
+ }
+ case 42: {
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.newBuilder();
+ if (hasTypedActorInfo()) {
+ subBuilder.mergeFrom(getTypedActorInfo());
+ }
+ input.readMessage(subBuilder, extensionRegistry);
+ setTypedActorInfo(subBuilder.buildPartial());
+ break;
+ }
+ }
+ }
+ }
+
+
+ // required string uuid = 1;
+ public boolean hasUuid() {
+ return result.hasUuid();
+ }
+ public java.lang.String getUuid() {
+ return result.getUuid();
+ }
+ public Builder setUuid(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasUuid = true;
+ result.uuid_ = value;
+ return this;
+ }
+ public Builder clearUuid() {
+ result.hasUuid = false;
+ result.uuid_ = getDefaultInstance().getUuid();
+ return this;
+ }
+
+ // required string target = 2;
+ public boolean hasTarget() {
+ return result.hasTarget();
+ }
+ public java.lang.String getTarget() {
+ return result.getTarget();
+ }
+ public Builder setTarget(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasTarget = true;
+ result.target_ = value;
+ return this;
+ }
+ public Builder clearTarget() {
+ result.hasTarget = false;
+ result.target_ = getDefaultInstance().getTarget();
+ return this;
+ }
+
+ // required uint64 timeout = 3;
+ public boolean hasTimeout() {
+ return result.hasTimeout();
+ }
+ public long getTimeout() {
+ return result.getTimeout();
+ }
+ public Builder setTimeout(long value) {
+ result.hasTimeout = true;
+ result.timeout_ = value;
+ return this;
+ }
+ public Builder clearTimeout() {
+ result.hasTimeout = false;
+ result.timeout_ = 0L;
+ return this;
+ }
+
+ // required .ActorType actorType = 4;
+ public boolean hasActorType() {
+ return result.hasActorType();
+ }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType getActorType() {
+ return result.getActorType();
+ }
+ public Builder setActorType(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasActorType = true;
+ result.actorType_ = value;
+ return this;
+ }
+ public Builder clearActorType() {
+ result.hasActorType = false;
+ result.actorType_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorType.SCALA_ACTOR;
+ return this;
+ }
+
+ // optional .TypedActorInfoProtocol typedActorInfo = 5;
+ public boolean hasTypedActorInfo() {
+ return result.hasTypedActorInfo();
+ }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol getTypedActorInfo() {
+ return result.getTypedActorInfo();
+ }
+ public Builder setTypedActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasTypedActorInfo = true;
+ result.typedActorInfo_ = value;
+ return this;
+ }
+ public Builder setTypedActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.Builder builderForValue) {
+ result.hasTypedActorInfo = true;
+ result.typedActorInfo_ = builderForValue.build();
+ return this;
+ }
+ public Builder mergeTypedActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol value) {
+ if (result.hasTypedActorInfo() &&
+ result.typedActorInfo_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance()) {
+ result.typedActorInfo_ =
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.newBuilder(result.typedActorInfo_).mergeFrom(value).buildPartial();
+ } else {
+ result.typedActorInfo_ = value;
+ }
+ result.hasTypedActorInfo = true;
+ return this;
+ }
+ public Builder clearTypedActorInfo() {
+ result.hasTypedActorInfo = false;
+ result.typedActorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:ActorInfoProtocol)
+ }
+
+ static {
+ defaultInstance = new ActorInfoProtocol(true);
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit();
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:ActorInfoProtocol)
+ }
+
+ public static final class TypedActorInfoProtocol extends
+ com.google.protobuf.GeneratedMessage {
+ // Use TypedActorInfoProtocol.newBuilder() to construct.
+ private TypedActorInfoProtocol() {
+ initFields();
+ }
+ private TypedActorInfoProtocol(boolean noInit) {}
+
+ private static final TypedActorInfoProtocol defaultInstance;
+ public static TypedActorInfoProtocol getDefaultInstance() {
+ return defaultInstance;
+ }
+
+ public TypedActorInfoProtocol getDefaultInstanceForType() {
+ return defaultInstance;
+ }
+
+ public static final com.google.protobuf.Descriptors.Descriptor
+ getDescriptor() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_TypedActorInfoProtocol_descriptor;
+ }
+
+ protected com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internalGetFieldAccessorTable() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_TypedActorInfoProtocol_fieldAccessorTable;
+ }
+
+ // required string interface = 1;
+ public static final int INTERFACE_FIELD_NUMBER = 1;
+ private boolean hasInterface;
+ private java.lang.String interface_ = "";
+ public boolean hasInterface() { return hasInterface; }
+ public java.lang.String getInterface() { return interface_; }
+
+ // required string method = 2;
+ public static final int METHOD_FIELD_NUMBER = 2;
+ private boolean hasMethod;
+ private java.lang.String method_ = "";
+ public boolean hasMethod() { return hasMethod; }
+ public java.lang.String getMethod() { return method_; }
+
+ private void initFields() {
+ }
+ public final boolean isInitialized() {
+ if (!hasInterface) return false;
+ if (!hasMethod) return false;
+ return true;
+ }
+
+ public void writeTo(com.google.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (hasInterface()) {
+ output.writeString(1, getInterface());
+ }
+ if (hasMethod()) {
+ output.writeString(2, getMethod());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (hasInterface()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(1, getInterface());
+ }
+ if (hasMethod()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(2, getMethod());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(
+ com.google.protobuf.ByteString data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(
+ com.google.protobuf.ByteString data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(byte[] data)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(
+ byte[] data,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ return newBuilder().mergeFrom(data, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(
+ java.io.InputStream input,
+ com.google.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input, extensionRegistry)
+ .buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ Builder builder = newBuilder();
+ if (builder.mergeDelimitedFrom(input)) {
+ return builder.buildParsed();
+ } else {
+ return null;
+ }
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol 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 se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol parseFrom(
+ com.google.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return newBuilder().mergeFrom(input).buildParsed();
+ }
+ public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol 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(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ public static final class Builder extends
+ com.google.protobuf.GeneratedMessage.Builder {
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol result;
+
+ // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.newBuilder()
+ private Builder() {}
+
+ private static Builder create() {
+ Builder builder = new Builder();
+ builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol();
+ return builder;
+ }
+
+ protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol internalGetResult() {
+ return result;
+ }
+
+ public Builder clear() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "Cannot call clear() after build().");
+ }
+ result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol();
+ return this;
+ }
+
+ public Builder clone() {
+ return create().mergeFrom(result);
+ }
+
+ public com.google.protobuf.Descriptors.Descriptor
+ getDescriptorForType() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDescriptor();
+ }
+
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol getDefaultInstanceForType() {
+ return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance();
+ }
+
+ public boolean isInitialized() {
+ return result.isInitialized();
+ }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol build() {
+ if (result != null && !isInitialized()) {
+ throw newUninitializedMessageException(result);
+ }
+ return buildPartial();
+ }
+
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol buildParsed()
+ throws com.google.protobuf.InvalidProtocolBufferException {
+ if (!isInitialized()) {
+ throw newUninitializedMessageException(
+ result).asInvalidProtocolBufferException();
+ }
+ return buildPartial();
+ }
+
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol buildPartial() {
+ if (result == null) {
+ throw new IllegalStateException(
+ "build() has already been called on this Builder.");
+ }
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol returnMe = result;
+ result = null;
+ return returnMe;
+ }
+
+ public Builder mergeFrom(com.google.protobuf.Message other) {
+ if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol) {
+ return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol)other);
+ } else {
+ super.mergeFrom(other);
+ return this;
+ }
+ }
+
+ public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol other) {
+ if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.getDefaultInstance()) return this;
+ if (other.hasInterface()) {
+ setInterface(other.getInterface());
+ }
+ if (other.hasMethod()) {
+ setMethod(other.getMethod());
+ }
+ this.mergeUnknownFields(other.getUnknownFields());
+ return this;
+ }
+
+ 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());
+ return this;
+ default: {
+ if (!parseUnknownField(input, unknownFields,
+ extensionRegistry, tag)) {
+ this.setUnknownFields(unknownFields.build());
+ return this;
+ }
+ break;
+ }
+ case 10: {
+ setInterface(input.readString());
+ break;
+ }
+ case 18: {
+ setMethod(input.readString());
+ break;
+ }
+ }
+ }
+ }
+
+
+ // required string interface = 1;
+ public boolean hasInterface() {
+ return result.hasInterface();
+ }
+ public java.lang.String getInterface() {
+ return result.getInterface();
+ }
+ public Builder setInterface(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasInterface = true;
+ result.interface_ = value;
+ return this;
+ }
+ public Builder clearInterface() {
+ result.hasInterface = false;
+ result.interface_ = getDefaultInstance().getInterface();
+ return this;
+ }
+
+ // required string method = 2;
+ public boolean hasMethod() {
+ return result.hasMethod();
+ }
+ public java.lang.String getMethod() {
+ return result.getMethod();
+ }
+ public Builder setMethod(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasMethod = true;
+ result.method_ = value;
+ return this;
+ }
+ public Builder clearMethod() {
+ result.hasMethod = false;
+ result.method_ = getDefaultInstance().getMethod();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:TypedActorInfoProtocol)
+ }
+
+ static {
+ defaultInstance = new TypedActorInfoProtocol(true);
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit();
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:TypedActorInfoProtocol)
+ }
+
public static final class RemoteRequestProtocol extends
com.google.protobuf.GeneratedMessage {
// Use RemoteRequestProtocol.newBuilder() to construct.
@@ -1911,64 +2799,29 @@ public final class RemoteProtocol {
public boolean hasMessage() { return hasMessage; }
public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol getMessage() { return message_; }
- // optional string method = 3;
- public static final int METHOD_FIELD_NUMBER = 3;
- private boolean hasMethod;
- private java.lang.String method_ = "";
- public boolean hasMethod() { return hasMethod; }
- public java.lang.String getMethod() { return method_; }
+ // required .ActorInfoProtocol actorInfo = 3;
+ public static final int ACTORINFO_FIELD_NUMBER = 3;
+ private boolean hasActorInfo;
+ private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol actorInfo_;
+ public boolean hasActorInfo() { return hasActorInfo; }
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol getActorInfo() { return actorInfo_; }
- // required string target = 4;
- public static final int TARGET_FIELD_NUMBER = 4;
- private boolean hasTarget;
- private java.lang.String target_ = "";
- public boolean hasTarget() { return hasTarget; }
- public java.lang.String getTarget() { return target_; }
-
- // required string uuid = 5;
- public static final int UUID_FIELD_NUMBER = 5;
- private boolean hasUuid;
- private java.lang.String uuid_ = "";
- public boolean hasUuid() { return hasUuid; }
- public java.lang.String getUuid() { return uuid_; }
-
- // required uint64 timeout = 6;
- public static final int TIMEOUT_FIELD_NUMBER = 6;
- private boolean hasTimeout;
- private long timeout_ = 0L;
- public boolean hasTimeout() { return hasTimeout; }
- public long getTimeout() { return timeout_; }
-
- // optional string supervisorUuid = 7;
- public static final int SUPERVISORUUID_FIELD_NUMBER = 7;
- private boolean hasSupervisorUuid;
- private java.lang.String supervisorUuid_ = "";
- public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
- public java.lang.String getSupervisorUuid() { return supervisorUuid_; }
-
- // required bool isActor = 8;
- public static final int ISACTOR_FIELD_NUMBER = 8;
- private boolean hasIsActor;
- private boolean isActor_ = false;
- public boolean hasIsActor() { return hasIsActor; }
- public boolean getIsActor() { return isActor_; }
-
- // required bool isOneWay = 9;
- public static final int ISONEWAY_FIELD_NUMBER = 9;
+ // required bool isOneWay = 4;
+ public static final int ISONEWAY_FIELD_NUMBER = 4;
private boolean hasIsOneWay;
private boolean isOneWay_ = false;
public boolean hasIsOneWay() { return hasIsOneWay; }
public boolean getIsOneWay() { return isOneWay_; }
- // required bool isEscaped = 10;
- public static final int ISESCAPED_FIELD_NUMBER = 10;
- private boolean hasIsEscaped;
- private boolean isEscaped_ = false;
- public boolean hasIsEscaped() { return hasIsEscaped; }
- public boolean getIsEscaped() { return isEscaped_; }
+ // optional string supervisorUuid = 5;
+ public static final int SUPERVISORUUID_FIELD_NUMBER = 5;
+ private boolean hasSupervisorUuid;
+ private java.lang.String supervisorUuid_ = "";
+ public boolean hasSupervisorUuid() { return hasSupervisorUuid; }
+ public java.lang.String getSupervisorUuid() { return supervisorUuid_; }
- // optional .RemoteActorRefProtocol sender = 11;
- public static final int SENDER_FIELD_NUMBER = 11;
+ // optional .RemoteActorRefProtocol sender = 6;
+ public static final int SENDER_FIELD_NUMBER = 6;
private boolean hasSender;
private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol sender_;
public boolean hasSender() { return hasSender; }
@@ -1976,18 +2829,16 @@ public final class RemoteProtocol {
private void initFields() {
message_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.getDefaultInstance();
+ actorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance();
sender_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.getDefaultInstance();
}
public final boolean isInitialized() {
if (!hasId) return false;
if (!hasMessage) return false;
- if (!hasTarget) return false;
- if (!hasUuid) return false;
- if (!hasTimeout) return false;
- if (!hasIsActor) return false;
+ if (!hasActorInfo) return false;
if (!hasIsOneWay) return false;
- if (!hasIsEscaped) return false;
if (!getMessage().isInitialized()) return false;
+ if (!getActorInfo().isInitialized()) return false;
if (hasSender()) {
if (!getSender().isInitialized()) return false;
}
@@ -2003,32 +2854,17 @@ public final class RemoteProtocol {
if (hasMessage()) {
output.writeMessage(2, getMessage());
}
- if (hasMethod()) {
- output.writeString(3, getMethod());
- }
- if (hasTarget()) {
- output.writeString(4, getTarget());
- }
- if (hasUuid()) {
- output.writeString(5, getUuid());
- }
- if (hasTimeout()) {
- output.writeUInt64(6, getTimeout());
- }
- if (hasSupervisorUuid()) {
- output.writeString(7, getSupervisorUuid());
- }
- if (hasIsActor()) {
- output.writeBool(8, getIsActor());
+ if (hasActorInfo()) {
+ output.writeMessage(3, getActorInfo());
}
if (hasIsOneWay()) {
- output.writeBool(9, getIsOneWay());
+ output.writeBool(4, getIsOneWay());
}
- if (hasIsEscaped()) {
- output.writeBool(10, getIsEscaped());
+ if (hasSupervisorUuid()) {
+ output.writeString(5, getSupervisorUuid());
}
if (hasSender()) {
- output.writeMessage(11, getSender());
+ output.writeMessage(6, getSender());
}
getUnknownFields().writeTo(output);
}
@@ -2047,41 +2883,21 @@ public final class RemoteProtocol {
size += com.google.protobuf.CodedOutputStream
.computeMessageSize(2, getMessage());
}
- if (hasMethod()) {
+ if (hasActorInfo()) {
size += com.google.protobuf.CodedOutputStream
- .computeStringSize(3, getMethod());
- }
- if (hasTarget()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(4, getTarget());
- }
- if (hasUuid()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(5, getUuid());
- }
- if (hasTimeout()) {
- size += com.google.protobuf.CodedOutputStream
- .computeUInt64Size(6, getTimeout());
- }
- if (hasSupervisorUuid()) {
- size += com.google.protobuf.CodedOutputStream
- .computeStringSize(7, getSupervisorUuid());
- }
- if (hasIsActor()) {
- size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(8, getIsActor());
+ .computeMessageSize(3, getActorInfo());
}
if (hasIsOneWay()) {
size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(9, getIsOneWay());
+ .computeBoolSize(4, getIsOneWay());
}
- if (hasIsEscaped()) {
+ if (hasSupervisorUuid()) {
size += com.google.protobuf.CodedOutputStream
- .computeBoolSize(10, getIsEscaped());
+ .computeStringSize(5, getSupervisorUuid());
}
if (hasSender()) {
size += com.google.protobuf.CodedOutputStream
- .computeMessageSize(11, getSender());
+ .computeMessageSize(6, getSender());
}
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
@@ -2247,29 +3063,14 @@ public final class RemoteProtocol {
if (other.hasMessage()) {
mergeMessage(other.getMessage());
}
- if (other.hasMethod()) {
- setMethod(other.getMethod());
- }
- if (other.hasTarget()) {
- setTarget(other.getTarget());
- }
- if (other.hasUuid()) {
- setUuid(other.getUuid());
- }
- if (other.hasTimeout()) {
- setTimeout(other.getTimeout());
- }
- if (other.hasSupervisorUuid()) {
- setSupervisorUuid(other.getSupervisorUuid());
- }
- if (other.hasIsActor()) {
- setIsActor(other.getIsActor());
+ if (other.hasActorInfo()) {
+ mergeActorInfo(other.getActorInfo());
}
if (other.hasIsOneWay()) {
setIsOneWay(other.getIsOneWay());
}
- if (other.hasIsEscaped()) {
- setIsEscaped(other.getIsEscaped());
+ if (other.hasSupervisorUuid()) {
+ setSupervisorUuid(other.getSupervisorUuid());
}
if (other.hasSender()) {
mergeSender(other.getSender());
@@ -2313,38 +3114,23 @@ public final class RemoteProtocol {
break;
}
case 26: {
- setMethod(input.readString());
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.newBuilder();
+ if (hasActorInfo()) {
+ subBuilder.mergeFrom(getActorInfo());
+ }
+ input.readMessage(subBuilder, extensionRegistry);
+ setActorInfo(subBuilder.buildPartial());
break;
}
- case 34: {
- setTarget(input.readString());
- break;
- }
- case 42: {
- setUuid(input.readString());
- break;
- }
- case 48: {
- setTimeout(input.readUInt64());
- break;
- }
- case 58: {
- setSupervisorUuid(input.readString());
- break;
- }
- case 64: {
- setIsActor(input.readBool());
- break;
- }
- case 72: {
+ case 32: {
setIsOneWay(input.readBool());
break;
}
- case 80: {
- setIsEscaped(input.readBool());
+ case 42: {
+ setSupervisorUuid(input.readString());
break;
}
- case 90: {
+ case 50: {
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.newBuilder();
if (hasSender()) {
subBuilder.mergeFrom(getSender());
@@ -2413,88 +3199,62 @@ public final class RemoteProtocol {
return this;
}
- // optional string method = 3;
- public boolean hasMethod() {
- return result.hasMethod();
+ // required .ActorInfoProtocol actorInfo = 3;
+ public boolean hasActorInfo() {
+ return result.hasActorInfo();
}
- public java.lang.String getMethod() {
- return result.getMethod();
+ public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol getActorInfo() {
+ return result.getActorInfo();
}
- public Builder setMethod(java.lang.String value) {
+ public Builder setActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol value) {
if (value == null) {
- throw new NullPointerException();
- }
- result.hasMethod = true;
- result.method_ = value;
+ throw new NullPointerException();
+ }
+ result.hasActorInfo = true;
+ result.actorInfo_ = value;
return this;
}
- public Builder clearMethod() {
- result.hasMethod = false;
- result.method_ = getDefaultInstance().getMethod();
+ public Builder setActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.Builder builderForValue) {
+ result.hasActorInfo = true;
+ result.actorInfo_ = builderForValue.build();
+ return this;
+ }
+ public Builder mergeActorInfo(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol value) {
+ if (result.hasActorInfo() &&
+ result.actorInfo_ != se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance()) {
+ result.actorInfo_ =
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.newBuilder(result.actorInfo_).mergeFrom(value).buildPartial();
+ } else {
+ result.actorInfo_ = value;
+ }
+ result.hasActorInfo = true;
+ return this;
+ }
+ public Builder clearActorInfo() {
+ result.hasActorInfo = false;
+ result.actorInfo_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.getDefaultInstance();
return this;
}
- // required string target = 4;
- public boolean hasTarget() {
- return result.hasTarget();
+ // required bool isOneWay = 4;
+ public boolean hasIsOneWay() {
+ return result.hasIsOneWay();
}
- public java.lang.String getTarget() {
- return result.getTarget();
+ public boolean getIsOneWay() {
+ return result.getIsOneWay();
}
- public Builder setTarget(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasTarget = true;
- result.target_ = value;
+ public Builder setIsOneWay(boolean value) {
+ result.hasIsOneWay = true;
+ result.isOneWay_ = value;
return this;
}
- public Builder clearTarget() {
- result.hasTarget = false;
- result.target_ = getDefaultInstance().getTarget();
+ public Builder clearIsOneWay() {
+ result.hasIsOneWay = false;
+ result.isOneWay_ = false;
return this;
}
- // required string uuid = 5;
- public boolean hasUuid() {
- return result.hasUuid();
- }
- public java.lang.String getUuid() {
- return result.getUuid();
- }
- public Builder setUuid(java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- result.hasUuid = true;
- result.uuid_ = value;
- return this;
- }
- public Builder clearUuid() {
- result.hasUuid = false;
- result.uuid_ = getDefaultInstance().getUuid();
- return this;
- }
-
- // required uint64 timeout = 6;
- public boolean hasTimeout() {
- return result.hasTimeout();
- }
- public long getTimeout() {
- return result.getTimeout();
- }
- public Builder setTimeout(long value) {
- result.hasTimeout = true;
- result.timeout_ = value;
- return this;
- }
- public Builder clearTimeout() {
- result.hasTimeout = false;
- result.timeout_ = 0L;
- return this;
- }
-
- // optional string supervisorUuid = 7;
+ // optional string supervisorUuid = 5;
public boolean hasSupervisorUuid() {
return result.hasSupervisorUuid();
}
@@ -2515,61 +3275,7 @@ public final class RemoteProtocol {
return this;
}
- // required bool isActor = 8;
- public boolean hasIsActor() {
- return result.hasIsActor();
- }
- public boolean getIsActor() {
- return result.getIsActor();
- }
- public Builder setIsActor(boolean value) {
- result.hasIsActor = true;
- result.isActor_ = value;
- return this;
- }
- public Builder clearIsActor() {
- result.hasIsActor = false;
- result.isActor_ = false;
- return this;
- }
-
- // required bool isOneWay = 9;
- public boolean hasIsOneWay() {
- return result.hasIsOneWay();
- }
- public boolean getIsOneWay() {
- return result.getIsOneWay();
- }
- public Builder setIsOneWay(boolean value) {
- result.hasIsOneWay = true;
- result.isOneWay_ = value;
- return this;
- }
- public Builder clearIsOneWay() {
- result.hasIsOneWay = false;
- result.isOneWay_ = false;
- return this;
- }
-
- // required bool isEscaped = 10;
- public boolean hasIsEscaped() {
- return result.hasIsEscaped();
- }
- public boolean getIsEscaped() {
- return result.getIsEscaped();
- }
- public Builder setIsEscaped(boolean value) {
- result.hasIsEscaped = true;
- result.isEscaped_ = value;
- return this;
- }
- public Builder clearIsEscaped() {
- result.hasIsEscaped = false;
- result.isEscaped_ = false;
- return this;
- }
-
- // optional .RemoteActorRefProtocol sender = 11;
+ // optional .RemoteActorRefProtocol sender = 6;
public boolean hasSender() {
return result.hasSender();
}
@@ -3207,6 +3913,20 @@ public final class RemoteProtocol {
public boolean hasPostRestart() { return hasPostRestart; }
public java.lang.String getPostRestart() { return postRestart_; }
+ // optional string init = 4;
+ public static final int INIT_FIELD_NUMBER = 4;
+ private boolean hasInit;
+ private java.lang.String init_ = "";
+ public boolean hasInit() { return hasInit; }
+ public java.lang.String getInit() { return init_; }
+
+ // optional string shutdown = 5;
+ public static final int SHUTDOWN_FIELD_NUMBER = 5;
+ private boolean hasShutdown;
+ private java.lang.String shutdown_ = "";
+ public boolean hasShutdown() { return hasShutdown; }
+ public java.lang.String getShutdown() { return shutdown_; }
+
private void initFields() {
lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.PERMANENT;
}
@@ -3227,6 +3947,12 @@ public final class RemoteProtocol {
if (hasPostRestart()) {
output.writeString(3, getPostRestart());
}
+ if (hasInit()) {
+ output.writeString(4, getInit());
+ }
+ if (hasShutdown()) {
+ output.writeString(5, getShutdown());
+ }
getUnknownFields().writeTo(output);
}
@@ -3248,6 +3974,14 @@ public final class RemoteProtocol {
size += com.google.protobuf.CodedOutputStream
.computeStringSize(3, getPostRestart());
}
+ if (hasInit()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(4, getInit());
+ }
+ if (hasShutdown()) {
+ size += com.google.protobuf.CodedOutputStream
+ .computeStringSize(5, getShutdown());
+ }
size += getUnknownFields().getSerializedSize();
memoizedSerializedSize = size;
return size;
@@ -3415,6 +4149,12 @@ public final class RemoteProtocol {
if (other.hasPostRestart()) {
setPostRestart(other.getPostRestart());
}
+ if (other.hasInit()) {
+ setInit(other.getInit());
+ }
+ if (other.hasShutdown()) {
+ setShutdown(other.getShutdown());
+ }
this.mergeUnknownFields(other.getUnknownFields());
return this;
}
@@ -3458,6 +4198,14 @@ public final class RemoteProtocol {
setPostRestart(input.readString());
break;
}
+ case 34: {
+ setInit(input.readString());
+ break;
+ }
+ case 42: {
+ setShutdown(input.readString());
+ break;
+ }
}
}
}
@@ -3526,6 +4274,48 @@ public final class RemoteProtocol {
return this;
}
+ // optional string init = 4;
+ public boolean hasInit() {
+ return result.hasInit();
+ }
+ public java.lang.String getInit() {
+ return result.getInit();
+ }
+ public Builder setInit(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasInit = true;
+ result.init_ = value;
+ return this;
+ }
+ public Builder clearInit() {
+ result.hasInit = false;
+ result.init_ = getDefaultInstance().getInit();
+ return this;
+ }
+
+ // optional string shutdown = 5;
+ public boolean hasShutdown() {
+ return result.hasShutdown();
+ }
+ public java.lang.String getShutdown() {
+ return result.getShutdown();
+ }
+ public Builder setShutdown(java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ result.hasShutdown = true;
+ result.shutdown_ = value;
+ return this;
+ }
+ public Builder clearShutdown() {
+ result.hasShutdown = false;
+ result.shutdown_ = getDefaultInstance().getShutdown();
+ return this;
+ }
+
// @@protoc_insertion_point(builder_scope:LifeCycleProtocol)
}
@@ -4212,6 +5002,16 @@ public final class RemoteProtocol {
private static
com.google.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_MessageProtocol_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_ActorInfoProtocol_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_ActorInfoProtocol_fieldAccessorTable;
+ private static com.google.protobuf.Descriptors.Descriptor
+ internal_static_TypedActorInfoProtocol_descriptor;
+ private static
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_TypedActorInfoProtocol_fieldAccessorTable;
private static com.google.protobuf.Descriptors.Descriptor
internal_static_RemoteRequestProtocol_descriptor;
private static
@@ -4262,27 +5062,33 @@ public final class RemoteProtocol {
"tProtocol\"r\n\017MessageProtocol\0225\n\023serializ" +
"ationScheme\030\001 \002(\0162\030.SerializationSchemeT" +
"ype\022\017\n\007message\030\002 \002(\014\022\027\n\017messageManifest\030" +
- "\003 \001(\014\"\374\001\n\025RemoteRequestProtocol\022\n\n\002id\030\001 " +
- "\002(\004\022!\n\007message\030\002 \002(\0132\020.MessageProtocol\022\016" +
- "\n\006method\030\003 \001(\t\022\016\n\006target\030\004 \002(\t\022\014\n\004uuid\030\005" +
- " \002(\t\022\017\n\007timeout\030\006 \002(\004\022\026\n\016supervisorUuid\030",
- "\007 \001(\t\022\017\n\007isActor\030\010 \002(\010\022\020\n\010isOneWay\030\t \002(\010" +
- "\022\021\n\tisEscaped\030\n \002(\010\022\'\n\006sender\030\013 \001(\0132\027.Re" +
- "moteActorRefProtocol\"\252\001\n\023RemoteReplyProt" +
- "ocol\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \001(\0132\020.Mess" +
- "ageProtocol\022%\n\texception\030\003 \001(\0132\022.Excepti" +
- "onProtocol\022\026\n\016supervisorUuid\030\004 \001(\t\022\017\n\007is" +
- "Actor\030\005 \002(\010\022\024\n\014isSuccessful\030\006 \002(\010\"_\n\021Lif" +
- "eCycleProtocol\022!\n\tlifeCycle\030\001 \002(\0162\016.Life" +
- "CycleType\022\022\n\npreRestart\030\002 \001(\t\022\023\n\013postRes" +
- "tart\030\003 \001(\t\"1\n\017AddressProtocol\022\020\n\010hostnam",
- "e\030\001 \002(\t\022\014\n\004port\030\002 \002(\r\"7\n\021ExceptionProtoc" +
- "ol\022\021\n\tclassname\030\001 \002(\t\022\017\n\007message\030\002 \002(\t*]" +
- "\n\027SerializationSchemeType\022\010\n\004JAVA\020\001\022\013\n\007S" +
- "BINARY\020\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JSON\020\004\022" +
- "\014\n\010PROTOBUF\020\005*-\n\rLifeCycleType\022\r\n\tPERMAN" +
- "ENT\020\001\022\r\n\tTEMPORARY\020\002B-\n)se.scalablesolut" +
- "ions.akka.remote.protocolH\001"
+ "\003 \001(\014\"\222\001\n\021ActorInfoProtocol\022\014\n\004uuid\030\001 \002(" +
+ "\t\022\016\n\006target\030\002 \002(\t\022\017\n\007timeout\030\003 \002(\004\022\035\n\tac" +
+ "torType\030\004 \002(\0162\n.ActorType\022/\n\016typedActorI" +
+ "nfo\030\005 \001(\0132\027.TypedActorInfoProtocol\";\n\026Ty",
+ "pedActorInfoProtocol\022\021\n\tinterface\030\001 \002(\t\022" +
+ "\016\n\006method\030\002 \002(\t\"\300\001\n\025RemoteRequestProtoco" +
+ "l\022\n\n\002id\030\001 \002(\004\022!\n\007message\030\002 \002(\0132\020.Message" +
+ "Protocol\022%\n\tactorInfo\030\003 \002(\0132\022.ActorInfoP" +
+ "rotocol\022\020\n\010isOneWay\030\004 \002(\010\022\026\n\016supervisorU" +
+ "uid\030\005 \001(\t\022\'\n\006sender\030\006 \001(\0132\027.RemoteActorR" +
+ "efProtocol\"\252\001\n\023RemoteReplyProtocol\022\n\n\002id" +
+ "\030\001 \002(\004\022!\n\007message\030\002 \001(\0132\020.MessageProtoco" +
+ "l\022%\n\texception\030\003 \001(\0132\022.ExceptionProtocol" +
+ "\022\026\n\016supervisorUuid\030\004 \001(\t\022\017\n\007isActor\030\005 \002(",
+ "\010\022\024\n\014isSuccessful\030\006 \002(\010\"\177\n\021LifeCycleProt" +
+ "ocol\022!\n\tlifeCycle\030\001 \002(\0162\016.LifeCycleType\022" +
+ "\022\n\npreRestart\030\002 \001(\t\022\023\n\013postRestart\030\003 \001(\t" +
+ "\022\014\n\004init\030\004 \001(\t\022\020\n\010shutdown\030\005 \001(\t\"1\n\017Addr" +
+ "essProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004port\030\002 " +
+ "\002(\r\"7\n\021ExceptionProtocol\022\021\n\tclassname\030\001 " +
+ "\002(\t\022\017\n\007message\030\002 \002(\t*=\n\tActorType\022\017\n\013SCA" +
+ "LA_ACTOR\020\001\022\016\n\nJAVA_ACTOR\020\002\022\017\n\013TYPED_ACTO" +
+ "R\020\003*]\n\027SerializationSchemeType\022\010\n\004JAVA\020\001" +
+ "\022\013\n\007SBINARY\020\002\022\016\n\nSCALA_JSON\020\003\022\r\n\tJAVA_JS",
+ "ON\020\004\022\014\n\010PROTOBUF\020\005*-\n\rLifeCycleType\022\r\n\tP" +
+ "ERMANENT\020\001\022\r\n\tTEMPORARY\020\002B-\n)se.scalable" +
+ "solutions.akka.remote.protocolH\001"
};
com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -4313,16 +5119,32 @@ public final class RemoteProtocol {
new java.lang.String[] { "SerializationScheme", "Message", "MessageManifest", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.MessageProtocol.Builder.class);
- internal_static_RemoteRequestProtocol_descriptor =
+ internal_static_ActorInfoProtocol_descriptor =
getDescriptor().getMessageTypes().get(3);
+ internal_static_ActorInfoProtocol_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_ActorInfoProtocol_descriptor,
+ new java.lang.String[] { "Uuid", "Target", "Timeout", "ActorType", "TypedActorInfo", },
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.class,
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ActorInfoProtocol.Builder.class);
+ internal_static_TypedActorInfoProtocol_descriptor =
+ getDescriptor().getMessageTypes().get(4);
+ internal_static_TypedActorInfoProtocol_fieldAccessorTable = new
+ com.google.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_TypedActorInfoProtocol_descriptor,
+ new java.lang.String[] { "Interface", "Method", },
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.class,
+ se.scalablesolutions.akka.remote.protocol.RemoteProtocol.TypedActorInfoProtocol.Builder.class);
+ internal_static_RemoteRequestProtocol_descriptor =
+ getDescriptor().getMessageTypes().get(5);
internal_static_RemoteRequestProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteRequestProtocol_descriptor,
- new java.lang.String[] { "Id", "Message", "Method", "Target", "Uuid", "Timeout", "SupervisorUuid", "IsActor", "IsOneWay", "IsEscaped", "Sender", },
+ new java.lang.String[] { "Id", "Message", "ActorInfo", "IsOneWay", "SupervisorUuid", "Sender", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.Builder.class);
internal_static_RemoteReplyProtocol_descriptor =
- getDescriptor().getMessageTypes().get(4);
+ getDescriptor().getMessageTypes().get(6);
internal_static_RemoteReplyProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_RemoteReplyProtocol_descriptor,
@@ -4330,15 +5152,15 @@ public final class RemoteProtocol {
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.Builder.class);
internal_static_LifeCycleProtocol_descriptor =
- getDescriptor().getMessageTypes().get(5);
+ getDescriptor().getMessageTypes().get(7);
internal_static_LifeCycleProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_LifeCycleProtocol_descriptor,
- new java.lang.String[] { "LifeCycle", "PreRestart", "PostRestart", },
+ new java.lang.String[] { "LifeCycle", "PreRestart", "PostRestart", "Init", "Shutdown", },
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.Builder.class);
internal_static_AddressProtocol_descriptor =
- getDescriptor().getMessageTypes().get(6);
+ getDescriptor().getMessageTypes().get(8);
internal_static_AddressProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_AddressProtocol_descriptor,
@@ -4346,7 +5168,7 @@ public final class RemoteProtocol {
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.class,
se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.Builder.class);
internal_static_ExceptionProtocol_descriptor =
- getDescriptor().getMessageTypes().get(7);
+ getDescriptor().getMessageTypes().get(9);
internal_static_ExceptionProtocol_fieldAccessorTable = new
com.google.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_ExceptionProtocol_descriptor,
diff --git a/akka-core/src/main/protocol/RemoteProtocol.proto b/akka-core/src/main/protocol/RemoteProtocol.proto
index c4e5a8157e..0417251d55 100644
--- a/akka-core/src/main/protocol/RemoteProtocol.proto
+++ b/akka-core/src/main/protocol/RemoteProtocol.proto
@@ -52,21 +52,35 @@ message MessageProtocol {
optional bytes messageManifest = 3;
}
+/**
+ * Defines the actor info.
+ */
+message ActorInfoProtocol {
+ required string uuid = 1;
+ required string target = 2;
+ required uint64 timeout = 3;
+ required ActorType actorType = 4;
+ optional TypedActorInfoProtocol typedActorInfo = 5;
+}
+
+/**
+ * Defines the typed actor extra info.
+ */
+message TypedActorInfoProtocol {
+ required string interface = 1;
+ required string method = 2;
+}
+
/**
* Defines a remote message request.
*/
message RemoteRequestProtocol {
required uint64 id = 1;
required MessageProtocol message = 2;
- optional string method = 3;
- required string target = 4;
- required string uuid = 5;
- required uint64 timeout = 6;
- optional string supervisorUuid = 7;
- required bool isActor = 8;
- required bool isOneWay = 9;
- required bool isEscaped = 10;
- optional RemoteActorRefProtocol sender = 11;
+ required ActorInfoProtocol actorInfo = 3;
+ required bool isOneWay = 4;
+ optional string supervisorUuid = 5;
+ optional RemoteActorRefProtocol sender = 6;
}
/**
@@ -81,6 +95,15 @@ message RemoteReplyProtocol {
required bool isSuccessful = 6;
}
+/**
+ * Defines the actor type.
+ */
+enum ActorType {
+ SCALA_ACTOR = 1;
+ JAVA_ACTOR = 2;
+ TYPED_ACTOR = 3;
+}
+
/**
* Defines the serialization scheme used to serialize the message and/or Actor instance.
*/
@@ -117,6 +140,8 @@ message LifeCycleProtocol {
required LifeCycleType lifeCycle = 1;
optional string preRestart = 2;
optional string postRestart = 3;
+ optional string init = 4;
+ optional string shutdown = 5;
}
/**
diff --git a/akka-core/src/main/resources/META-INF/aop.xml b/akka-core/src/main/resources/META-INF/aop.xml
index 2f8d5159a8..bdc167ca54 100644
--- a/akka-core/src/main/resources/META-INF/aop.xml
+++ b/akka-core/src/main/resources/META-INF/aop.xml
@@ -1,7 +1,7 @@
-
+
diff --git a/akka-core/src/main/scala/actor/ActiveObject.scala b/akka-core/src/main/scala/actor/ActiveObject.scala
deleted file mode 100644
index 83ac1fc924..0000000000
--- a/akka-core/src/main/scala/actor/ActiveObject.scala
+++ /dev/null
@@ -1,853 +0,0 @@
-/**
- * Copyright (C) 2009-2010 Scalable Solutions AB
- */
-
-package se.scalablesolutions.akka.actor
-
-import Actor._
-import se.scalablesolutions.akka.config.FaultHandlingStrategy
-import se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol
-import se.scalablesolutions.akka.remote.{MessageSerializer, RemoteClient, RemoteRequestProtocolIdFactory}
-import se.scalablesolutions.akka.dispatch.{MessageDispatcher, Future, CompletableFuture}
-import se.scalablesolutions.akka.config.ScalaConfig._
-import se.scalablesolutions.akka.serialization.Serializer
-import se.scalablesolutions.akka.util._
-
-import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint}
-import org.codehaus.aspectwerkz.proxy.Proxy
-import org.codehaus.aspectwerkz.annotation.{Aspect, Around}
-
-import java.net.InetSocketAddress
-import java.lang.reflect.{InvocationTargetException, Method}
-
-object Annotations {
- import se.scalablesolutions.akka.actor.annotation._
- val transactionrequired = classOf[transactionrequired]
- val prerestart = classOf[prerestart]
- val postrestart = classOf[postrestart]
- val shutdown = classOf[shutdown]
- val inittransactionalstate = classOf[inittransactionalstate]
-}
-
-/**
- * Configuration factory for Active Objects.
- *
- * FIXDOC: document ActiveObjectConfiguration
- */
-final class ActiveObjectConfiguration {
- private[akka] var _timeout: Long = Actor.TIMEOUT
- private[akka] var _restartCallbacks: Option[RestartCallbacks] = None
- private[akka] var _shutdownCallback: Option[ShutdownCallback] = None
- private[akka] var _transactionRequired = false
- private[akka] var _host: Option[InetSocketAddress] = None
- private[akka] var _messageDispatcher: Option[MessageDispatcher] = None
-
- def timeout = _timeout
- def timeout(timeout: Duration) : ActiveObjectConfiguration = {
- _timeout = timeout.toMillis
- this
- }
-
- def restartCallbacks(pre: String, post: String) : ActiveObjectConfiguration = {
- _restartCallbacks = Some(new RestartCallbacks(pre, post))
- this
- }
-
- def shutdownCallback(down: String) : ActiveObjectConfiguration = {
- _shutdownCallback = Some(new ShutdownCallback(down))
- this
- }
-
- def makeTransactionRequired() : ActiveObjectConfiguration = {
- _transactionRequired = true;
- this
- }
-
- def makeRemote(hostname: String, port: Int) : ActiveObjectConfiguration = {
- _host = Some(new InetSocketAddress(hostname, port))
- this
- }
-
- def dispatcher(messageDispatcher: MessageDispatcher) : ActiveObjectConfiguration = {
- _messageDispatcher = Some(messageDispatcher)
- this
- }
-}
-
-/**
- * Holds RTTI (runtime type information) for the Active Object, f.e. current 'sender'
- * reference, the 'senderFuture' reference etc.
- *
- * In order to make use of this context you have to create a member field in your
- * Active Object that has the type 'ActiveObjectContext', then an instance will
- * be injected for you to use.
- *
- * This class does not contain static information but is updated by the runtime system
- * at runtime.
- *
- * Here is an example of usage:
- *
- * class Ping {
- * // This context will be injected, holds RTTI (runtime type information)
- * // for the current message send
- * private ActiveObjectContext context = null;
- *
- * public void hit(int count) {
- * Pong pong = (Pong) context.getSender();
- * pong.hit(count++)
- * }
- * }
- *
- *
- * @author Jonas Bonér
- */
-final class ActiveObjectContext {
- private[akka] var _sender: AnyRef = _
- private[akka] var _senderFuture: CompletableFuture[Any] = _
-
- /**
- * Returns the current sender Active Object reference.
- * Scala style getter.
- */
- def sender: AnyRef = {
- if (_sender eq null) throw new IllegalActorStateException("Sender reference should not be null.")
- else _sender
- }
-
- /**
- * Returns the current sender Active Object reference.
- * Java style getter.
- */
- def getSender: AnyRef = {
- if (_sender eq null) throw new IllegalActorStateException("Sender reference should not be null.")
- else _sender
- }
-
- /**
- * Returns the current sender future Active Object reference.
- * Scala style getter.
- */
- def senderFuture: Option[CompletableFuture[Any]] = if (_senderFuture eq null) None else Some(_senderFuture)
-
- /**
- * Returns the current sender future Active Object reference.
- * Java style getter.
- * This method returns 'null' if the sender future is not available.
- */
- def getSenderFuture = _senderFuture
-}
-
-/**
- * Internal helper class to help pass the contextual information between threads.
- *
- * @author Jonas Bonér
- */
-private[akka] object ActiveObjectContext {
- import scala.util.DynamicVariable
- private[actor] val sender = new DynamicVariable[AnyRef](null)
- private[actor] val senderFuture = new DynamicVariable[CompletableFuture[Any]](null)
-}
-
-/**
- * Factory class for creating Active Objects out of plain POJOs and/or POJOs with interfaces.
- *
- * @author Jonas Bonér
- */
-object ActiveObject extends Logging {
- import Actor.actorOf
-
- val AKKA_CAMEL_ROUTING_SCHEME = "akka"
- private[actor] val AW_PROXY_PREFIX = "$$ProxiedByAW".intern
-
- def newInstance[T](target: Class[T], timeout: Long): T =
- newInstance(target, actorOf(new Dispatcher(false)), None, timeout)
-
- def newInstance[T](target: Class[T]): T =
- newInstance(target, actorOf(new Dispatcher(false)), None, Actor.TIMEOUT)
-
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long): T =
- newInstance(intf, target, actorOf(new Dispatcher(false)), None, timeout)
-
- def newInstance[T](intf: Class[T], target: AnyRef): T =
- newInstance(intf, target, actorOf(new Dispatcher(false)), None, Actor.TIMEOUT)
-
- def newRemoteInstance[T](target: Class[T], timeout: Long, hostname: String, port: Int): T =
- newInstance(target, actorOf(new Dispatcher(false)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- def newRemoteInstance[T](target: Class[T], hostname: String, port: Int): T =
- newInstance(target, actorOf(new Dispatcher(false)), Some(new InetSocketAddress(hostname, port)), Actor.TIMEOUT)
-
- def newInstance[T](target: Class[T], config: ActiveObjectConfiguration): T = {
- val actor = actorOf(new Dispatcher(config._transactionRequired, config._restartCallbacks, config._shutdownCallback))
- if (config._messageDispatcher.isDefined) {
- actor.dispatcher = config._messageDispatcher.get
- }
- newInstance(target, actor, config._host, config.timeout)
- }
-
- def newInstance[T](intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration): T = {
- val actor = actorOf(new Dispatcher(config._transactionRequired, config._restartCallbacks, config._shutdownCallback))
- if (config._messageDispatcher.isDefined) {
- actor.dispatcher = config._messageDispatcher.get
- }
- newInstance(intf, target, actor, config._host, config.timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(target, actorOf(new Dispatcher(false, restartCallbacks)), None, timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(intf, target, actorOf(new Dispatcher(false, restartCallbacks)), None, timeout)
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean): T =
- newInstance(target, actorOf(new Dispatcher(transactionRequired, None)), None, timeout)
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(target, actorOf(new Dispatcher(transactionRequired, restartCallbacks)), None, timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean): T =
- newInstance(intf, target, actorOf(new Dispatcher(transactionRequired, None)), None, timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(intf, target, actorOf(new Dispatcher(transactionRequired, restartCallbacks)), None, timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, hostname: String, port: Int): T =
- newInstance(intf, target, actorOf(new Dispatcher(false, None)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(intf, target, actorOf(new Dispatcher(false, restartCallbacks)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean, hostname: String, port: Int): T =
- newInstance(target, actorOf(new Dispatcher(transactionRequired, None)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean, hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(target, actorOf(new Dispatcher(transactionRequired, restartCallbacks)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean, hostname: String, port: Int): T =
- newInstance(intf, target, actorOf(new Dispatcher(transactionRequired, None)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean, hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T =
- newInstance(intf, target, actorOf(new Dispatcher(transactionRequired, restartCallbacks)), Some(new InetSocketAddress(hostname, port)), timeout)
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, dispatcher: MessageDispatcher): T = {
- val actor = actorOf(new Dispatcher(false, None))
- actor.dispatcher = dispatcher
- newInstance(target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, dispatcher: MessageDispatcher, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(false, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, dispatcher: MessageDispatcher): T = {
- val actor = actorOf(new Dispatcher(false, None))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long,
- dispatcher: MessageDispatcher, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(false, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, None))
- actor.dispatcher = dispatcher
- newInstance(target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean,
- dispatcher: MessageDispatcher, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, None))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean,
- dispatcher: MessageDispatcher, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, None, timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, dispatcher: MessageDispatcher, hostname: String, port: Int): T = {
- val actor = actorOf(new Dispatcher(false, None))
- actor.dispatcher = dispatcher
- newInstance(target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, dispatcher: MessageDispatcher,
- hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(false, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, dispatcher: MessageDispatcher, hostname: String, port: Int): T = {
- val actor = actorOf(new Dispatcher(false, None))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, dispatcher: MessageDispatcher,
- hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(false, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean,
- dispatcher: MessageDispatcher, hostname: String, port: Int): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, None))
- actor.dispatcher = dispatcher
- newInstance(target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(target: Class[T], config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](target: Class[T], timeout: Long, transactionRequired: Boolean, dispatcher: MessageDispatcher,
- hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean,
- dispatcher: MessageDispatcher, hostname: String, port: Int): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, None))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- @deprecated("use newInstance(intf: Class[T], target: AnyRef, config: ActiveObjectConfiguration) instead")
- def newRemoteInstance[T](intf: Class[T], target: AnyRef, timeout: Long, transactionRequired: Boolean,
- dispatcher: MessageDispatcher, hostname: String, port: Int, restartCallbacks: Option[RestartCallbacks]): T = {
- val actor = actorOf(new Dispatcher(transactionRequired, restartCallbacks))
- actor.dispatcher = dispatcher
- newInstance(intf, target, actor, Some(new InetSocketAddress(hostname, port)), timeout)
- }
-
- private[akka] def newInstance[T](target: Class[T], actorRef: ActorRef, remoteAddress: Option[InetSocketAddress], timeout: Long): T = {
- val proxy = Proxy.newInstance(target, true, false)
- val context = injectActiveObjectContext(proxy)
- actorRef.actor.asInstanceOf[Dispatcher].initialize(target, proxy, context)
- actorRef.timeout = timeout
- if (remoteAddress.isDefined) actorRef.makeRemote(remoteAddress.get)
- AspectInitRegistry.register(proxy, AspectInit(target, actorRef, remoteAddress, timeout))
- actorRef.start
- proxy.asInstanceOf[T]
- }
-
- private[akka] def newInstance[T](intf: Class[T], target: AnyRef, actorRef: ActorRef,
- remoteAddress: Option[InetSocketAddress], timeout: Long): T = {
- val context = injectActiveObjectContext(target)
- val proxy = Proxy.newInstance(Array(intf), Array(target), true, false)
- actorRef.actor.asInstanceOf[Dispatcher].initialize(target.getClass, target, context)
- actorRef.timeout = timeout
- if (remoteAddress.isDefined) actorRef.makeRemote(remoteAddress.get)
- AspectInitRegistry.register(proxy, AspectInit(intf, actorRef, remoteAddress, timeout))
- actorRef.start
- proxy.asInstanceOf[T]
- }
-
- def stop(obj: AnyRef): Unit = {
- val init = AspectInitRegistry.initFor(obj)
- init.actorRef.stop
- }
-
- /**
- * Get the underlying dispatcher actor for the given active object.
- */
- def actorFor(obj: AnyRef): Option[ActorRef] =
- ActorRegistry.actorsFor(classOf[Dispatcher]).find(a => a.actor.asInstanceOf[Dispatcher].target == Some(obj))
-
- /**
- * Links an other active object to this active object.
- * @param supervisor the supervisor active object
- * @param supervised the active object to link
- */
- def link(supervisor: AnyRef, supervised: AnyRef) = {
- val supervisorActor = actorFor(supervisor).getOrElse(
- throw new IllegalActorStateException("Can't link when the supervisor is not an active object"))
- val supervisedActor = actorFor(supervised).getOrElse(
- throw new IllegalActorStateException("Can't link when the supervised is not an active object"))
- supervisorActor.link(supervisedActor)
- }
-
- /**
- * Links an other active object to this active object and sets the fault handling for the supervisor.
- * @param supervisor the supervisor active object
- * @param supervised the active object to link
- * @param handler fault handling strategy
- * @param trapExceptions array of exceptions that should be handled by the supervisor
- */
- def link(supervisor: AnyRef, supervised: AnyRef, handler: FaultHandlingStrategy, trapExceptions: Array[Class[_ <: Throwable]]) = {
- val supervisorActor = actorFor(supervisor).getOrElse(
- throw new IllegalActorStateException("Can't link when the supervisor is not an active object"))
- val supervisedActor = actorFor(supervised).getOrElse(
- throw new IllegalActorStateException("Can't link when the supervised is not an active object"))
- supervisorActor.trapExit = trapExceptions.toList
- supervisorActor.faultHandler = Some(handler)
- supervisorActor.link(supervisedActor)
- }
-
- /**
- * Unlink the supervised active object from the supervisor.
- * @param supervisor the supervisor active object
- * @param supervised the active object to unlink
- */
- def unlink(supervisor: AnyRef, supervised: AnyRef) = {
- val supervisorActor = actorFor(supervisor).getOrElse(
- throw new IllegalActorStateException("Can't unlink when the supervisor is not an active object"))
- val supervisedActor = actorFor(supervised).getOrElse(
- throw new IllegalActorStateException("Can't unlink when the supervised is not an active object"))
- supervisorActor.unlink(supervisedActor)
- }
-
- /**
- * Sets the trap exit for the given supervisor active object.
- * @param supervisor the supervisor active object
- * @param trapExceptions array of exceptions that should be handled by the supervisor
- */
- def trapExit(supervisor: AnyRef, trapExceptions: Array[Class[_ <: Throwable]]) = {
- val supervisorActor = actorFor(supervisor).getOrElse(
- throw new IllegalActorStateException("Can't set trap exceptions when the supervisor is not an active object"))
- supervisorActor.trapExit = trapExceptions.toList
- this
- }
-
- /**
- * Sets the fault handling strategy for the given supervisor active object.
- * @param supervisor the supervisor active object
- * @param handler fault handling strategy
- */
- def faultHandler(supervisor: AnyRef, handler: FaultHandlingStrategy) = {
- val supervisorActor = actorFor(supervisor).getOrElse(
- throw new IllegalActorStateException("Can't set fault handler when the supervisor is not an active object"))
- supervisorActor.faultHandler = Some(handler)
- this
- }
-
- private def injectActiveObjectContext(activeObject: AnyRef): Option[ActiveObjectContext] = {
- def injectActiveObjectContext0(activeObject: AnyRef, clazz: Class[_]): Option[ActiveObjectContext] = {
- val contextField = clazz.getDeclaredFields.toList.find(_.getType == classOf[ActiveObjectContext])
- if (contextField.isDefined) {
- contextField.get.setAccessible(true)
- val context = new ActiveObjectContext
- contextField.get.set(activeObject, context)
- Some(context)
- } else {
- val parent = clazz.getSuperclass
- if (parent != null) injectActiveObjectContext0(activeObject, parent)
- else {
- log.ifTrace("Can't set 'ActiveObjectContext' for ActiveObject [" +
- activeObject.getClass.getName +
- "] since no field of this type could be found.")
- None
- }
- }
- }
- injectActiveObjectContext0(activeObject, activeObject.getClass)
- }
-
- private[akka] def supervise(restartStrategy: RestartStrategy, components: List[Supervise]): Supervisor =
- Supervisor(SupervisorConfig(restartStrategy, components))
-}
-
-private[akka] object AspectInitRegistry extends ListenerManagement {
- private val initializations = new java.util.concurrent.ConcurrentHashMap[AnyRef, AspectInit]
-
- def initFor(target: AnyRef) = {
- initializations.get(target)
- }
-
- def register(target: AnyRef, init: AspectInit) = {
- val res = initializations.put(target, init)
- foreachListener(_ ! AspectInitRegistered(target, init))
- res
- }
-
- def unregister(target: AnyRef) = {
- val res = initializations.remove(target)
- foreachListener(_ ! AspectInitUnregistered(target, res))
- res
- }
-}
-
-private[akka] sealed trait AspectInitRegistryEvent
-private[akka] case class AspectInitRegistered(proxy: AnyRef, init: AspectInit) extends AspectInitRegistryEvent
-private[akka] case class AspectInitUnregistered(proxy: AnyRef, init: AspectInit) extends AspectInitRegistryEvent
-
-private[akka] sealed case class AspectInit(
- val target: Class[_],
- val actorRef: ActorRef,
- val remoteAddress: Option[InetSocketAddress],
- val timeout: Long) {
- def this(target: Class[_], actorRef: ActorRef, timeout: Long) = this(target, actorRef, None, timeout)
-}
-
-/**
- * AspectWerkz Aspect that is turning POJOs into Active Object.
- * Is deployed on a 'per-instance' basis.
- *
- * @author Jonas Bonér
- */
-@Aspect("perInstance")
-private[akka] sealed class ActiveObjectAspect {
- @volatile private var isInitialized = false
- @volatile private var isStopped = false
- private var target: Class[_] = _
- private var actorRef: ActorRef = _
- private var remoteAddress: Option[InetSocketAddress] = _
- private var timeout: Long = _
- @volatile private var instance: AnyRef = _
-
- @Around("execution(* *.*(..))")
- def invoke(joinPoint: JoinPoint): AnyRef = {
- if (!isInitialized) {
- val init = AspectInitRegistry.initFor(joinPoint.getThis)
- target = init.target
- actorRef = init.actorRef
- remoteAddress = init.remoteAddress
- timeout = init.timeout
- isInitialized = true
-
- }
- dispatch(joinPoint)
- }
-
- private def dispatch(joinPoint: JoinPoint) = {
- if (remoteAddress.isDefined) remoteDispatch(joinPoint)
- else localDispatch(joinPoint)
- }
-
- private def localDispatch(joinPoint: JoinPoint): AnyRef = {
- val rtti = joinPoint.getRtti.asInstanceOf[MethodRtti]
- val isOneWay = isVoid(rtti)
- val sender = ActiveObjectContext.sender.value
- val senderFuture = ActiveObjectContext.senderFuture.value
-
- if (!actorRef.isRunning && !isStopped) {
- isStopped = true
- joinPoint.proceed
- } else if (isOneWay) {
- actorRef ! Invocation(joinPoint, true, true, sender, senderFuture)
- null.asInstanceOf[AnyRef]
- } else {
- val result = (actorRef !! (Invocation(joinPoint, false, isOneWay, sender, senderFuture), timeout)).as[AnyRef]
- if (result.isDefined) result.get
- else throw new IllegalActorStateException("No result defined for invocation [" + joinPoint + "]")
- }
- }
-
- private def remoteDispatch(joinPoint: JoinPoint): AnyRef = {
- val rtti = joinPoint.getRtti.asInstanceOf[MethodRtti]
- val isOneWay = isVoid(rtti)
- val (message: Array[AnyRef], isEscaped) = escapeArguments(rtti.getParameterValues)
- val requestBuilder = RemoteRequestProtocol.newBuilder
- .setId(RemoteRequestProtocolIdFactory.nextId)
- .setMessage(MessageSerializer.serialize(message))
- .setMethod(rtti.getMethod.getName)
- .setTarget(target.getName)
- .setUuid(actorRef.uuid)
- .setTimeout(timeout)
- .setIsActor(false)
- .setIsOneWay(isOneWay)
- .setIsEscaped(false)
- val id = actorRef.registerSupervisorAsRemoteActor
- if (id.isDefined) requestBuilder.setSupervisorUuid(id.get)
- val remoteMessage = requestBuilder.build
- val future = RemoteClient.clientFor(remoteAddress.get).send(remoteMessage, None)
- if (isOneWay) null // for void methods
- else {
- if (future.isDefined) {
- future.get.await
- val result = getResultOrThrowException(future.get)
- if (result.isDefined) result.get
- else throw new IllegalActorStateException("No result returned from call to [" + joinPoint + "]")
- } else throw new IllegalActorStateException("No future returned from call to [" + joinPoint + "]")
- }
- }
-
- private def getResultOrThrowException[T](future: Future[T]): Option[T] =
- if (future.exception.isDefined) {
- val (_, cause) = future.exception.get
- throw cause
- } else future.result
-
- private def isVoid(rtti: MethodRtti) = rtti.getMethod.getReturnType == java.lang.Void.TYPE
-
- private def escapeArguments(args: Array[AnyRef]): Tuple2[Array[AnyRef], Boolean] = {
- var isEscaped = false
- val escapedArgs = for (arg <- args) yield {
- val clazz = arg.getClass
- if (clazz.getName.contains(ActiveObject.AW_PROXY_PREFIX)) {
- isEscaped = true
- ActiveObject.AW_PROXY_PREFIX + clazz.getSuperclass.getName
- } else arg
- }
- (escapedArgs, isEscaped)
- }
-}
-
-/**
- * Represents a snapshot of the current invocation.
- *
- * @author Jonas Bonér
- */
-@serializable private[akka] case class Invocation(
- joinPoint: JoinPoint, isOneWay: Boolean, isVoid: Boolean, sender: AnyRef, senderFuture: CompletableFuture[Any]) {
-
- override def toString: String = synchronized {
- "Invocation [" +
- "\n\t\tmethod = " + joinPoint.getRtti.asInstanceOf[MethodRtti].getMethod.getName + " @ " + joinPoint.getTarget.getClass.getName +
- "\n\t\tisOneWay = " + isOneWay +
- "\n\t\tisVoid = " + isVoid +
- "\n\t\tsender = " + sender +
- "\n\t\tsenderFuture = " + senderFuture +
- "]"
- }
-
- override def hashCode: Int = synchronized {
- var result = HashCode.SEED
- result = HashCode.hash(result, joinPoint)
- result = HashCode.hash(result, isOneWay)
- result = HashCode.hash(result, isVoid)
- result = HashCode.hash(result, sender)
- result = HashCode.hash(result, senderFuture)
- result
- }
-
- override def equals(that: Any): Boolean = synchronized {
- that != null &&
- that.isInstanceOf[Invocation] &&
- that.asInstanceOf[Invocation].joinPoint == joinPoint &&
- that.asInstanceOf[Invocation].isOneWay == isOneWay &&
- that.asInstanceOf[Invocation].isVoid == isVoid &&
- that.asInstanceOf[Invocation].sender == sender &&
- that.asInstanceOf[Invocation].senderFuture == senderFuture
- }
-}
-
-object Dispatcher {
- val ZERO_ITEM_CLASS_ARRAY = Array[Class[_]]()
- val ZERO_ITEM_OBJECT_ARRAY = Array[Object]()
- var crashedActorTl:ThreadLocal[Dispatcher] = new ThreadLocal();
-}
-
-/**
- * Generic Actor managing Invocation dispatch, transaction and error management.
- *
- * @author Jonas Bonér
- */
-private[akka] class Dispatcher(transactionalRequired: Boolean,
- var restartCallbacks: Option[RestartCallbacks] = None,
- var shutdownCallback: Option[ShutdownCallback] = None) extends Actor {
- import Dispatcher._
-
- private[actor] var target: Option[AnyRef] = None
- private var zhutdown: Option[Method] = None
- private var preRestart: Option[Method] = None
- private var postRestart: Option[Method] = None
- private var initTxState: Option[Method] = None
- private var context: Option[ActiveObjectContext] = None
- private var targetClass:Class[_] = _
-
- def this(transactionalRequired: Boolean) = this(transactionalRequired,None)
-
- private[actor] def initialize(targetClass: Class[_], targetInstance: AnyRef, ctx: Option[ActiveObjectContext]) = {
-
- if (transactionalRequired || targetClass.isAnnotationPresent(Annotations.transactionrequired))
- self.makeTransactionRequired
- self.id = targetClass.getName
- this.targetClass = targetClass
- target = Some(targetInstance)
- context = ctx
- val methods = targetInstance.getClass.getDeclaredMethods.toList
-
- if (self.lifeCycle.isEmpty) self.lifeCycle = Some(LifeCycle(Permanent))
-
- // See if we have any config define restart callbacks
- restartCallbacks match {
- case None => {}
- case Some(RestartCallbacks(pre, post)) =>
- preRestart = Some(try {
- targetInstance.getClass.getDeclaredMethod(pre, ZERO_ITEM_CLASS_ARRAY: _*)
- } catch { case e => throw new IllegalActorStateException(
- "Could not find pre restart method [" + pre + "] \nin [" +
- targetClass.getName + "]. \nIt must have a zero argument definition.") })
- postRestart = Some(try {
- targetInstance.getClass.getDeclaredMethod(post, ZERO_ITEM_CLASS_ARRAY: _*)
- } catch { case e => throw new IllegalActorStateException(
- "Could not find post restart method [" + post + "] \nin [" +
- targetClass.getName + "]. \nIt must have a zero argument definition.") })
- }
- // See if we have any config define a shutdown callback
- shutdownCallback match {
- case None => {}
- case Some(ShutdownCallback(down)) =>
- zhutdown = Some(try {
- targetInstance.getClass.getDeclaredMethod(down, ZERO_ITEM_CLASS_ARRAY: _*)
- } catch { case e => throw new IllegalStateException(
- "Could not find shutdown method [" + down + "] \nin [" +
- targetClass.getName + "]. \nIt must have a zero argument definition.") })
- }
-
- // See if we have any annotation defined restart callbacks
- if (!preRestart.isDefined) preRestart = methods.find(m => m.isAnnotationPresent(Annotations.prerestart))
- if (!postRestart.isDefined) postRestart = methods.find(m => m.isAnnotationPresent(Annotations.postrestart))
- // See if we have an annotation defined shutdown callback
- if (!zhutdown.isDefined) zhutdown = methods.find(m => m.isAnnotationPresent(Annotations.shutdown))
-
- if (preRestart.isDefined && preRestart.get.getParameterTypes.length != 0)
- throw new IllegalActorStateException(
- "Method annotated with @prerestart or defined as a restart callback in \n[" +
- targetClass.getName + "] must have a zero argument definition")
- if (postRestart.isDefined && postRestart.get.getParameterTypes.length != 0)
- throw new IllegalActorStateException(
- "Method annotated with @postrestart or defined as a restart callback in \n[" +
- targetClass.getName + "] must have a zero argument definition")
- if (zhutdown.isDefined && zhutdown.get.getParameterTypes.length != 0)
- throw new IllegalStateException(
- "Method annotated with @shutdown or defined as a shutdown callback in \n[" +
- targetClass.getName + "] must have a zero argument definition")
-
- if (preRestart.isDefined) preRestart.get.setAccessible(true)
- if (postRestart.isDefined) postRestart.get.setAccessible(true)
- if (zhutdown.isDefined) zhutdown.get.setAccessible(true)
-
- // see if we have a method annotated with @inittransactionalstate, if so invoke it
- initTxState = methods.find(m => m.isAnnotationPresent(Annotations.inittransactionalstate))
- if (initTxState.isDefined && initTxState.get.getParameterTypes.length != 0)
- throw new IllegalActorStateException("Method annotated with @inittransactionalstate must have a zero argument definition")
- if (initTxState.isDefined) initTxState.get.setAccessible(true)
- }
-
- def receive = {
- case invocation @ Invocation(joinPoint, isOneWay, _, sender, senderFuture) =>
- ActiveObject.log.ifTrace("Invoking active object with message:\n" + invocation)
- context.foreach { ctx =>
- if (sender ne null) ctx._sender = sender
- if (senderFuture ne null) ctx._senderFuture = senderFuture
- }
- ActiveObjectContext.sender.value = joinPoint.getThis // set next sender
- self.senderFuture.foreach(ActiveObjectContext.senderFuture.value = _)
- if (Actor.SERIALIZE_MESSAGES) serializeArguments(joinPoint)
- if (isOneWay) joinPoint.proceed
- else self.reply(joinPoint.proceed)
-
- // Jan Kronquist: started work on issue 121
- case Link(target) => self.link(target)
- case Unlink(target) => self.unlink(target)
- case unexpected => throw new IllegalActorStateException(
- "Unexpected message [" + unexpected + "] sent to [" + this + "]")
- }
-
- override def preRestart(reason: Throwable) {
- try {
- // Since preRestart is called we know that this dispatcher
- // is about to be restarted. Put the instance in a thread
- // local so the new dispatcher can be initialized with the
- // contents of the old.
- //FIXME - This should be considered as a workaround.
- crashedActorTl.set(this)
- preRestart.foreach(_.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*))
- } catch { case e: InvocationTargetException => throw e.getCause }
- }
-
- override def postRestart(reason: Throwable) {
- try {
- postRestart.foreach(_.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*))
- } catch { case e: InvocationTargetException => throw e.getCause }
- }
-
- override def init = {
- // Get the crashed dispatcher from thread local and intitialize this actor with the
- // contents of the old dispatcher
- val oldActor = crashedActorTl.get();
- if (oldActor != null) {
- initialize(oldActor.targetClass, oldActor.target.get, oldActor.context)
- crashedActorTl.set(null)
- }
- }
-
- override def shutdown = {
- try {
- zhutdown.foreach(_.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*))
- } catch { case e: InvocationTargetException => throw e.getCause
- } finally {
- AspectInitRegistry.unregister(target.get);
- }
- }
-
- override def initTransactionalState = {
- try {
- if (initTxState.isDefined && target.isDefined) initTxState.get.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*)
- } catch { case e: InvocationTargetException => throw e.getCause }
- }
-
- private def serializeArguments(joinPoint: JoinPoint) = {
- val args = joinPoint.getRtti.asInstanceOf[MethodRtti].getParameterValues
- var unserializable = false
- var hasMutableArgument = false
- for (arg <- args.toList) {
- if (!arg.isInstanceOf[String] &&
- !arg.isInstanceOf[Byte] &&
- !arg.isInstanceOf[Int] &&
- !arg.isInstanceOf[Long] &&
- !arg.isInstanceOf[Float] &&
- !arg.isInstanceOf[Double] &&
- !arg.isInstanceOf[Boolean] &&
- !arg.isInstanceOf[Char] &&
- !arg.isInstanceOf[java.lang.Byte] &&
- !arg.isInstanceOf[java.lang.Integer] &&
- !arg.isInstanceOf[java.lang.Long] &&
- !arg.isInstanceOf[java.lang.Float] &&
- !arg.isInstanceOf[java.lang.Double] &&
- !arg.isInstanceOf[java.lang.Boolean] &&
- !arg.isInstanceOf[java.lang.Character]) {
- hasMutableArgument = true
- }
- if (arg.getClass.getName.contains(ActiveObject.AW_PROXY_PREFIX)) unserializable = true
- }
- if (!unserializable && hasMutableArgument) {
- val copyOfArgs = Serializer.Java.deepClone(args)
- joinPoint.getRtti.asInstanceOf[MethodRtti].setParameterValues(copyOfArgs.asInstanceOf[Array[AnyRef]])
- }
- }
-}
diff --git a/akka-core/src/main/scala/actor/Actor.scala b/akka-core/src/main/scala/actor/Actor.scala
index b99ce22a93..1de3997c12 100644
--- a/akka-core/src/main/scala/actor/Actor.scala
+++ b/akka-core/src/main/scala/actor/Actor.scala
@@ -436,12 +436,12 @@ trait Actor extends Logging {
}
private val lifeCycles: Receive = {
- case HotSwap(code) => become(code)
- case Exit(dead, reason) => self.handleTrapExit(dead, reason)
- case Link(child) => self.link(child)
- case Unlink(child) => self.unlink(child)
+ case HotSwap(code) => become(code)
+ case Exit(dead, reason) => self.handleTrapExit(dead, reason)
+ case Link(child) => self.link(child)
+ case Unlink(child) => self.unlink(child)
case UnlinkAndStop(child) => self.unlink(child); child.stop
- case Restart(reason) => throw reason
+ case Restart(reason) => throw reason
}
}
diff --git a/akka-core/src/main/scala/actor/ActorRef.scala b/akka-core/src/main/scala/actor/ActorRef.scala
index 8e233db649..ca55d6c1fa 100644
--- a/akka-core/src/main/scala/actor/ActorRef.scala
+++ b/akka-core/src/main/scala/actor/ActorRef.scala
@@ -291,15 +291,15 @@ trait ActorRef extends TransactionManagement {
def !!(message: Any, timeout: Long = this.timeout)(implicit sender: Option[ActorRef] = None): Option[Any] = {
if (isRunning) {
val future = postMessageToMailboxAndCreateFutureResultWithTimeout[Any](message, timeout, sender, None)
- val isActiveObject = message.isInstanceOf[Invocation]
- if (isActiveObject && message.asInstanceOf[Invocation].isVoid) {
+ val isTypedActor = message.isInstanceOf[Invocation]
+ if (isTypedActor && message.asInstanceOf[Invocation].isVoid) {
future.asInstanceOf[CompletableFuture[Option[_]]].completeWithResult(None)
}
try {
future.await
} catch {
case e: FutureTimeoutException =>
- if (isActiveObject) throw e
+ if (isTypedActor) throw e
else None
}
if (future.exception.isDefined) throw future.exception.get._2
@@ -347,7 +347,7 @@ trait ActorRef extends TransactionManagement {
"\n\tNo sender in scope, can't reply. " +
"\n\tYou have probably: " +
"\n\t\t1. Sent a message to an Actor from an instance that is NOT an Actor." +
- "\n\t\t2. Invoked a method on an Active Object from an instance NOT an Active Object." +
+ "\n\t\t2. Invoked a method on an TypedActor from an instance NOT an TypedActor." +
"\n\tElse you might want to use 'reply_?' which returns Boolean(true) if succes and Boolean(false) if no sender in scope")
/**
@@ -1012,20 +1012,14 @@ sealed class LocalActorRef private[akka](
guard.withGuard {
lifeCycle match {
case Some(LifeCycle(Temporary, _, _)) => shutDownTemporaryActor(this)
- case _ =>
+ case _ =>
// either permanent or none where default is permanent
Actor.log.info("Restarting actor [%s] configured as PERMANENT.", id)
Actor.log.debug("Restarting linked actors for actor [%s].", id)
restartLinkedActors(reason, maxNrOfRetries, withinTimeRange)
Actor.log.debug("Invoking 'preRestart' for failed actor instance [%s].", id)
- failedActor.preRestart(reason)
- nullOutActorRefReferencesFor(failedActor)
- val freshActor = newActor
- freshActor.init
- freshActor.initTransactionalState
- actorInstance.set(freshActor)
- Actor.log.debug("Invoking 'postRestart' for new actor instance [%s].", id)
- freshActor.postRestart(reason)
+ if (isTypedActorDispatcher(failedActor)) restartTypedActorDispatcher(failedActor, reason)
+ else restartActor(failedActor, reason)
_isBeingRestarted = false
}
}
@@ -1062,6 +1056,24 @@ sealed class LocalActorRef private[akka](
// ========= PRIVATE FUNCTIONS =========
+ private def isTypedActorDispatcher(a: Actor): Boolean = a.isInstanceOf[Dispatcher]
+
+ private def restartTypedActorDispatcher(failedActor: Actor, reason: Throwable) = {
+ failedActor.preRestart(reason)
+ failedActor.postRestart(reason)
+ }
+
+ private def restartActor(failedActor: Actor, reason: Throwable) = {
+ failedActor.preRestart(reason)
+ nullOutActorRefReferencesFor(failedActor)
+ val freshActor = newActor
+ freshActor.init
+ freshActor.initTransactionalState
+ actorInstance.set(freshActor)
+ Actor.log.debug("Invoking 'postRestart' for new actor instance [%s].", id)
+ freshActor.postRestart(reason)
+ }
+
private def spawnButDoNotStart[T <: Actor: Manifest]: ActorRef = guard.withGuard {
val actorRef = Actor.actorOf(manifest[T].erasure.asInstanceOf[Class[T]].newInstance)
if (!dispatcher.isInstanceOf[ThreadBasedDispatcher]) actorRef.dispatcher = dispatcher
@@ -1102,7 +1114,8 @@ sealed class LocalActorRef private[akka](
createNewTransactionSet
} else oldTxSet
Actor.log.ifTrace("Joining transaction set [" + currentTxSet +
- "];\n\tactor " + toString + "\n\twith message [" + message + "]")
+ "];\n\tactor " + toString +
+ "\n\twith message [" + message + "]")
val mtx = ThreadLocalTransaction.getThreadLocalTransaction
if ((mtx eq null) || mtx.getStatus.isDead) currentTxSet.incParties
else currentTxSet.incParties(mtx, 1)
@@ -1142,8 +1155,7 @@ sealed class LocalActorRef private[akka](
new TransactionSetAbortedException("Transaction set has been aborted by another participant"),
message, topLevelTransaction)
case e: InterruptedException => {} // received message while actor is shutting down, ignore
- case e =>
- handleExceptionInDispatch(e, message, topLevelTransaction)
+ case e => handleExceptionInDispatch(e, message, topLevelTransaction)
} finally {
clearTransaction
if (topLevelTransaction) clearTransactionSet
diff --git a/akka-core/src/main/scala/actor/SerializationProtocol.scala b/akka-core/src/main/scala/actor/SerializationProtocol.scala
index 13e8230638..3897d3abda 100644
--- a/akka-core/src/main/scala/actor/SerializationProtocol.scala
+++ b/akka-core/src/main/scala/actor/SerializationProtocol.scala
@@ -122,7 +122,8 @@ object ActorSerialization {
private def fromBinaryToLocalActorRef[T <: Actor](bytes: Array[Byte], format: Format[T]): ActorRef =
fromProtobufToLocalActorRef(SerializedActorRefProtocol.newBuilder.mergeFrom(bytes).build, format, None)
- private def fromProtobufToLocalActorRef[T <: Actor](protocol: SerializedActorRefProtocol, format: Format[T], loader: Option[ClassLoader]): ActorRef = {
+ private def fromProtobufToLocalActorRef[T <: Actor](
+ protocol: SerializedActorRefProtocol, format: Format[T], loader: Option[ClassLoader]): ActorRef = {
Actor.log.debug("Deserializing SerializedActorRefProtocol to LocalActorRef:\n" + protocol)
val serializer =
@@ -225,26 +226,30 @@ object RemoteActorSerialization {
.build
}
- def createRemoteRequestProtocolBuilder(ar: ActorRef,
- message: Any, isOneWay: Boolean, senderOption: Option[ActorRef]): RemoteRequestProtocol.Builder = {
- import ar._
- val protocol = RemoteRequestProtocol.newBuilder
- .setId(RemoteRequestProtocolIdFactory.nextId)
- .setMessage(MessageSerializer.serialize(message))
+ def createRemoteRequestProtocolBuilder(actorRef: ActorRef, message: Any, isOneWay: Boolean, senderOption: Option[ActorRef]):
+ RemoteRequestProtocol.Builder = {
+ import actorRef._
+
+ val actorInfo = ActorInfoProtocol.newBuilder
+ .setUuid(uuid)
.setTarget(actorClassName)
.setTimeout(timeout)
- .setUuid(uuid)
- .setIsActor(true)
+ .setActorType(ActorType.SCALA_ACTOR)
+ .build
+
+ val request = RemoteRequestProtocol.newBuilder
+ .setId(RemoteRequestProtocolIdFactory.nextId)
+ .setMessage(MessageSerializer.serialize(message))
+ .setActorInfo(actorInfo)
.setIsOneWay(isOneWay)
- .setIsEscaped(false)
val id = registerSupervisorAsRemoteActor
- if (id.isDefined) protocol.setSupervisorUuid(id.get)
+ if (id.isDefined) request.setSupervisorUuid(id.get)
senderOption.foreach { sender =>
RemoteServer.getOrCreateServer(sender.homeAddress).register(sender.uuid, sender)
- protocol.setSender(toRemoteActorRefProtocol(sender))
+ request.setSender(toRemoteActorRefProtocol(sender))
}
- protocol
+ request
}
}
diff --git a/akka-core/src/main/scala/actor/TypedActor.scala b/akka-core/src/main/scala/actor/TypedActor.scala
new file mode 100644
index 0000000000..de204bab5b
--- /dev/null
+++ b/akka-core/src/main/scala/actor/TypedActor.scala
@@ -0,0 +1,839 @@
+/**
+ * Copyright (C) 2009-2010 Scalable Solutions AB
+ */
+
+package se.scalablesolutions.akka.actor
+
+import Actor._
+import se.scalablesolutions.akka.config.FaultHandlingStrategy
+import se.scalablesolutions.akka.remote.protocol.RemoteProtocol._
+import se.scalablesolutions.akka.remote.{MessageSerializer, RemoteClient, RemoteRequestProtocolIdFactory}
+import se.scalablesolutions.akka.dispatch.{MessageDispatcher, Future, CompletableFuture}
+import se.scalablesolutions.akka.config.ScalaConfig._
+import se.scalablesolutions.akka.serialization.Serializer
+import se.scalablesolutions.akka.util._
+import se.scalablesolutions.akka.actor.annotation._
+
+import org.codehaus.aspectwerkz.joinpoint.{MethodRtti, JoinPoint}
+import org.codehaus.aspectwerkz.proxy.Proxy
+import org.codehaus.aspectwerkz.annotation.{Aspect, Around}
+
+import java.net.InetSocketAddress
+import java.lang.reflect.{InvocationTargetException, Method, Field}
+
+import scala.reflect.BeanProperty
+
+/**
+ * FIXME: document TypedActor
+ *
+ * Here is an example of usage (in Java):
+ *
+ * class PingImpl extends TypedActor implements Ping {
+ * public void hit(int count) {
+ * Pong pong = (Pong) getContext().getSender();
+ * pong.hit(count++);
+ * }
+ *
+ * @Override
+ * public void init() {
+ * ... // optional initialization on start
+ * }
+ *
+ * @Override
+ * public void shutdown() {
+ * ... // optional cleanup on stop
+ * }
+ *
+ * ... // more life-cycle callbacks if needed
+ * }
+ *
+ * // create the ping actor
+ * Ping ping = TypedActor.newInstance(Ping.class, PingImpl.class);
+ *
+ * ping.hit(1); // use the actor
+ * ping.hit(1);
+ *
+ * // stop the actor
+ * TypedActor.stop(ping);
+ *
+ *
+ * Here is an example of usage (in Scala):
+ *
+ * class PingImpl extends TypedActor with Ping {
+ * def hit(count: Int) = {
+ * val pong = context.sender.asInstanceOf[Pong]
+ * pong.hit(count += 1)
+ * }
+ *
+ * override def init = {
+ * ... // optional initialization on start
+ * }
+ *
+ * override def shutdown = {
+ * ... // optional cleanup on stop
+ * }
+ *
+ * ... // more life-cycle callbacks if needed
+ * }
+ *
+ * // create the ping actor
+ * val ping = TypedActor.newInstance(classOf[Ping], classOf[PingImpl])
+ *
+ * ping.hit(1) // use the actor
+ * ping.hit(1)
+ *
+ * // stop the actor
+ * TypedActor.stop(ping)
+ *
+ *
+ * @author Jonas Bonér
+ */
+abstract class TypedActor extends Logging {
+
+ /**
+ * Holds RTTI (runtime type information) for the TypedActor, f.e. current 'sender'
+ * reference, the 'senderFuture' reference etc.
+ *
+ * This class does not contain static information but is updated by the runtime system
+ * at runtime.
+ *
+ * You can get a hold of the context using either the 'getContext()' or 'context'
+ * methods from the 'TypedActor' base class.
+ *
+ *
+ * Here is an example of usage (in Java):
+ *
+ */
+ @BeanProperty protected var context: TypedActorContext = _
+
+ /**
+ * The uuid for the Typed Actor.
+ */
+ @BeanProperty @volatile var uuid = UUID.newUuid.toString
+
+ /**
+ * Identifier for actor, does not have to be a unique one. Default is the 'uuid'.
+ *
+ * This field is used for logging, AspectRegistry.actorsFor(id), identifier for remote
+ * actor in RemoteServer etc.But also as the identifier for persistence, which means
+ * that you can use a custom name to be able to retrieve the "correct" persisted state
+ * upon restart, remote restart etc.
+ *
+ * This property can be set to a custom ID.
+ */
+ @BeanProperty @volatile protected var id: String = uuid
+
+ /**
+ * Defines the default timeout for '!!' and '!!!' invocations,
+ * e.g. the timeout for the future returned by the call to '!!' and '!!!'.
+ *
+ * This property can be set to a custom timeout.
+ */
+ @BeanProperty @volatile protected var timeout: Long = Actor.TIMEOUT
+
+ /**
+ * User overridable callback.
+ *
+ * Is called when an Actor is started by invoking 'actor.start'.
+ */
+ def init {}
+
+ /**
+ * User overridable callback.
+ *
+ * Is called when 'actor.stop' is invoked.
+ */
+ def shutdown {}
+
+ /**
+ * User overridable callback.
+ *
+ * Is called on a crashed Actor right BEFORE it is restarted to allow clean up of resources before Actor is terminated.
+ */
+ def preRestart(reason: Throwable) {}
+
+ /**
+ * User overridable callback.
+ *
+ * Is called right AFTER restart on the newly created Actor to allow reinitialization after an Actor crash.
+ */
+ def postRestart(reason: Throwable) {}
+
+ /**
+ * User overridable callback.
+ *
+ * Is called during initialization. Can be used to initialize transactional state. Will be invoked within a transaction.
+ */
+ def initTransactionalState {}
+}
+
+/**
+ * FIXME: document TypedTransactor
+ *
+ * @author Jonas Bonér
+ */
+@transactionrequired
+abstract class TypedTransactor extends TypedActor
+
+/**
+ * Configuration factory for TypedActors.
+ *
+ * FIXDOC: document TypedActorConfiguration
+ *
+ * @author Jonas Bonér
+ */
+final class TypedActorConfiguration {
+ private[akka] var _timeout: Long = Actor.TIMEOUT
+ private[akka] var _restartCallbacks: Option[RestartCallbacks] = None
+ private[akka] var _shutdownCallback: Option[ShutdownCallback] = None
+ private[akka] var _transactionRequired = false
+ private[akka] var _host: Option[InetSocketAddress] = None
+ private[akka] var _messageDispatcher: Option[MessageDispatcher] = None
+
+ def timeout = _timeout
+ def timeout(timeout: Duration) : TypedActorConfiguration = {
+ _timeout = timeout.toMillis
+ this
+ }
+
+ def restartCallbacks(pre: String, post: String) : TypedActorConfiguration = {
+ _restartCallbacks = Some(new RestartCallbacks(pre, post))
+ this
+ }
+
+ def shutdownCallback(down: String) : TypedActorConfiguration = {
+ _shutdownCallback = Some(new ShutdownCallback(down))
+ this
+ }
+
+ def makeTransactionRequired() : TypedActorConfiguration = {
+ _transactionRequired = true;
+ this
+ }
+
+ def makeRemote(hostname: String, port: Int) : TypedActorConfiguration = {
+ _host = Some(new InetSocketAddress(hostname, port))
+ this
+ }
+
+ def dispatcher(messageDispatcher: MessageDispatcher) : TypedActorConfiguration = {
+ _messageDispatcher = Some(messageDispatcher)
+ this
+ }
+}
+
+/**
+ * Holds RTTI (runtime type information) for the TypedActor, f.e. current 'sender'
+ * reference, the 'senderFuture' reference etc.
+ *
+ * This class does not contain static information but is updated by the runtime system
+ * at runtime.
+ *
+ * You can get a hold of the context using either the 'getContext()' or 'context'
+ * methods from the 'TypedActor' base class.
+ *
+ * Here is an example of usage (from Java):
+ *