diff --git a/akka-active-object-test/pom.xml b/akka-active-object-test/pom.xml index 62935a30b4..2b4183724e 100644 --- a/akka-active-object-test/pom.xml +++ b/akka-active-object-test/pom.xml @@ -40,7 +40,13 @@ se.scalablesolutions.akka akka-core_2.8.0.RC3 - 0.9 + 0.9.1 + + + org.multiverse + multiverse-alpha + + junit @@ -54,6 +60,12 @@ 2.4.0 test + + org.multiverse + multiverse-alpha + 0.6-SNAPSHOT + compile + 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 new file mode 100644 index 0000000000..edc26f6695 --- /dev/null +++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/MiscActiveObjectTest.java @@ -0,0 +1,35 @@ +package se.scalablesolutions.akka.api; + +import static se.scalablesolutions.akka.actor.ActiveObject.link; +import static se.scalablesolutions.akka.actor.ActiveObject.newInstance; + +import org.junit.Assert; +import org.junit.Test; + +import se.scalablesolutions.akka.config.OneForOneStrategy; +import junit.framework.TestCase; + +/** + *

Small misc tests that do not fit anywhere else and does not require a separate testcase

+ * + * @author johanrask + * + */ +public class MiscActiveObjectTest extends TestCase { + + + /** + * Verifies that both preRestart and postRestart methods are invoked when + * an actor is restarted + */ + public void testFailingPostRestartInvocation() throws InterruptedException { + SimpleJavaPojo pojo = newInstance(SimpleJavaPojo.class,500); + SimpleJavaPojo supervisor = newInstance(SimpleJavaPojo.class,500); + link(supervisor,pojo,new OneForOneStrategy(3, 2000),new Class[]{Throwable.class}); + pojo.throwException(); + Thread.sleep(500); + Assert.assertTrue(pojo.pre); + Assert.assertTrue(pojo.post); + } + +} 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 d0c22470e2..d4b4fd7687 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 @@ -38,7 +38,7 @@ public class RemoteInMemoryStateTest extends TestCase { } public void testMapShouldRollbackStateForStatefulServerInCaseOfFailure() { - InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 1000, "localhost", 9999); + InMemStateful stateful = ActiveObject.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); @@ -51,7 +51,7 @@ public class RemoteInMemoryStateTest extends TestCase { } public void testVectorShouldNotRollbackStateForStatefulServerInCaseOfSuccess() { - InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 1000, "localhost", 9999); + InMemStateful stateful = ActiveObject.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, 1000, "localhost", 9999); + InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999); stateful.init(); stateful.setVectorState("init"); // set init state - InMemFailer failer = ActiveObject.newRemoteInstance(InMemFailer.class, 1000, "localhost", 9999); //conf.getInstance(InMemFailer.class); + InMemFailer failer = ActiveObject.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, 1000, "localhost", 9999); + InMemStateful stateful = ActiveObject.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, 1000, "localhost", 9999); + InMemStateful stateful = ActiveObject.newRemoteInstance(InMemStateful.class, 10000, "localhost", 9999); stateful.init(); stateful.setRefState("init"); // set init state - InMemFailer failer = ActiveObject.newRemoteInstance(InMemFailer.class, 1000, "localhost", 9999); //conf.getInstance(InMemFailer.class); + InMemFailer failer = ActiveObject.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/SimpleJavaPojo.java b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/SimpleJavaPojo.java new file mode 100644 index 0000000000..c783fd2902 --- /dev/null +++ b/akka-active-object-test/src/test/java/se/scalablesolutions/akka/api/SimpleJavaPojo.java @@ -0,0 +1,36 @@ +package se.scalablesolutions.akka.api; + +import se.scalablesolutions.akka.actor.annotation.prerestart; +import se.scalablesolutions.akka.actor.annotation.postrestart; + +public class SimpleJavaPojo { + + public boolean pre = false; + public boolean post = false; + + private String name; + + public void setName(String name) { + this.name = name; + } + + public String getName() { + return name; + } + + @prerestart + public void pre() { + System.out.println("** pre()"); + pre = true; + } + + @postrestart + public void post() { + System.out.println("** post()"); + post = true; + } + + public void throwException() { + throw new RuntimeException(); + } +} 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 31234fe4a8..7ba65646e3 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 @@ -148,1044 +148,6 @@ public final class RemoteProtocol { // @@protoc_insertion_point(enum_scope:LifeCycleType) } - public static final class LifeCycleProtocol extends - com.google.protobuf.GeneratedMessage { - // Use LifeCycleProtocol.newBuilder() to construct. - private LifeCycleProtocol() { - initFields(); - } - private LifeCycleProtocol(boolean noInit) {} - - private static final LifeCycleProtocol defaultInstance; - public static LifeCycleProtocol getDefaultInstance() { - return defaultInstance; - } - - public LifeCycleProtocol getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_LifeCycleProtocol_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_LifeCycleProtocol_fieldAccessorTable; - } - - // required .LifeCycleType lifeCycle = 1; - public static final int LIFECYCLE_FIELD_NUMBER = 1; - private boolean hasLifeCycle; - private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType lifeCycle_; - public boolean hasLifeCycle() { return hasLifeCycle; } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType getLifeCycle() { return lifeCycle_; } - - // optional string preRestart = 2; - public static final int PRERESTART_FIELD_NUMBER = 2; - private boolean hasPreRestart; - private java.lang.String preRestart_ = ""; - public boolean hasPreRestart() { return hasPreRestart; } - public java.lang.String getPreRestart() { return preRestart_; } - - // optional string postRestart = 3; - public static final int POSTRESTART_FIELD_NUMBER = 3; - private boolean hasPostRestart; - private java.lang.String postRestart_ = ""; - public boolean hasPostRestart() { return hasPostRestart; } - public java.lang.String getPostRestart() { return postRestart_; } - - private void initFields() { - lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.PERMANENT; - } - public final boolean isInitialized() { - if (!hasLifeCycle) return false; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (hasLifeCycle()) { - output.writeEnum(1, getLifeCycle().getNumber()); - } - if (hasPreRestart()) { - output.writeString(2, getPreRestart()); - } - if (hasPostRestart()) { - output.writeString(3, getPostRestart()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (hasLifeCycle()) { - size += com.google.protobuf.CodedOutputStream - .computeEnumSize(1, getLifeCycle().getNumber()); - } - if (hasPreRestart()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getPreRestart()); - } - if (hasPostRestart()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(3, getPostRestart()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol result; - - // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol(); - return builder; - } - - protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDescriptor(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol getDefaultInstanceForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol) { - return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol other) { - if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance()) return this; - if (other.hasLifeCycle()) { - setLifeCycle(other.getLifeCycle()); - } - if (other.hasPreRestart()) { - setPreRestart(other.getPreRestart()); - } - if (other.hasPostRestart()) { - setPostRestart(other.getPostRestart()); - } - 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 8: { - int rawValue = input.readEnum(); - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType value = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.valueOf(rawValue); - if (value == null) { - unknownFields.mergeVarintField(1, rawValue); - } else { - setLifeCycle(value); - } - break; - } - case 18: { - setPreRestart(input.readString()); - break; - } - case 26: { - setPostRestart(input.readString()); - break; - } - } - } - } - - - // required .LifeCycleType lifeCycle = 1; - public boolean hasLifeCycle() { - return result.hasLifeCycle(); - } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType getLifeCycle() { - return result.getLifeCycle(); - } - public Builder setLifeCycle(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasLifeCycle = true; - result.lifeCycle_ = value; - return this; - } - public Builder clearLifeCycle() { - result.hasLifeCycle = false; - result.lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.PERMANENT; - return this; - } - - // optional string preRestart = 2; - public boolean hasPreRestart() { - return result.hasPreRestart(); - } - public java.lang.String getPreRestart() { - return result.getPreRestart(); - } - public Builder setPreRestart(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasPreRestart = true; - result.preRestart_ = value; - return this; - } - public Builder clearPreRestart() { - result.hasPreRestart = false; - result.preRestart_ = getDefaultInstance().getPreRestart(); - return this; - } - - // optional string postRestart = 3; - public boolean hasPostRestart() { - return result.hasPostRestart(); - } - public java.lang.String getPostRestart() { - return result.getPostRestart(); - } - public Builder setPostRestart(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasPostRestart = true; - result.postRestart_ = value; - return this; - } - public Builder clearPostRestart() { - result.hasPostRestart = false; - result.postRestart_ = getDefaultInstance().getPostRestart(); - return this; - } - - // @@protoc_insertion_point(builder_scope:LifeCycleProtocol) - } - - static { - defaultInstance = new LifeCycleProtocol(true); - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:LifeCycleProtocol) - } - - public static final class AddressProtocol extends - com.google.protobuf.GeneratedMessage { - // Use AddressProtocol.newBuilder() to construct. - private AddressProtocol() { - initFields(); - } - private AddressProtocol(boolean noInit) {} - - private static final AddressProtocol defaultInstance; - public static AddressProtocol getDefaultInstance() { - return defaultInstance; - } - - public AddressProtocol getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_AddressProtocol_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_AddressProtocol_fieldAccessorTable; - } - - // required string hostname = 1; - public static final int HOSTNAME_FIELD_NUMBER = 1; - private boolean hasHostname; - private java.lang.String hostname_ = ""; - public boolean hasHostname() { return hasHostname; } - public java.lang.String getHostname() { return hostname_; } - - // required uint32 port = 2; - public static final int PORT_FIELD_NUMBER = 2; - private boolean hasPort; - private int port_ = 0; - public boolean hasPort() { return hasPort; } - public int getPort() { return port_; } - - private void initFields() { - } - public final boolean isInitialized() { - if (!hasHostname) return false; - if (!hasPort) return false; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (hasHostname()) { - output.writeString(1, getHostname()); - } - if (hasPort()) { - output.writeUInt32(2, getPort()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (hasHostname()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getHostname()); - } - if (hasPort()) { - size += com.google.protobuf.CodedOutputStream - .computeUInt32Size(2, getPort()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol 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.AddressProtocol 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.AddressProtocol parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol 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.AddressProtocol result; - - // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol(); - return builder; - } - - protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDescriptor(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol getDefaultInstanceForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol) { - return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol other) { - if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance()) return this; - if (other.hasHostname()) { - setHostname(other.getHostname()); - } - if (other.hasPort()) { - setPort(other.getPort()); - } - 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: { - setHostname(input.readString()); - break; - } - case 16: { - setPort(input.readUInt32()); - break; - } - } - } - } - - - // required string hostname = 1; - public boolean hasHostname() { - return result.hasHostname(); - } - public java.lang.String getHostname() { - return result.getHostname(); - } - public Builder setHostname(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasHostname = true; - result.hostname_ = value; - return this; - } - public Builder clearHostname() { - result.hasHostname = false; - result.hostname_ = getDefaultInstance().getHostname(); - return this; - } - - // required uint32 port = 2; - public boolean hasPort() { - return result.hasPort(); - } - public int getPort() { - return result.getPort(); - } - public Builder setPort(int value) { - result.hasPort = true; - result.port_ = value; - return this; - } - public Builder clearPort() { - result.hasPort = false; - result.port_ = 0; - return this; - } - - // @@protoc_insertion_point(builder_scope:AddressProtocol) - } - - static { - defaultInstance = new AddressProtocol(true); - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:AddressProtocol) - } - - public static final class ExceptionProtocol extends - com.google.protobuf.GeneratedMessage { - // Use ExceptionProtocol.newBuilder() to construct. - private ExceptionProtocol() { - initFields(); - } - private ExceptionProtocol(boolean noInit) {} - - private static final ExceptionProtocol defaultInstance; - public static ExceptionProtocol getDefaultInstance() { - return defaultInstance; - } - - public ExceptionProtocol getDefaultInstanceForType() { - return defaultInstance; - } - - public static final com.google.protobuf.Descriptors.Descriptor - getDescriptor() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ExceptionProtocol_descriptor; - } - - protected com.google.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ExceptionProtocol_fieldAccessorTable; - } - - // required string classname = 1; - public static final int CLASSNAME_FIELD_NUMBER = 1; - private boolean hasClassname; - private java.lang.String classname_ = ""; - public boolean hasClassname() { return hasClassname; } - public java.lang.String getClassname() { return classname_; } - - // required string message = 2; - public static final int MESSAGE_FIELD_NUMBER = 2; - private boolean hasMessage; - private java.lang.String message_ = ""; - public boolean hasMessage() { return hasMessage; } - public java.lang.String getMessage() { return message_; } - - private void initFields() { - } - public final boolean isInitialized() { - if (!hasClassname) return false; - if (!hasMessage) return false; - return true; - } - - public void writeTo(com.google.protobuf.CodedOutputStream output) - throws java.io.IOException { - getSerializedSize(); - if (hasClassname()) { - output.writeString(1, getClassname()); - } - if (hasMessage()) { - output.writeString(2, getMessage()); - } - getUnknownFields().writeTo(output); - } - - private int memoizedSerializedSize = -1; - public int getSerializedSize() { - int size = memoizedSerializedSize; - if (size != -1) return size; - - size = 0; - if (hasClassname()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(1, getClassname()); - } - if (hasMessage()) { - size += com.google.protobuf.CodedOutputStream - .computeStringSize(2, getMessage()); - } - size += getUnknownFields().getSerializedSize(); - memoizedSerializedSize = size; - return size; - } - - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol parseFrom( - com.google.protobuf.ByteString data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol parseFrom(byte[] data) - throws com.google.protobuf.InvalidProtocolBufferException { - return newBuilder().mergeFrom(data).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol parseFrom(java.io.InputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol parseFrom( - com.google.protobuf.CodedInputStream input) - throws java.io.IOException { - return newBuilder().mergeFrom(input).buildParsed(); - } - public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol result; - - // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.newBuilder() - private Builder() {} - - private static Builder create() { - Builder builder = new Builder(); - builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol(); - return builder; - } - - protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol(); - return this; - } - - public Builder clone() { - return create().mergeFrom(result); - } - - public com.google.protobuf.Descriptors.Descriptor - getDescriptorForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDescriptor(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol getDefaultInstanceForType() { - return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance(); - } - - public boolean isInitialized() { - return result.isInitialized(); - } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol build() { - if (result != null && !isInitialized()) { - throw newUninitializedMessageException(result); - } - return buildPartial(); - } - - private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol buildParsed() - throws com.google.protobuf.InvalidProtocolBufferException { - if (!isInitialized()) { - throw newUninitializedMessageException( - result).asInvalidProtocolBufferException(); - } - return buildPartial(); - } - - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol buildPartial() { - if (result == null) { - throw new IllegalStateException( - "build() has already been called on this Builder."); - } - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol returnMe = result; - result = null; - return returnMe; - } - - public Builder mergeFrom(com.google.protobuf.Message other) { - if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol) { - return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol)other); - } else { - super.mergeFrom(other); - return this; - } - } - - public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol other) { - if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance()) return this; - if (other.hasClassname()) { - setClassname(other.getClassname()); - } - if (other.hasMessage()) { - setMessage(other.getMessage()); - } - 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: { - setClassname(input.readString()); - break; - } - case 18: { - setMessage(input.readString()); - break; - } - } - } - } - - - // required string classname = 1; - public boolean hasClassname() { - return result.hasClassname(); - } - public java.lang.String getClassname() { - return result.getClassname(); - } - public Builder setClassname(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasClassname = true; - result.classname_ = value; - return this; - } - public Builder clearClassname() { - result.hasClassname = false; - result.classname_ = getDefaultInstance().getClassname(); - return this; - } - - // required string message = 2; - public boolean hasMessage() { - return result.hasMessage(); - } - public java.lang.String getMessage() { - return result.getMessage(); - } - public Builder setMessage(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasMessage = true; - result.message_ = value; - return this; - } - public Builder clearMessage() { - result.hasMessage = false; - result.message_ = getDefaultInstance().getMessage(); - return this; - } - - // @@protoc_insertion_point(builder_scope:ExceptionProtocol) - } - - static { - defaultInstance = new ExceptionProtocol(true); - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); - defaultInstance.initFields(); - } - - // @@protoc_insertion_point(class_scope:ExceptionProtocol) - } - public static final class RemoteActorRefProtocol extends com.google.protobuf.GeneratedMessage { // Use RemoteActorRefProtocol.newBuilder() to construct. @@ -1670,27 +632,27 @@ public final class RemoteProtocol { public boolean hasActorClassname() { return hasActorClassname; } public java.lang.String getActorClassname() { return actorClassname_; } - // required bytes actorInstance = 4; - public static final int ACTORINSTANCE_FIELD_NUMBER = 4; + // required .AddressProtocol originalAddress = 4; + public static final int ORIGINALADDRESS_FIELD_NUMBER = 4; + private boolean hasOriginalAddress; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol originalAddress_; + public boolean hasOriginalAddress() { return hasOriginalAddress; } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol getOriginalAddress() { return originalAddress_; } + + // optional bytes actorInstance = 5; + public static final int ACTORINSTANCE_FIELD_NUMBER = 5; private boolean hasActorInstance; private com.google.protobuf.ByteString actorInstance_ = com.google.protobuf.ByteString.EMPTY; public boolean hasActorInstance() { return hasActorInstance; } public com.google.protobuf.ByteString getActorInstance() { return actorInstance_; } - // required string serializerClassname = 5; - public static final int SERIALIZERCLASSNAME_FIELD_NUMBER = 5; + // optional string serializerClassname = 6; + public static final int SERIALIZERCLASSNAME_FIELD_NUMBER = 6; private boolean hasSerializerClassname; private java.lang.String serializerClassname_ = ""; public boolean hasSerializerClassname() { return hasSerializerClassname; } public java.lang.String getSerializerClassname() { return serializerClassname_; } - // required .AddressProtocol originalAddress = 6; - public static final int ORIGINALADDRESS_FIELD_NUMBER = 6; - private boolean hasOriginalAddress; - private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol originalAddress_; - public boolean hasOriginalAddress() { return hasOriginalAddress; } - public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol getOriginalAddress() { return originalAddress_; } - // optional bool isTransactor = 7; public static final int ISTRANSACTOR_FIELD_NUMBER = 7; private boolean hasIsTransactor; @@ -1735,8 +697,6 @@ public final class RemoteProtocol { if (!hasUuid) return false; if (!hasId) return false; if (!hasActorClassname) return false; - if (!hasActorInstance) return false; - if (!hasSerializerClassname) return false; if (!hasOriginalAddress) return false; if (!getOriginalAddress().isInitialized()) return false; if (hasLifeCycle()) { @@ -1760,14 +720,14 @@ public final class RemoteProtocol { if (hasActorClassname()) { output.writeString(3, getActorClassname()); } + if (hasOriginalAddress()) { + output.writeMessage(4, getOriginalAddress()); + } if (hasActorInstance()) { - output.writeBytes(4, getActorInstance()); + output.writeBytes(5, getActorInstance()); } if (hasSerializerClassname()) { - output.writeString(5, getSerializerClassname()); - } - if (hasOriginalAddress()) { - output.writeMessage(6, getOriginalAddress()); + output.writeString(6, getSerializerClassname()); } if (hasIsTransactor()) { output.writeBool(7, getIsTransactor()); @@ -1805,17 +765,17 @@ public final class RemoteProtocol { size += com.google.protobuf.CodedOutputStream .computeStringSize(3, getActorClassname()); } + if (hasOriginalAddress()) { + size += com.google.protobuf.CodedOutputStream + .computeMessageSize(4, getOriginalAddress()); + } if (hasActorInstance()) { size += com.google.protobuf.CodedOutputStream - .computeBytesSize(4, getActorInstance()); + .computeBytesSize(5, getActorInstance()); } if (hasSerializerClassname()) { size += com.google.protobuf.CodedOutputStream - .computeStringSize(5, getSerializerClassname()); - } - if (hasOriginalAddress()) { - size += com.google.protobuf.CodedOutputStream - .computeMessageSize(6, getOriginalAddress()); + .computeStringSize(6, getSerializerClassname()); } if (hasIsTransactor()) { size += com.google.protobuf.CodedOutputStream @@ -2004,15 +964,15 @@ public final class RemoteProtocol { if (other.hasActorClassname()) { setActorClassname(other.getActorClassname()); } + if (other.hasOriginalAddress()) { + mergeOriginalAddress(other.getOriginalAddress()); + } if (other.hasActorInstance()) { setActorInstance(other.getActorInstance()); } if (other.hasSerializerClassname()) { setSerializerClassname(other.getSerializerClassname()); } - if (other.hasOriginalAddress()) { - mergeOriginalAddress(other.getOriginalAddress()); - } if (other.hasIsTransactor()) { setIsTransactor(other.getIsTransactor()); } @@ -2066,14 +1026,6 @@ public final class RemoteProtocol { break; } case 34: { - setActorInstance(input.readBytes()); - break; - } - case 42: { - setSerializerClassname(input.readString()); - break; - } - case 50: { se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.Builder subBuilder = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.newBuilder(); if (hasOriginalAddress()) { subBuilder.mergeFrom(getOriginalAddress()); @@ -2082,6 +1034,14 @@ public final class RemoteProtocol { setOriginalAddress(subBuilder.buildPartial()); break; } + case 42: { + setActorInstance(input.readBytes()); + break; + } + case 50: { + setSerializerClassname(input.readString()); + break; + } case 56: { setIsTransactor(input.readBool()); break; @@ -2180,49 +1140,7 @@ public final class RemoteProtocol { return this; } - // required bytes actorInstance = 4; - public boolean hasActorInstance() { - return result.hasActorInstance(); - } - public com.google.protobuf.ByteString getActorInstance() { - return result.getActorInstance(); - } - public Builder setActorInstance(com.google.protobuf.ByteString value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasActorInstance = true; - result.actorInstance_ = value; - return this; - } - public Builder clearActorInstance() { - result.hasActorInstance = false; - result.actorInstance_ = getDefaultInstance().getActorInstance(); - return this; - } - - // required string serializerClassname = 5; - public boolean hasSerializerClassname() { - return result.hasSerializerClassname(); - } - public java.lang.String getSerializerClassname() { - return result.getSerializerClassname(); - } - public Builder setSerializerClassname(java.lang.String value) { - if (value == null) { - throw new NullPointerException(); - } - result.hasSerializerClassname = true; - result.serializerClassname_ = value; - return this; - } - public Builder clearSerializerClassname() { - result.hasSerializerClassname = false; - result.serializerClassname_ = getDefaultInstance().getSerializerClassname(); - return this; - } - - // required .AddressProtocol originalAddress = 6; + // required .AddressProtocol originalAddress = 4; public boolean hasOriginalAddress() { return result.hasOriginalAddress(); } @@ -2259,6 +1177,48 @@ public final class RemoteProtocol { return this; } + // optional bytes actorInstance = 5; + public boolean hasActorInstance() { + return result.hasActorInstance(); + } + public com.google.protobuf.ByteString getActorInstance() { + return result.getActorInstance(); + } + public Builder setActorInstance(com.google.protobuf.ByteString value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasActorInstance = true; + result.actorInstance_ = value; + return this; + } + public Builder clearActorInstance() { + result.hasActorInstance = false; + result.actorInstance_ = getDefaultInstance().getActorInstance(); + return this; + } + + // optional string serializerClassname = 6; + public boolean hasSerializerClassname() { + return result.hasSerializerClassname(); + } + public java.lang.String getSerializerClassname() { + return result.getSerializerClassname(); + } + public Builder setSerializerClassname(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasSerializerClassname = true; + result.serializerClassname_ = value; + return this; + } + public Builder clearSerializerClassname() { + result.hasSerializerClassname = false; + result.serializerClassname_ = getDefaultInstance().getSerializerClassname(); + return this; + } + // optional bool isTransactor = 7; public boolean hasIsTransactor() { return result.hasIsTransactor(); @@ -3826,21 +2786,1044 @@ public final class RemoteProtocol { // @@protoc_insertion_point(class_scope:RemoteReplyProtocol) } - private static com.google.protobuf.Descriptors.Descriptor - internal_static_LifeCycleProtocol_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_LifeCycleProtocol_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_AddressProtocol_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_AddressProtocol_fieldAccessorTable; - private static com.google.protobuf.Descriptors.Descriptor - internal_static_ExceptionProtocol_descriptor; - private static - com.google.protobuf.GeneratedMessage.FieldAccessorTable - internal_static_ExceptionProtocol_fieldAccessorTable; + public static final class LifeCycleProtocol extends + com.google.protobuf.GeneratedMessage { + // Use LifeCycleProtocol.newBuilder() to construct. + private LifeCycleProtocol() { + initFields(); + } + private LifeCycleProtocol(boolean noInit) {} + + private static final LifeCycleProtocol defaultInstance; + public static LifeCycleProtocol getDefaultInstance() { + return defaultInstance; + } + + public LifeCycleProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_LifeCycleProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_LifeCycleProtocol_fieldAccessorTable; + } + + // required .LifeCycleType lifeCycle = 1; + public static final int LIFECYCLE_FIELD_NUMBER = 1; + private boolean hasLifeCycle; + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType lifeCycle_; + public boolean hasLifeCycle() { return hasLifeCycle; } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType getLifeCycle() { return lifeCycle_; } + + // optional string preRestart = 2; + public static final int PRERESTART_FIELD_NUMBER = 2; + private boolean hasPreRestart; + private java.lang.String preRestart_ = ""; + public boolean hasPreRestart() { return hasPreRestart; } + public java.lang.String getPreRestart() { return preRestart_; } + + // optional string postRestart = 3; + public static final int POSTRESTART_FIELD_NUMBER = 3; + private boolean hasPostRestart; + private java.lang.String postRestart_ = ""; + public boolean hasPostRestart() { return hasPostRestart; } + public java.lang.String getPostRestart() { return postRestart_; } + + private void initFields() { + lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.PERMANENT; + } + public final boolean isInitialized() { + if (!hasLifeCycle) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasLifeCycle()) { + output.writeEnum(1, getLifeCycle().getNumber()); + } + if (hasPreRestart()) { + output.writeString(2, getPreRestart()); + } + if (hasPostRestart()) { + output.writeString(3, getPostRestart()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasLifeCycle()) { + size += com.google.protobuf.CodedOutputStream + .computeEnumSize(1, getLifeCycle().getNumber()); + } + if (hasPreRestart()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(2, getPreRestart()); + } + if (hasPostRestart()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(3, getPostRestart()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol 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.LifeCycleProtocol result; + + // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol(); + return builder; + } + + protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol 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.LifeCycleProtocol(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDescriptor(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol getDefaultInstanceForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol) { + return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol other) { + if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.getDefaultInstance()) return this; + if (other.hasLifeCycle()) { + setLifeCycle(other.getLifeCycle()); + } + if (other.hasPreRestart()) { + setPreRestart(other.getPreRestart()); + } + if (other.hasPostRestart()) { + setPostRestart(other.getPostRestart()); + } + 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 8: { + int rawValue = input.readEnum(); + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType value = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.valueOf(rawValue); + if (value == null) { + unknownFields.mergeVarintField(1, rawValue); + } else { + setLifeCycle(value); + } + break; + } + case 18: { + setPreRestart(input.readString()); + break; + } + case 26: { + setPostRestart(input.readString()); + break; + } + } + } + } + + + // required .LifeCycleType lifeCycle = 1; + public boolean hasLifeCycle() { + return result.hasLifeCycle(); + } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType getLifeCycle() { + return result.getLifeCycle(); + } + public Builder setLifeCycle(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasLifeCycle = true; + result.lifeCycle_ = value; + return this; + } + public Builder clearLifeCycle() { + result.hasLifeCycle = false; + result.lifeCycle_ = se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleType.PERMANENT; + return this; + } + + // optional string preRestart = 2; + public boolean hasPreRestart() { + return result.hasPreRestart(); + } + public java.lang.String getPreRestart() { + return result.getPreRestart(); + } + public Builder setPreRestart(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasPreRestart = true; + result.preRestart_ = value; + return this; + } + public Builder clearPreRestart() { + result.hasPreRestart = false; + result.preRestart_ = getDefaultInstance().getPreRestart(); + return this; + } + + // optional string postRestart = 3; + public boolean hasPostRestart() { + return result.hasPostRestart(); + } + public java.lang.String getPostRestart() { + return result.getPostRestart(); + } + public Builder setPostRestart(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasPostRestart = true; + result.postRestart_ = value; + return this; + } + public Builder clearPostRestart() { + result.hasPostRestart = false; + result.postRestart_ = getDefaultInstance().getPostRestart(); + return this; + } + + // @@protoc_insertion_point(builder_scope:LifeCycleProtocol) + } + + static { + defaultInstance = new LifeCycleProtocol(true); + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:LifeCycleProtocol) + } + + public static final class AddressProtocol extends + com.google.protobuf.GeneratedMessage { + // Use AddressProtocol.newBuilder() to construct. + private AddressProtocol() { + initFields(); + } + private AddressProtocol(boolean noInit) {} + + private static final AddressProtocol defaultInstance; + public static AddressProtocol getDefaultInstance() { + return defaultInstance; + } + + public AddressProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_AddressProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_AddressProtocol_fieldAccessorTable; + } + + // required string hostname = 1; + public static final int HOSTNAME_FIELD_NUMBER = 1; + private boolean hasHostname; + private java.lang.String hostname_ = ""; + public boolean hasHostname() { return hasHostname; } + public java.lang.String getHostname() { return hostname_; } + + // required uint32 port = 2; + public static final int PORT_FIELD_NUMBER = 2; + private boolean hasPort; + private int port_ = 0; + public boolean hasPort() { return hasPort; } + public int getPort() { return port_; } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasHostname) return false; + if (!hasPort) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasHostname()) { + output.writeString(1, getHostname()); + } + if (hasPort()) { + output.writeUInt32(2, getPort()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasHostname()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(1, getHostname()); + } + if (hasPort()) { + size += com.google.protobuf.CodedOutputStream + .computeUInt32Size(2, getPort()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol 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.AddressProtocol 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.AddressProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol 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.AddressProtocol result; + + // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol(); + return builder; + } + + protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol 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.AddressProtocol(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDescriptor(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol getDefaultInstanceForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol) { + return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol other) { + if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.getDefaultInstance()) return this; + if (other.hasHostname()) { + setHostname(other.getHostname()); + } + if (other.hasPort()) { + setPort(other.getPort()); + } + 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: { + setHostname(input.readString()); + break; + } + case 16: { + setPort(input.readUInt32()); + break; + } + } + } + } + + + // required string hostname = 1; + public boolean hasHostname() { + return result.hasHostname(); + } + public java.lang.String getHostname() { + return result.getHostname(); + } + public Builder setHostname(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasHostname = true; + result.hostname_ = value; + return this; + } + public Builder clearHostname() { + result.hasHostname = false; + result.hostname_ = getDefaultInstance().getHostname(); + return this; + } + + // required uint32 port = 2; + public boolean hasPort() { + return result.hasPort(); + } + public int getPort() { + return result.getPort(); + } + public Builder setPort(int value) { + result.hasPort = true; + result.port_ = value; + return this; + } + public Builder clearPort() { + result.hasPort = false; + result.port_ = 0; + return this; + } + + // @@protoc_insertion_point(builder_scope:AddressProtocol) + } + + static { + defaultInstance = new AddressProtocol(true); + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:AddressProtocol) + } + + public static final class ExceptionProtocol extends + com.google.protobuf.GeneratedMessage { + // Use ExceptionProtocol.newBuilder() to construct. + private ExceptionProtocol() { + initFields(); + } + private ExceptionProtocol(boolean noInit) {} + + private static final ExceptionProtocol defaultInstance; + public static ExceptionProtocol getDefaultInstance() { + return defaultInstance; + } + + public ExceptionProtocol getDefaultInstanceForType() { + return defaultInstance; + } + + public static final com.google.protobuf.Descriptors.Descriptor + getDescriptor() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ExceptionProtocol_descriptor; + } + + protected com.google.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internal_static_ExceptionProtocol_fieldAccessorTable; + } + + // required string classname = 1; + public static final int CLASSNAME_FIELD_NUMBER = 1; + private boolean hasClassname; + private java.lang.String classname_ = ""; + public boolean hasClassname() { return hasClassname; } + public java.lang.String getClassname() { return classname_; } + + // required string message = 2; + public static final int MESSAGE_FIELD_NUMBER = 2; + private boolean hasMessage; + private java.lang.String message_ = ""; + public boolean hasMessage() { return hasMessage; } + public java.lang.String getMessage() { return message_; } + + private void initFields() { + } + public final boolean isInitialized() { + if (!hasClassname) return false; + if (!hasMessage) return false; + return true; + } + + public void writeTo(com.google.protobuf.CodedOutputStream output) + throws java.io.IOException { + getSerializedSize(); + if (hasClassname()) { + output.writeString(1, getClassname()); + } + if (hasMessage()) { + output.writeString(2, getMessage()); + } + getUnknownFields().writeTo(output); + } + + private int memoizedSerializedSize = -1; + public int getSerializedSize() { + int size = memoizedSerializedSize; + if (size != -1) return size; + + size = 0; + if (hasClassname()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(1, getClassname()); + } + if (hasMessage()) { + size += com.google.protobuf.CodedOutputStream + .computeStringSize(2, getMessage()); + } + size += getUnknownFields().getSerializedSize(); + memoizedSerializedSize = size; + return size; + } + + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol parseFrom( + com.google.protobuf.ByteString data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol parseFrom(byte[] data) + throws com.google.protobuf.InvalidProtocolBufferException { + return newBuilder().mergeFrom(data).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol parseFrom(java.io.InputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol parseFrom( + com.google.protobuf.CodedInputStream input) + throws java.io.IOException { + return newBuilder().mergeFrom(input).buildParsed(); + } + public static se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol 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.ExceptionProtocol result; + + // Construct using se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.newBuilder() + private Builder() {} + + private static Builder create() { + Builder builder = new Builder(); + builder.result = new se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol(); + return builder; + } + + protected se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol 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.ExceptionProtocol(); + return this; + } + + public Builder clone() { + return create().mergeFrom(result); + } + + public com.google.protobuf.Descriptors.Descriptor + getDescriptorForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDescriptor(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol getDefaultInstanceForType() { + return se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance(); + } + + public boolean isInitialized() { + return result.isInitialized(); + } + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol build() { + if (result != null && !isInitialized()) { + throw newUninitializedMessageException(result); + } + return buildPartial(); + } + + private se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol buildParsed() + throws com.google.protobuf.InvalidProtocolBufferException { + if (!isInitialized()) { + throw newUninitializedMessageException( + result).asInvalidProtocolBufferException(); + } + return buildPartial(); + } + + public se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol buildPartial() { + if (result == null) { + throw new IllegalStateException( + "build() has already been called on this Builder."); + } + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol returnMe = result; + result = null; + return returnMe; + } + + public Builder mergeFrom(com.google.protobuf.Message other) { + if (other instanceof se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol) { + return mergeFrom((se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol)other); + } else { + super.mergeFrom(other); + return this; + } + } + + public Builder mergeFrom(se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol other) { + if (other == se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.getDefaultInstance()) return this; + if (other.hasClassname()) { + setClassname(other.getClassname()); + } + if (other.hasMessage()) { + setMessage(other.getMessage()); + } + 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: { + setClassname(input.readString()); + break; + } + case 18: { + setMessage(input.readString()); + break; + } + } + } + } + + + // required string classname = 1; + public boolean hasClassname() { + return result.hasClassname(); + } + public java.lang.String getClassname() { + return result.getClassname(); + } + public Builder setClassname(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasClassname = true; + result.classname_ = value; + return this; + } + public Builder clearClassname() { + result.hasClassname = false; + result.classname_ = getDefaultInstance().getClassname(); + return this; + } + + // required string message = 2; + public boolean hasMessage() { + return result.hasMessage(); + } + public java.lang.String getMessage() { + return result.getMessage(); + } + public Builder setMessage(java.lang.String value) { + if (value == null) { + throw new NullPointerException(); + } + result.hasMessage = true; + result.message_ = value; + return this; + } + public Builder clearMessage() { + result.hasMessage = false; + result.message_ = getDefaultInstance().getMessage(); + return this; + } + + // @@protoc_insertion_point(builder_scope:ExceptionProtocol) + } + + static { + defaultInstance = new ExceptionProtocol(true); + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.internalForceInit(); + defaultInstance.initFields(); + } + + // @@protoc_insertion_point(class_scope:ExceptionProtocol) + } + private static com.google.protobuf.Descriptors.Descriptor internal_static_RemoteActorRefProtocol_descriptor; private static @@ -3861,6 +3844,21 @@ public final class RemoteProtocol { private static com.google.protobuf.GeneratedMessage.FieldAccessorTable internal_static_RemoteReplyProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_LifeCycleProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_LifeCycleProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_AddressProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_AddressProtocol_fieldAccessorTable; + private static com.google.protobuf.Descriptors.Descriptor + internal_static_ExceptionProtocol_descriptor; + private static + com.google.protobuf.GeneratedMessage.FieldAccessorTable + internal_static_ExceptionProtocol_fieldAccessorTable; public static com.google.protobuf.Descriptors.FileDescriptor getDescriptor() { @@ -3870,37 +3868,37 @@ public final class RemoteProtocol { descriptor; static { java.lang.String[] descriptorData = { - "\n\024RemoteProtocol.proto\"_\n\021LifeCycleProto" + - "col\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\"" + - "1\n\017AddressProtocol\022\020\n\010hostname\030\001 \002(\t\022\014\n\004" + - "port\030\002 \002(\r\"7\n\021ExceptionProtocol\022\021\n\tclass" + - "name\030\001 \002(\t\022\017\n\007message\030\002 \002(\t\"v\n\026RemoteAct" + - "orRefProtocol\022\014\n\004uuid\030\001 \002(\t\022\026\n\016actorClas" + - "sname\030\002 \002(\t\022%\n\013homeAddress\030\003 \002(\0132\020.Addre" + - "ssProtocol\022\017\n\007timeout\030\004 \001(\004\"\276\002\n\032Serializ" + - "edActorRefProtocol\022\014\n\004uuid\030\001 \002(\t\022\n\n\002id\030\002", - " \002(\t\022\026\n\016actorClassname\030\003 \002(\t\022\025\n\ractorIns" + - "tance\030\004 \002(\014\022\033\n\023serializerClassname\030\005 \002(\t" + - "\022)\n\017originalAddress\030\006 \002(\0132\020.AddressProto" + - "col\022\024\n\014isTransactor\030\007 \001(\010\022\017\n\007timeout\030\010 \001" + - "(\004\022%\n\tlifeCycle\030\t \001(\0132\022.LifeCycleProtoco" + - "l\022+\n\nsupervisor\030\n \001(\0132\027.RemoteActorRefPr" + - "otocol\022\024\n\014hotswapStack\030\013 \001(\014\"\272\002\n\025RemoteR" + - "equestProtocol\022\n\n\002id\030\001 \002(\004\0225\n\023serializat" + - "ionScheme\030\002 \002(\0162\030.SerializationSchemeTyp" + - "e\022\017\n\007message\030\003 \002(\014\022\027\n\017messageManifest\030\004 ", - "\001(\014\022\016\n\006method\030\005 \001(\t\022\016\n\006target\030\006 \002(\t\022\014\n\004u" + - "uid\030\007 \002(\t\022\017\n\007timeout\030\010 \002(\004\022\026\n\016supervisor" + - "Uuid\030\t \001(\t\022\017\n\007isActor\030\n \002(\010\022\020\n\010isOneWay\030" + - "\013 \002(\010\022\021\n\tisEscaped\030\014 \002(\010\022\'\n\006sender\030\r \001(\013" + - "2\027.RemoteActorRefProtocol\"\350\001\n\023RemoteRepl" + - "yProtocol\022\n\n\002id\030\001 \002(\004\0225\n\023serializationSc" + - "heme\030\002 \001(\0162\030.SerializationSchemeType\022\017\n\007" + - "message\030\003 \001(\014\022\027\n\017messageManifest\030\004 \001(\014\022%" + - "\n\texception\030\005 \001(\0132\022.ExceptionProtocol\022\026\n" + - "\016supervisorUuid\030\006 \001(\t\022\017\n\007isActor\030\007 \002(\010\022\024", - "\n\014isSuccessful\030\010 \002(\010*]\n\027SerializationSch" + + "\n\024RemoteProtocol.proto\"v\n\026RemoteActorRef" + + "Protocol\022\014\n\004uuid\030\001 \002(\t\022\026\n\016actorClassname" + + "\030\002 \002(\t\022%\n\013homeAddress\030\003 \002(\0132\020.AddressPro" + + "tocol\022\017\n\007timeout\030\004 \001(\004\"\276\002\n\032SerializedAct" + + "orRefProtocol\022\014\n\004uuid\030\001 \002(\t\022\n\n\002id\030\002 \002(\t\022" + + "\026\n\016actorClassname\030\003 \002(\t\022)\n\017originalAddre" + + "ss\030\004 \002(\0132\020.AddressProtocol\022\025\n\ractorInsta" + + "nce\030\005 \001(\014\022\033\n\023serializerClassname\030\006 \001(\t\022\024" + + "\n\014isTransactor\030\007 \001(\010\022\017\n\007timeout\030\010 \001(\004\022%\n" + + "\tlifeCycle\030\t \001(\0132\022.LifeCycleProtocol\022+\n\n", + "supervisor\030\n \001(\0132\027.RemoteActorRefProtoco" + + "l\022\024\n\014hotswapStack\030\013 \001(\014\"\272\002\n\025RemoteReques" + + "tProtocol\022\n\n\002id\030\001 \002(\004\0225\n\023serializationSc" + + "heme\030\002 \002(\0162\030.SerializationSchemeType\022\017\n\007" + + "message\030\003 \002(\014\022\027\n\017messageManifest\030\004 \001(\014\022\016" + + "\n\006method\030\005 \001(\t\022\016\n\006target\030\006 \002(\t\022\014\n\004uuid\030\007" + + " \002(\t\022\017\n\007timeout\030\010 \002(\004\022\026\n\016supervisorUuid\030" + + "\t \001(\t\022\017\n\007isActor\030\n \002(\010\022\020\n\010isOneWay\030\013 \002(\010" + + "\022\021\n\tisEscaped\030\014 \002(\010\022\'\n\006sender\030\r \001(\0132\027.Re" + + "moteActorRefProtocol\"\350\001\n\023RemoteReplyProt", + "ocol\022\n\n\002id\030\001 \002(\004\0225\n\023serializationScheme\030" + + "\002 \001(\0162\030.SerializationSchemeType\022\017\n\007messa" + + "ge\030\003 \001(\014\022\027\n\017messageManifest\030\004 \001(\014\022%\n\texc" + + "eption\030\005 \001(\0132\022.ExceptionProtocol\022\026\n\016supe" + + "rvisorUuid\030\006 \001(\t\022\017\n\007isActor\030\007 \002(\010\022\024\n\014isS" + + "uccessful\030\010 \002(\010\"_\n\021LifeCycleProtocol\022!\n\t" + + "lifeCycle\030\001 \002(\0162\016.LifeCycleType\022\022\n\npreRe" + + "start\030\002 \001(\t\022\023\n\013postRestart\030\003 \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\027SerializationSch" + "emeType\022\010\n\004JAVA\020\001\022\013\n\007SBINARY\020\002\022\016\n\nSCALA_" + "JSON\020\003\022\r\n\tJAVA_JSON\020\004\022\014\n\010PROTOBUF\020\005*-\n\rL" + "ifeCycleType\022\r\n\tPERMANENT\020\001\022\r\n\tTEMPORARY" + @@ -3912,32 +3910,8 @@ public final class RemoteProtocol { public com.google.protobuf.ExtensionRegistry assignDescriptors( com.google.protobuf.Descriptors.FileDescriptor root) { descriptor = root; - internal_static_LifeCycleProtocol_descriptor = - getDescriptor().getMessageTypes().get(0); - internal_static_LifeCycleProtocol_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_LifeCycleProtocol_descriptor, - new java.lang.String[] { "LifeCycle", "PreRestart", "PostRestart", }, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.class, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.Builder.class); - internal_static_AddressProtocol_descriptor = - getDescriptor().getMessageTypes().get(1); - internal_static_AddressProtocol_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_AddressProtocol_descriptor, - new java.lang.String[] { "Hostname", "Port", }, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.class, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.Builder.class); - internal_static_ExceptionProtocol_descriptor = - getDescriptor().getMessageTypes().get(2); - internal_static_ExceptionProtocol_fieldAccessorTable = new - com.google.protobuf.GeneratedMessage.FieldAccessorTable( - internal_static_ExceptionProtocol_descriptor, - new java.lang.String[] { "Classname", "Message", }, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.class, - se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.Builder.class); internal_static_RemoteActorRefProtocol_descriptor = - getDescriptor().getMessageTypes().get(3); + getDescriptor().getMessageTypes().get(0); internal_static_RemoteActorRefProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RemoteActorRefProtocol_descriptor, @@ -3945,15 +3919,15 @@ public final class RemoteProtocol { se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteActorRefProtocol.Builder.class); internal_static_SerializedActorRefProtocol_descriptor = - getDescriptor().getMessageTypes().get(4); + getDescriptor().getMessageTypes().get(1); internal_static_SerializedActorRefProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_SerializedActorRefProtocol_descriptor, - new java.lang.String[] { "Uuid", "Id", "ActorClassname", "ActorInstance", "SerializerClassname", "OriginalAddress", "IsTransactor", "Timeout", "LifeCycle", "Supervisor", "HotswapStack", }, + new java.lang.String[] { "Uuid", "Id", "ActorClassname", "OriginalAddress", "ActorInstance", "SerializerClassname", "IsTransactor", "Timeout", "LifeCycle", "Supervisor", "HotswapStack", }, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.SerializedActorRefProtocol.Builder.class); internal_static_RemoteRequestProtocol_descriptor = - getDescriptor().getMessageTypes().get(5); + getDescriptor().getMessageTypes().get(2); internal_static_RemoteRequestProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RemoteRequestProtocol_descriptor, @@ -3961,13 +3935,37 @@ public final class RemoteProtocol { se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteRequestProtocol.Builder.class); internal_static_RemoteReplyProtocol_descriptor = - getDescriptor().getMessageTypes().get(6); + getDescriptor().getMessageTypes().get(3); internal_static_RemoteReplyProtocol_fieldAccessorTable = new com.google.protobuf.GeneratedMessage.FieldAccessorTable( internal_static_RemoteReplyProtocol_descriptor, new java.lang.String[] { "Id", "SerializationScheme", "Message", "MessageManifest", "Exception", "SupervisorUuid", "IsActor", "IsSuccessful", }, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.class, se.scalablesolutions.akka.remote.protocol.RemoteProtocol.RemoteReplyProtocol.Builder.class); + internal_static_LifeCycleProtocol_descriptor = + getDescriptor().getMessageTypes().get(4); + internal_static_LifeCycleProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_LifeCycleProtocol_descriptor, + new java.lang.String[] { "LifeCycle", "PreRestart", "PostRestart", }, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.class, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.LifeCycleProtocol.Builder.class); + internal_static_AddressProtocol_descriptor = + getDescriptor().getMessageTypes().get(5); + internal_static_AddressProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_AddressProtocol_descriptor, + new java.lang.String[] { "Hostname", "Port", }, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.class, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.AddressProtocol.Builder.class); + internal_static_ExceptionProtocol_descriptor = + getDescriptor().getMessageTypes().get(6); + internal_static_ExceptionProtocol_fieldAccessorTable = new + com.google.protobuf.GeneratedMessage.FieldAccessorTable( + internal_static_ExceptionProtocol_descriptor, + new java.lang.String[] { "Classname", "Message", }, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.class, + se.scalablesolutions.akka.remote.protocol.RemoteProtocol.ExceptionProtocol.Builder.class); return null; } }; diff --git a/akka-core/src/main/protocol/RemoteProtocol.proto b/akka-core/src/main/protocol/RemoteProtocol.proto index e967d8b3ac..69c551d2e7 100644 --- a/akka-core/src/main/protocol/RemoteProtocol.proto +++ b/akka-core/src/main/protocol/RemoteProtocol.proto @@ -31,9 +31,9 @@ message SerializedActorRefProtocol { required string uuid = 1; required string id = 2; required string actorClassname = 3; - required bytes actorInstance = 4; - required string serializerClassname = 5; - required AddressProtocol originalAddress = 6; + required AddressProtocol originalAddress = 4; + optional bytes actorInstance = 5; + optional string serializerClassname = 6; optional bool isTransactor = 7; optional uint64 timeout = 8; optional LifeCycleProtocol lifeCycle = 9; diff --git a/akka-core/src/main/scala/actor/ActiveObject.scala b/akka-core/src/main/scala/actor/ActiveObject.scala index b66b4558d3..871b0e6da7 100644 --- a/akka-core/src/main/scala/actor/ActiveObject.scala +++ b/akka-core/src/main/scala/actor/ActiveObject.scala @@ -355,9 +355,10 @@ object ActiveObject extends Logging { } private[akka] def newInstance[T](target: Class[T], actorRef: ActorRef, remoteAddress: Option[InetSocketAddress], timeout: Long): T = { - val proxy = Proxy.newInstance(target, false, false) + val proxy = Proxy.newInstance(target, true, false) val context = injectActiveObjectContext(proxy) actorRef.actor.asInstanceOf[Dispatcher].initialize(target, proxy, context) + ActorRegistry.unregister(actorRef) // do not store the dispatcher in the ActorRegistry since it will prevent GC actorRef.timeout = timeout if (remoteAddress.isDefined) actorRef.makeRemote(remoteAddress.get) AspectInitRegistry.register(proxy, AspectInit(target, actorRef, remoteAddress, timeout)) @@ -368,8 +369,9 @@ object ActiveObject extends Logging { 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), false, false) + val proxy = Proxy.newInstance(Array(intf), Array(target), true, false) actorRef.actor.asInstanceOf[Dispatcher].initialize(target.getClass, target, context) + ActorRegistry.unregister(actorRef) // do not store the dispatcher in the ActorRegistry since it will prevent GC actorRef.timeout = timeout if (remoteAddress.isDefined) actorRef.makeRemote(remoteAddress.get) AspectInitRegistry.register(proxy, AspectInit(intf, actorRef, remoteAddress, timeout)) @@ -462,7 +464,7 @@ object ActiveObject extends Logging { val parent = clazz.getSuperclass if (parent != null) injectActiveObjectContext0(activeObject, parent) else { - log.warning( + log.trace( "Can't set 'ActiveObjectContext' for ActiveObject [%s] since no field of this type could be found.", activeObject.getClass.getName) None @@ -646,6 +648,7 @@ private[akka] sealed class ActiveObjectAspect { object Dispatcher { val ZERO_ITEM_CLASS_ARRAY = Array[Class[_]]() val ZERO_ITEM_OBJECT_ARRAY = Array[Object]() + var crashedActorTl:ThreadLocal[Dispatcher] = new ThreadLocal(); } /** @@ -653,7 +656,7 @@ object Dispatcher { * * @author Jonas Bonér */ -private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Option[RestartCallbacks]) extends Actor { +private[akka] class Dispatcher(transactionalRequired: Boolean, var callbacks: Option[RestartCallbacks]) extends Actor { import Dispatcher._ private[actor] var target: Option[AnyRef] = None @@ -661,13 +664,18 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Op 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)) + + 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 @@ -733,22 +741,43 @@ private[akka] class Dispatcher(transactionalRequired: Boolean, val callbacks: Op 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) if (preRestart.isDefined) preRestart.get.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*) } catch { case e: InvocationTargetException => throw e.getCause } } override def postRestart(reason: Throwable) { try { - if (postRestart.isDefined) postRestart.get.invoke(target.get, ZERO_ITEM_OBJECT_ARRAY: _*) + + if (postRestart.isDefined) { + postRestart.get.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 initTransactionalState = { - try { + 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 diff --git a/akka-core/src/main/scala/actor/Actor.scala b/akka-core/src/main/scala/actor/Actor.scala index 853ab79dd6..497cfb185a 100644 --- a/akka-core/src/main/scala/actor/Actor.scala +++ b/akka-core/src/main/scala/actor/Actor.scala @@ -36,26 +36,50 @@ abstract class RemoteActor(hostname: String, port: Int) extends Actor { } /** - * Mix in this trait to create a serializable actor, serializable through - * a custom serialization protocol. + * Base trait defining a serializable actor. * * @author Jonas Bonér */ -trait SerializableActor extends Actor { +trait SerializableActor extends Actor + +/** + * Base trait defining a stateless serializable actor. + * + * @author Jonas Bonér + */ +trait StatelessSerializableActor extends SerializableActor + +/** + * Mix in this trait to create a serializable actor, serializable through + * a custom serialization protocol. This actor is the serialized state. + * + * @author Jonas Bonér + */ +trait StatefulSerializerSerializableActor extends SerializableActor { val serializer: Serializer def toBinary: Array[Byte] } +/** + * Mix in this trait to create a serializable actor, serializable through + * a custom serialization protocol. This actor is wrapping serializable state. + * + * @author Jonas Bonér + */ +trait StatefulWrappedSerializableActor extends SerializableActor { + def toBinary: Array[Byte] + def fromBinary(bytes: Array[Byte]) +} + /** * Mix in this trait to create a serializable actor, serializable through * Protobuf. * * @author Jonas Bonér */ -trait ProtobufSerializableActor[T <: Message] extends SerializableActor { - val serializer = Serializer.Protobuf +trait ProtobufSerializableActor[T <: Message] extends StatefulWrappedSerializableActor { def toBinary: Array[Byte] = toProtobuf.toByteArray - def fromBinary(bytes: Array[Byte]) = fromProtobuf(serializer.fromBinary(bytes, Some(clazz)).asInstanceOf[T]) + def fromBinary(bytes: Array[Byte]) = fromProtobuf(Serializer.Protobuf.fromBinary(bytes, Some(clazz)).asInstanceOf[T]) val clazz: Class[T] def toProtobuf: T @@ -68,7 +92,7 @@ trait ProtobufSerializableActor[T <: Message] extends SerializableActor { * * @author Jonas Bonér */ -trait JavaSerializableActor extends SerializableActor { +trait JavaSerializableActor extends StatefulSerializerSerializableActor { @transient val serializer = Serializer.Java def toBinary: Array[Byte] = serializer.toBinary(this) } @@ -79,7 +103,7 @@ trait JavaSerializableActor extends SerializableActor { * * @author Jonas Bonér */ -trait JavaJSONSerializableActor extends SerializableActor { +trait JavaJSONSerializableActor extends StatefulSerializerSerializableActor { val serializer = Serializer.JavaJSON def toBinary: Array[Byte] = serializer.toBinary(this) } @@ -90,7 +114,7 @@ trait JavaJSONSerializableActor extends SerializableActor { * * @author Jonas Bonér */ -trait ScalaJSONSerializableActor extends SerializableActor { +trait ScalaJSONSerializableActor extends StatefulSerializerSerializableActor { val serializer = Serializer.ScalaJSON def toBinary: Array[Byte] = serializer.toBinary(this) } diff --git a/akka-core/src/main/scala/actor/ActorRef.scala b/akka-core/src/main/scala/actor/ActorRef.scala index 74fc3bc678..26b5bbf5a7 100644 --- a/akka-core/src/main/scala/actor/ActorRef.scala +++ b/akka-core/src/main/scala/actor/ActorRef.scala @@ -37,7 +37,7 @@ import com.google.protobuf.ByteString *

* Binary -> ActorRef: *

- *   val actorRef = ActorRef.fromBinary(bytes)
+ *   val actorRef = ActorRef.fromBinaryToRemoteActorRef(bytes)
  *   actorRef ! message // send message to remote actor through its reference
  * 
* @@ -74,7 +74,8 @@ object ActorRef { /** * Deserializes a RemoteActorRefProtocol Protocol Buffers (protobuf) Message into an RemoteActorRef instance. */ - private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = + private[akka] def fromProtobufToRemoteActorRef(protocol: RemoteActorRefProtocol, loader: Option[ClassLoader]): ActorRef = { + Actor.log.debug("Deserializing RemoteActorRefProtocol to RemoteActorRef:\n" + protocol) RemoteActorRef( protocol.getUuid, protocol.getActorClassname, @@ -82,6 +83,7 @@ object ActorRef { protocol.getHomeAddress.getPort, protocol.getTimeout, loader) + } /** * Deserializes a byte array (Array[Byte]) into an LocalActorRef instance. @@ -99,11 +101,15 @@ object ActorRef { * Deserializes a SerializedActorRefProtocol Protocol Buffers (protobuf) Message into an LocalActorRef instance. */ private[akka] def fromProtobufToLocalActorRef(protocol: SerializedActorRefProtocol, loader: Option[ClassLoader]): ActorRef = { - val serializerClass = - if (loader.isDefined) loader.get.loadClass(protocol.getSerializerClassname) - else Class.forName(protocol.getSerializerClassname) - val serializer = serializerClass.newInstance.asInstanceOf[Serializer] - + Actor.log.debug("Deserializing SerializedActorRefProtocol to LocalActorRef:\n" + protocol) + + val serializer = if (protocol.hasSerializerClassname) { + val serializerClass = + if (loader.isDefined) loader.get.loadClass(protocol.getSerializerClassname) + else Class.forName(protocol.getSerializerClassname) + Some(serializerClass.newInstance.asInstanceOf[Serializer]) + } else None + val lifeCycle = if (protocol.hasLifeCycle) { val lifeCycleProtocol = protocol.getLifeCycle @@ -120,8 +126,9 @@ object ActorRef { if (protocol.hasSupervisor) Some(fromProtobufToRemoteActorRef(protocol.getSupervisor, loader)) else None + val hotswap = - if (protocol.hasHotswapStack) Some(serializer + if (serializer.isDefined && protocol.hasHotswapStack) Some(serializer.get .fromBinary(protocol.getHotswapStack.toByteArray, Some(classOf[PartialFunction[Any, Unit]])) .asInstanceOf[PartialFunction[Any, Unit]]) else None @@ -349,10 +356,12 @@ trait ActorRef extends TransactionManagement { /** * Returns the 'Serializer' instance for the Actor as an Option. *

- * It returns 'Some(serializer)' if the Actor is serializable and 'None' if not. + * It returns 'Some(serializer)' if the Actor is extending the StatefulSerializerSerializableActor + * trait (which has a Serializer defined) and 'None' if not. */ def serializer: Option[Serializer] = - if (isSerializable) Some(actor.asInstanceOf[SerializableActor].serializer) + if (actor.isInstanceOf[StatefulSerializerSerializableActor]) + Some(actor.asInstanceOf[StatefulSerializerSerializableActor].serializer) else None /** @@ -710,15 +719,25 @@ sealed class LocalActorRef private[akka]( __supervisor: Option[ActorRef], __hotswap: Option[PartialFunction[Any, Unit]], __loader: ClassLoader, - __serializer: Serializer) = { + __serializer: Option[Serializer]) = { this(() => { val actorClass = __loader.loadClass(__actorClassName) val actorInstance = actorClass.newInstance - if (actorInstance.isInstanceOf[ProtobufSerializableActor[_]]) { - val instance = actorInstance.asInstanceOf[ProtobufSerializableActor[_]] + if (actorInstance.isInstanceOf[StatelessSerializableActor]) { + actorInstance.asInstanceOf[Actor] + } else if (actorInstance.isInstanceOf[StatefulSerializerSerializableActor]) { + __serializer.getOrElse(throw new IllegalStateException( + "No serializer defined for SerializableActor [" + actorClass.getName + "]")) + .fromBinary(__actorBytes, Some(actorClass)).asInstanceOf[Actor] + } else if (actorInstance.isInstanceOf[StatefulWrappedSerializableActor]) { + val instance = actorInstance.asInstanceOf[StatefulWrappedSerializableActor] instance.fromBinary(__actorBytes) instance - } else __serializer.fromBinary(__actorBytes, Some(actorClass)).asInstanceOf[Actor] + } else throw new IllegalStateException( + "Can't deserialize Actor that is not an instance of one of:\n" + + "\n\t- StatelessSerializableActor" + + "\n\t- StatefulSerializerSerializableActor" + + "\n\t- StatefulWrappedSerializableActor") }) loader = Some(__loader) isDeserialized = true @@ -777,7 +796,8 @@ sealed class LocalActorRef private[akka]( protected[akka] def toSerializedActorRefProtocol: SerializedActorRefProtocol = guard.withGuard { if (!isSerializable) throw new IllegalStateException( - "Can't serialize an ActorRef using SerializedActorRefProtocol\nthat is wrapping an Actor that is not mixing in the SerializableActor trait") + "Can't serialize an ActorRef using SerializedActorRefProtocol" + + "\nthat is wrapping an Actor that is not mixing in the SerializableActor trait") val lifeCycleProtocol: Option[LifeCycleProtocol] = { def setScope(builder: LifeCycleProtocol.Builder, scope: Scope) = scope match { @@ -798,39 +818,43 @@ sealed class LocalActorRef private[akka]( } } - val serializerClassname = serializer - .getOrElse(throw new IllegalStateException("Can't serialize Actor [" + toString + "] - no 'Serializer' defined")) - .getClass.getName - val originalAddress = AddressProtocol.newBuilder.setHostname(homeAddress.getHostName).setPort(homeAddress.getPort).build + val originalAddress = AddressProtocol.newBuilder + .setHostname(homeAddress.getHostName) + .setPort(homeAddress.getPort) + .build val builder = SerializedActorRefProtocol.newBuilder .setUuid(uuid) .setId(id) .setActorClassname(actorClass.getName) - .setActorInstance(ByteString.copyFrom(actor.asInstanceOf[SerializableActor].toBinary)) - .setSerializerClassname(serializerClassname) .setOriginalAddress(originalAddress) .setIsTransactor(isTransactor) .setTimeout(timeout) - + if (actor.isInstanceOf[StatefulSerializerSerializableActor]) builder.setActorInstance( + ByteString.copyFrom(actor.asInstanceOf[StatefulSerializerSerializableActor].toBinary)) + else if (actor.isInstanceOf[StatefulWrappedSerializableActor]) builder.setActorInstance( + ByteString.copyFrom(actor.asInstanceOf[StatefulWrappedSerializableActor].toBinary)) + serializer.foreach(s => builder.setSerializerClassname(s.getClass.getName)) lifeCycleProtocol.foreach(builder.setLifeCycle(_)) - supervisor.foreach(sup => builder.setSupervisor(sup.toRemoteActorRefProtocol)) + supervisor.foreach(s => builder.setSupervisor(s.toRemoteActorRefProtocol)) // FIXME: how to serialize the hotswap PartialFunction ?? - // hotswap.foreach(builder.setHotswapStack(_)) + //hotswap.foreach(builder.setHotswapStack(_)) builder.build } /** * Returns the mailbox. */ - protected[akka] def mailbox: Deque[MessageInvocation] = _mailbox + def mailbox: Deque[MessageInvocation] = _mailbox /** * Serializes the ActorRef instance into a byte array (Array[Byte]). */ def toBinary: Array[Byte] = { - if (isSerializable) toSerializedActorRefProtocol.toByteArray - else toRemoteActorRefProtocol.toByteArray + val protocol = if (isSerializable) toSerializedActorRefProtocol + else toRemoteActorRefProtocol + Actor.log.debug("Serializing ActorRef to binary:\n" + protocol) + protocol.toByteArray } /** diff --git a/akka-core/src/main/scala/actor/ActorRegistry.scala b/akka-core/src/main/scala/actor/ActorRegistry.scala index b9827fdb9c..efe1f49b7b 100644 --- a/akka-core/src/main/scala/actor/ActorRegistry.scala +++ b/akka-core/src/main/scala/actor/ActorRegistry.scala @@ -6,7 +6,10 @@ package se.scalablesolutions.akka.actor import scala.collection.mutable.ListBuffer import scala.reflect.Manifest -import java.util.concurrent.{CopyOnWriteArrayList, ConcurrentHashMap} + +import java.util.concurrent.{CopyOnWriteArraySet, ConcurrentHashMap} +import java.util.{Set=>JSet} + import se.scalablesolutions.akka.util.ListenerManagement sealed trait ActorRegistryEvent @@ -27,8 +30,8 @@ case class ActorUnregistered(actor: ActorRef) extends ActorRegistryEvent */ object ActorRegistry extends ListenerManagement { private val actorsByUUID = new ConcurrentHashMap[String, ActorRef] - private val actorsById = new ConcurrentHashMap[String, List[ActorRef]] - private val actorsByClassName = new ConcurrentHashMap[String, List[ActorRef]] + private val actorsById = new ConcurrentHashMap[String, JSet[ActorRef]] + private val actorsByClassName = new ConcurrentHashMap[String, JSet[ActorRef]] /** * Returns all actors in the system. @@ -73,16 +76,18 @@ object ActorRegistry extends ListenerManagement { * Finds all actors of the exact type specified by the class passed in as the Class argument. */ def actorsFor[T <: Actor](clazz: Class[T]): List[ActorRef] = { - if (actorsByClassName.containsKey(clazz.getName)) actorsByClassName.get(clazz.getName) - else Nil + if (actorsByClassName.containsKey(clazz.getName)) { + actorsByClassName.get(clazz.getName).toArray.toList.asInstanceOf[List[ActorRef]] + } else Nil } /** * Finds all actors that has a specific id. */ def actorsFor(id: String): List[ActorRef] = { - if (actorsById.containsKey(id)) actorsById.get(id) - else Nil + if (actorsById.containsKey(id)) { + actorsById.get(id).toArray.toList.asInstanceOf[List[ActorRef]] + } else Nil } /** @@ -103,27 +108,38 @@ object ActorRegistry extends ListenerManagement { // ID val id = actor.id if (id eq null) throw new IllegalStateException("Actor.id is null " + actor) - if (actorsById.containsKey(id)) actorsById.put(id, actor :: actorsById.get(id)) - else actorsById.put(id, actor :: Nil) + if (actorsById.containsKey(id)) actorsById.get(id).add(actor) + else { + val set = new CopyOnWriteArraySet[ActorRef] + set.add(actor) + actorsById.put(id, set) + } // Class name val className = actor.actor.getClass.getName - if (actorsByClassName.containsKey(className)) { - actorsByClassName.put(className, actor :: actorsByClassName.get(className)) - } else actorsByClassName.put(className, actor :: Nil) + if (actorsByClassName.containsKey(className)) actorsByClassName.get(className).add(actor) + else { + val set = new CopyOnWriteArraySet[ActorRef] + set.add(actor) + actorsByClassName.put(className, set) + } // notify listeners foreachListener(_ ! ActorRegistered(actor)) } /** - * FIXME: WRONG - unregisters all actors with the same id and class name, should remove the right one in each list * Unregisters an actor in the ActorRegistry. */ def unregister(actor: ActorRef) = { actorsByUUID remove actor.uuid - actorsById remove actor.id - actorsByClassName remove actor.getClass.getName + + val id = actor.id + if (actorsById.containsKey(id)) actorsById.get(id).remove(actor) + + val className = actor.getClass.getName + if (actorsByClassName.containsKey(className)) actorsByClassName.get(className).remove(actor) + // notify listeners foreachListener(_ ! ActorUnregistered(actor)) } diff --git a/akka-core/src/main/scala/stm/TransactionManagement.scala b/akka-core/src/main/scala/stm/TransactionManagement.scala index 5bc69c037d..e6485ff761 100644 --- a/akka-core/src/main/scala/stm/TransactionManagement.scala +++ b/akka-core/src/main/scala/stm/TransactionManagement.scala @@ -184,5 +184,3 @@ trait StmUtil { }.execute() } } - - diff --git a/akka-core/src/test/scala/ActorPatternsTest.scala b/akka-core/src/test/scala/ActorPatternsTest.scala index f6205c2a91..65c9dbf9f4 100644 --- a/akka-core/src/test/scala/ActorPatternsTest.scala +++ b/akka-core/src/test/scala/ActorPatternsTest.scala @@ -1,6 +1,5 @@ package se.scalablesolutions.akka.patterns -import java.util.concurrent.atomic.AtomicInteger import se.scalablesolutions.akka.config.ScalaConfig._ import se.scalablesolutions.akka.actor.Actor import se.scalablesolutions.akka.actor.Actor._ @@ -11,8 +10,11 @@ import org.junit.runner.RunWith import org.scalatest.junit.JUnitRunner import org.scalatest.matchers.MustMatchers import org.junit.{Before, After, Test} + import scala.collection.mutable.HashSet -import java.util.concurrent.{ CountDownLatch, TimeUnit } + +import java.util.concurrent.atomic.AtomicInteger +import java.util.concurrent.{CountDownLatch, TimeUnit} @RunWith(classOf[JUnitRunner]) class ActorPatternsTest extends junit.framework.TestCase with Suite with MustMatchers with Logging { diff --git a/akka-core/src/test/scala/SerializableActorSpec.scala b/akka-core/src/test/scala/SerializableActorSpec.scala index a743a5eb0b..2db077c354 100644 --- a/akka-core/src/test/scala/SerializableActorSpec.scala +++ b/akka-core/src/test/scala/SerializableActorSpec.scala @@ -20,7 +20,6 @@ class SerializableActorSpec extends describe("SerializableActor") { it("should be able to serialize and deserialize a JavaSerializableActor") { val actor1 = actorOf[JavaSerializableTestActor].start - val serializer = actor1.serializer.getOrElse(fail("Serializer not defined")) (actor1 !! "hello").getOrElse("_") should equal("world 1") val bytes = actor1.toBinary @@ -32,7 +31,6 @@ class SerializableActorSpec extends it("should be able to serialize and deserialize a ProtobufSerializableActor") { val actor1 = actorOf[ProtobufSerializableTestActor].start - val serializer = actor1.serializer.getOrElse(fail("Serializer not defined")) (actor1 !! "hello").getOrElse("_") should equal("world 1") (actor1 !! "hello").getOrElse("_") should equal("world 2") @@ -43,33 +41,16 @@ class SerializableActorSpec extends (actor2 !! "hello").getOrElse("_") should equal("world 3") } - -/* - it("should be able to serialize and deserialize a JavaJSONSerializableActor") { - val actor1 = actorOf[JavaJSONSerializableTestActor].start - val serializer = actor1.serializer.getOrElse(fail("Serializer not defined")) - (actor1 !! "hello").getOrElse("_") should equal("world 1") - (actor1 !! "hello").getOrElse("_") should equal("world 2") + it("should be able to serialize and deserialize a StatelessSerializableActor") { + val actor1 = actorOf[StatelessSerializableTestActor].start + (actor1 !! "hello").getOrElse("_") should equal("world") val bytes = actor1.toBinary val actor2 = ActorRef.fromBinaryToLocalActorRef(bytes) actor2.start - (actor2 !! "hello").getOrElse("_") should equal("world 3") + (actor2 !! "hello").getOrElse("_") should equal("world") } - - it("should be able to serialize and deserialize a ScalaJSONSerializableActor") { - val actor1 = actorOf[ScalaJSONSerializableTestActor].start - val serializer = actor1.serializer.getOrElse(fail("Serializer not defined")) - (actor1 !! "hello").getOrElse("_") should equal("world 1") - - val bytes = actor1.toBinary - val actor2 = ActorRef.fromBinaryToLocalActorRef(bytes) - - actor2.start - (actor2 !! "hello").getOrElse("_") should equal("world 2") - } -*/ } } @@ -82,6 +63,13 @@ class SerializableActorSpec extends } } +class StatelessSerializableTestActor extends StatelessSerializableActor { + def receive = { + case "hello" => + self.reply("world") + } +} + class ProtobufSerializableTestActor extends ProtobufSerializableActor[ProtobufProtocol.Counter] { val clazz = classOf[ProtobufProtocol.Counter] private var count = 0 @@ -95,21 +83,3 @@ class ProtobufSerializableTestActor extends ProtobufSerializableActor[ProtobufPr self.reply("world " + count) } } - -class JavaJSONSerializableTestActor extends JavaJSONSerializableActor { - private var count = 0 - def receive = { - case "hello" => - count = count + 1 - self.reply("world " + count) - } -} - -@scala.reflect.BeanInfo class ScalaJSONSerializableTestActor extends ScalaJSONSerializableActor { - private var count = 0 - def receive = { - case "hello" => - count = count + 1 - self.reply("world " + count) - } -} \ No newline at end of file diff --git a/akka-core/src/test/scala/StmSpec.scala b/akka-core/src/test/scala/StmSpec.scala index 1544936446..37914069a8 100644 --- a/akka-core/src/test/scala/StmSpec.scala +++ b/akka-core/src/test/scala/StmSpec.scala @@ -104,26 +104,21 @@ class StmSpec extends describe("Transactor") { it("should be able receive message sent with !! and pass it along to nested transactor with !! and receive reply; multiple times in a row") { import GlobalTransactionVectorTestActor._ - try { - val actor = actorOf[NestedTransactorLevelOneActor].start - actor !! Add(2) - val size1 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) - size1 should equal(2) - actor !! Add(7) - actor ! "HiLevelOne" - val size2 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) - size2 should equal(7) - actor !! Add(0) - actor ! "HiLevelTwo" - val size3 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) - size3 should equal(0) - actor !! Add(3) - val size4 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) - size4 should equal(3) - } catch { - case e => - fail(e.toString) - } + val actor = actorOf[NestedTransactorLevelOneActor].start + actor !! Add(2) + val size1 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) + size1 should equal(2) + actor !! Add(7) + actor ! "HiLevelOne" + val size2 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) + size2 should equal(7) + actor !! Add(0) + actor ! "HiLevelTwo" + val size3 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) + size3 should equal(0) + actor !! Add(3) + val size4 = (actor !! Size).as[Int].getOrElse(fail("Could not get size")) + size4 should equal(3) } } /* diff --git a/akka-http/src/main/scala/AkkaCometServlet.scala b/akka-http/src/main/scala/AkkaCometServlet.scala index b020c473f6..c5a6fb3fba 100644 --- a/akka-http/src/main/scala/AkkaCometServlet.scala +++ b/akka-http/src/main/scala/AkkaCometServlet.scala @@ -7,7 +7,7 @@ package se.scalablesolutions.akka.comet import se.scalablesolutions.akka.util.Logging import java.util.{List => JList} -import javax.servlet.ServletConfig +import javax.servlet.{ServletConfig,ServletContext} import javax.servlet.http.{HttpServletRequest, HttpServletResponse} import com.sun.jersey.spi.container.servlet.ServletContainer @@ -43,14 +43,32 @@ class AtmosphereRestServlet extends ServletContainer with AtmosphereServletProce * Used by the Akka Kernel to bootstrap REST and Comet. */ class AkkaServlet extends AtmosphereServlet with Logging { + import se.scalablesolutions.akka.config.Config.{config => c} + addInitParameter(AtmosphereServlet.DISABLE_ONSTATE_EVENT,"true") addInitParameter(AtmosphereServlet.BROADCASTER_CLASS,classOf[AkkaBroadcaster].getName) + addInitParameter("com.sun.jersey.config.property.packages",c.getList("akka.rest.resource_packages").mkString(";")) + addInitParameter("com.sun.jersey.spi.container.ResourceFilters",c.getList("akka.rest.filters").mkString(",")) - lazy val servlet = createRestServlet - - protected def createRestServlet : AtmosphereRestServlet = new AtmosphereRestServlet { + val servlet = new AtmosphereRestServlet { override def getInitParameter(key : String) = AkkaServlet.this.getInitParameter(key) + override def getInitParameterNames() = AkkaServlet.this.getInitParameterNames() } + + override def getInitParameter(key : String) = Option(super.getInitParameter(key)).getOrElse(initParams.get(key)) + + override def getInitParameterNames() = { + val names = new java.util.Vector[String]() + + val i = initParams.keySet.iterator + while(i.hasNext) names.add(i.next.toString) + + val e = super.getInitParameterNames + while(e.hasMoreElements) names.add(e.nextElement.toString) + + names.elements + } + /** * We override this to avoid Atmosphere looking for it's atmosphere.xml file * Instead we specify what semantics we want in code. diff --git a/akka-http/src/main/scala/Security.scala b/akka-http/src/main/scala/Security.scala index 284d82d98e..bbc6242bfc 100644 --- a/akka-http/src/main/scala/Security.scala +++ b/akka-http/src/main/scala/Security.scala @@ -37,10 +37,6 @@ import javax.annotation.security.{DenyAll, PermitAll, RolesAllowed} import java.security.Principal import java.util.concurrent.TimeUnit -import net.liftweb.util.{SecurityHelpers, StringHelpers, IoHelpers} - -object Enc extends SecurityHelpers with StringHelpers with IoHelpers - case object OK /** @@ -249,7 +245,7 @@ trait BasicAuthenticationActor extends AuthenticationActor[BasicCredentials] { * rest-part of the akka config */ trait DigestAuthenticationActor extends AuthenticationActor[DigestCredentials] with Logging { - import Enc._ + import LiftUtils._ private object InvalidateNonces @@ -483,3 +479,87 @@ trait SpnegoAuthenticationActor extends AuthenticationActor[SpnegoCredentials] w } } + +/* +* Copyright 2006-2010 WorldWide Conferencing, LLC +* +* Licensed under the Apache License, Version 2.0 (the "License"); +* you may not use this file except in compliance with the License. +* You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +object LiftUtils { + import java.security.{MessageDigest,SecureRandom} + val random = new SecureRandom() + + def md5(in: Array[Byte]): Array[Byte] = (MessageDigest.getInstance("MD5")).digest(in) + + /** + * Create a random string of a given size + * @param size size of the string to create. Must be a positive or nul integer + * @return the generated string + */ + def randomString(size: Int): String = { + def addChar(pos: Int, lastRand: Int, sb: StringBuilder): StringBuilder = { + if (pos >= size) sb + else { + val randNum = if ((pos % 6) == 0) random.nextInt else lastRand + sb.append((randNum & 0x1f) match { + case n if n < 26 => ('A' + n).toChar + case n => ('0' + (n - 26)).toChar + }) + addChar(pos + 1, randNum >> 5, sb) + } + } + addChar(0, 0, new StringBuilder(size)).toString + } + +/** encode a Byte array as hexadecimal characters */ + def hexEncode(in: Array[Byte]): String = { + val sb = new StringBuilder + val len = in.length + def addDigit(in: Array[Byte], pos: Int, len: Int, sb: StringBuilder) { + if (pos < len) { + val b: Int = in(pos) + val msb = (b & 0xf0) >> 4 + val lsb = (b & 0x0f) + sb.append((if (msb < 10) ('0' + msb).asInstanceOf[Char] else ('a' + (msb - 10)).asInstanceOf[Char])) + sb.append((if (lsb < 10) ('0' + lsb).asInstanceOf[Char] else ('a' + (lsb - 10)).asInstanceOf[Char])) + addDigit(in, pos + 1, len, sb) + } + } + addDigit(in, 0, len, sb) + sb.toString + } + + + /** + * Splits a string of the form <name1=value1, name2=value2, ... > and unquotes the quoted values. + * The result is a Map[String, String] + */ + def splitNameValuePairs(props: String): Map[String, String] = { + /** + * If str is surrounded by quotes it return the content between the quotes + */ + def unquote(str: String) = { + if ((str ne null) && str.length >= 2 && str.charAt(0) == '\"' && str.charAt(str.length - 1) == '\"') + str.substring(1, str.length - 1) + else + str + } + + val list = props.split(",").toList.map(in => { + val pair = in match { case null => Nil case s => s.split("=").toList.map(_.trim).filter(_.length > 0) } + (pair(0), unquote(pair(1))) + }) + val map: Map[String, String] = Map.empty + (map /: list)((m, next) => m + (next)) + } +} diff --git a/akka-kernel/src/main/scala/EmbeddedAppServer.scala b/akka-kernel/src/main/scala/EmbeddedAppServer.scala index 8d9982c7e2..8f5495b5c1 100644 --- a/akka-kernel/src/main/scala/EmbeddedAppServer.scala +++ b/akka-kernel/src/main/scala/EmbeddedAppServer.scala @@ -61,12 +61,6 @@ trait EmbeddedAppServer extends Bootable with Logging { "org.atmosphere.container.GrizzlyCometSupport") adapter.addInitParameter("com.sun.jersey.config.property.resourceConfigClass", "com.sun.jersey.api.core.PackagesResourceConfig") - adapter.addInitParameter("com.sun.jersey.config.property.packages", - config.getList("akka.rest.resource_packages").mkString(";") - ) - adapter.addInitParameter("com.sun.jersey.spi.container.ResourceFilters", - config.getList("akka.rest.filters").mkString(",") - ) if (HOME.isDefined) adapter.addRootFolder(HOME.get + "/deploy/root") log.info("REST service root path [%s] and context path [%s]", adapter.getRootFolders, adapter.getContextPath) diff --git a/akka-samples/akka-sample-camel/src/main/resources/context-standalone.xml b/akka-samples/akka-sample-camel/src/main/resources/context-standalone.xml index f0932ce1b3..36645a936d 100644 --- a/akka-samples/akka-sample-camel/src/main/resources/context-standalone.xml +++ b/akka-samples/akka-sample-camel/src/main/resources/context-standalone.xml @@ -1,11 +1,24 @@ +http://scalablesolutions.se/akka/akka-0.10.xsd +http://camel.apache.org/schema/spring +http://camel.apache.org/schema/spring/camel-spring.xsd"> + + + + + + + + + + diff --git a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala index 924cb6c9e5..2cfb56e64f 100644 --- a/akka-samples/akka-sample-camel/src/main/scala/Boot.scala +++ b/akka-samples/akka-sample-camel/src/main/scala/Boot.scala @@ -41,7 +41,7 @@ class Boot { // Supervise(actorOf[Consumer2], LifeCycle(Permanent)) :: Nil)) // ----------------------------------------------------------------------- - // Routing example + // Tranformer example // ----------------------------------------------------------------------- val producer = actorOf[Producer1] diff --git a/akka-samples/akka-sample-camel/src/main/scala/StandaloneApplication.scala b/akka-samples/akka-sample-camel/src/main/scala/StandaloneApplication.scala index aa4292696a..b7e834fcba 100644 --- a/akka-samples/akka-sample-camel/src/main/scala/StandaloneApplication.scala +++ b/akka-samples/akka-sample-camel/src/main/scala/StandaloneApplication.scala @@ -59,24 +59,16 @@ class StandaloneApplicationRoute extends RouteBuilder { object StandaloneSpringApplication { def main(args: Array[String]) { - import CamelContextManager.context + import CamelContextManager._ - // use Spring application context as active object registry - val springctx = new ClassPathXmlApplicationContext("/context-standalone.xml") - val registry = new ApplicationContextRegistry(springctx) - - // customize CamelContext - CamelContextManager.init(new DefaultCamelContext(registry)) - CamelContextManager.context.addRoutes(new StandaloneSpringApplicationRoute) - - // start CamelService - val camelService = CamelService.newInstance.load + // load Spring application context + val appctx = new ClassPathXmlApplicationContext("/context-standalone.xml") // access 'externally' registered active objects with active-object component - assert("hello msg3" == context.createProducerTemplate.requestBody("direct:test3", "msg3")) + assert("hello msg3" == template.requestBody("direct:test3", "msg3")) - // shutdown CamelService - camelService.unload + // destroy Spring application context + appctx.close // shutdown all (internally) created actors ActorRegistry.shutdownAll diff --git a/akka-sbt-plugin/project/build.properties b/akka-sbt-plugin/project/build.properties index 27b9049bf2..24af37f708 100644 --- a/akka-sbt-plugin/project/build.properties +++ b/akka-sbt-plugin/project/build.properties @@ -1,6 +1,6 @@ -project.name=Akka Plugin +project.name=Akka SBT Plugin project.organization=se.scalablesolutions.akka # mirrors akka version -project.version=0.9.1 +project.version=0.10 sbt.version=0.7.4 build.scala.versions=2.7.7 diff --git a/akka-sbt-plugin/project/build/AkkaPluginProject.scala b/akka-sbt-plugin/project/build/AkkaPluginProject.scala index 4c63e9d14f..976915aaf3 100644 --- a/akka-sbt-plugin/project/build/AkkaPluginProject.scala +++ b/akka-sbt-plugin/project/build/AkkaPluginProject.scala @@ -1,3 +1,7 @@ import sbt._ -class AkkaPluginProject(info: ProjectInfo) extends PluginProject(info) +class AkkaPluginProject(info: ProjectInfo) extends PluginProject(info) { + override def managedStyle = ManagedStyle.Maven + val publishTo = "Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/releases/" + Credentials(Path.userHome / ".ivy2" / ".scala-tools-credentials", log) +} diff --git a/akka-sbt-plugin/src/main/scala/AkkaProject.scala b/akka-sbt-plugin/src/main/scala/AkkaProject.scala index 5ec83204a2..bc0fe51f97 100644 --- a/akka-sbt-plugin/src/main/scala/AkkaProject.scala +++ b/akka-sbt-plugin/src/main/scala/AkkaProject.scala @@ -1,11 +1,12 @@ import sbt._ object AkkaRepositories { - val AkkaRepo = MavenRepository("Akka Repository", "http://scalablesolutions.se/akka/repository") - val GuiceyFruitRepo = MavenRepository("GuiceyFruit Repo", "http://guiceyfruit.googlecode.com/svn/repo/releases/") - val JBossRepo = MavenRepository("JBoss Repo", "https://repository.jboss.org/nexus/content/groups/public/") - val SunJDMKRepo = MavenRepository("Sun JDMK Repo", "http://wp5.e-taxonomy.eu/cdmlib/mavenrepo") - val JavaNetRepo = MavenRepository("java.net Repo", "http://download.java.net/maven/2") + val AkkaRepo = MavenRepository("Akka Repository", "http://scalablesolutions.se/akka/repository") + val GuiceyFruitRepo = MavenRepository("GuiceyFruit Repo", "http://guiceyfruit.googlecode.com/svn/repo/releases/") + val JBossRepo = MavenRepository("JBoss Repo", "https://repository.jboss.org/nexus/content/groups/public/") + val SunJDMKRepo = MavenRepository("Sun JDMK Repo", "http://wp5.e-taxonomy.eu/cdmlib/mavenrepo") + val JavaNetRepo = MavenRepository("java.net Repo", "http://download.java.net/maven/2") + val CodehausSnapshotRepo = MavenRepository("Codehaus Snapshots", "http://snapshots.repository.codehaus.org") } trait AkkaBaseProject extends BasicScalaProject { @@ -14,7 +15,8 @@ trait AkkaBaseProject extends BasicScalaProject { // Every dependency that cannot be resolved from the built-in repositories (Maven Central and Scala Tools Releases) // is resolved from a ModuleConfiguration. This will result in a significant acceleration of the update action. - val akkaModuleConfig = ModuleConfiguration("se.scalablesolutions.akka", AkkaRepo) + // for development version resolve to .ivy2/local + // val akkaModuleConfig = ModuleConfiguration("se.scalablesolutions.akka", AkkaRepo) val netLagModuleConfig = ModuleConfiguration("net.lag", AkkaRepo) val sbinaryModuleConfig = ModuleConfiguration("sbinary", AkkaRepo) val redisModuleConfig = ModuleConfiguration("com.redis", AkkaRepo) @@ -34,11 +36,12 @@ trait AkkaBaseProject extends BasicScalaProject { val jerseyModuleConfig = ModuleConfiguration("com.sun.jersey", JavaNetRepo) val jerseyContrModuleConfig = ModuleConfiguration("com.sun.jersey.contribs", JavaNetRepo) val grizzlyModuleConfig = ModuleConfiguration("com.sun.grizzly", JavaNetRepo) + val multiverseModuleConfig = ModuleConfiguration("org.multiverse", CodehausSnapshotRepo) // only while snapshot version val liftModuleConfig = ModuleConfiguration("net.liftweb", ScalaToolsSnapshots) } trait AkkaProject extends AkkaBaseProject { - val akkaVersion = "0.9.1" + val akkaVersion = "0.10" // convenience method def akkaModule(module: String) = "se.scalablesolutions.akka" %% ("akka-" + module) % akkaVersion diff --git a/akka-spring/akka-spring-test-java/pom.xml b/akka-spring/akka-spring-test-java/pom.xml index 11a29262ac..ff36202071 100644 --- a/akka-spring/akka-spring-test-java/pom.xml +++ b/akka-spring/akka-spring-test-java/pom.xml @@ -17,6 +17,11 @@ + + akka + Akka Repo + http://www.scalablesolutions.se/akka/repository/ + project.embedded.module Project Embedded Repository @@ -146,23 +151,23 @@ se.scalablesolutions.akka - akka-core_2.8.0.Beta1 - 0.9 + akka-core_2.8.0.RC3 + 0.9.1 se.scalablesolutions.akka akka-util_2.8.0.Beta1 - 0.9 + 0.8.1 se.scalablesolutions.akka akka-util-java_2.8.0.Beta1 - 0.9 + 0.8.1 se.scalablesolutions.akka - akka-spring_2.8.0.Beta1 - 0.9 + akka-spring_2.8.0.RC3 + 0.9.1 org.springframework diff --git a/akka-spring/src/main/resources/META-INF/spring.schemas b/akka-spring/src/main/resources/META-INF/spring.schemas index d04d65566a..27f7704018 100644 --- a/akka-spring/src/main/resources/META-INF/spring.schemas +++ b/akka-spring/src/main/resources/META-INF/spring.schemas @@ -1 +1 @@ -http\://www.akkasource.org/schema/akka=se/scalablesolutions/akka/spring/akka.xsd +http\://scalablesolutions.se/akka/akka-0.10.xsd=se/scalablesolutions/akka/spring/akka-0.10.xsd diff --git a/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-0.10.xsd b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-0.10.xsd new file mode 100644 index 0000000000..9047b7c588 --- /dev/null +++ b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka-0.10.xsd @@ -0,0 +1,255 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Name of the remote host. + + + + + + + Port of the remote host. + + + + + + + + + + + Pre restart callback method that is called during restart. + + + + + + + Post restart callback method that is called during restart. + + + + + + + + + + + + + + + + + + + Name of the target class. + + + + + + + default timeout for '!!' invocations + + + + + + + Set to true if messages should have REQUIRES_NEW semantics + + + + + + + Interface implemented by target class. + + + + + + + Lifecycle, permanent or temporary + + + + + + + Supported scopes are singleton and prototype + + + + + + + + + + + + + + + + + + + + + + + + + + + + Failover scheme, AllForOne or OneForOne + + + + + + + Maximal number of retries. + + + + + + + Timerange for restart. + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd index 20cb966b8f..862cd06987 100644 --- a/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd +++ b/akka-spring/src/main/resources/se/scalablesolutions/akka/spring/akka.xsd @@ -25,6 +25,13 @@ + + + + + + + @@ -158,6 +165,13 @@ Lifecycle, permanent or temporary + + + + + Supported scopes are singleton and prototype + + diff --git a/akka-spring/src/main/scala/ActiveObjectFactoryBean.scala b/akka-spring/src/main/scala/ActiveObjectFactoryBean.scala index 66ef87a15d..b4bc8795fc 100644 --- a/akka-spring/src/main/scala/ActiveObjectFactoryBean.scala +++ b/akka-spring/src/main/scala/ActiveObjectFactoryBean.scala @@ -4,19 +4,31 @@ package se.scalablesolutions.akka.spring +import java.beans.PropertyDescriptor + +import java.lang.reflect.Method +import org.springframework.beans.BeanWrapperImpl +import org.springframework.beans.BeanWrapper +import org.springframework.beans.BeanUtils +import org.springframework.util.ReflectionUtils +import org.springframework.util.StringUtils +import org.springframework.beans.factory.BeanFactory import org.springframework.beans.factory.config.AbstractFactoryBean import se.scalablesolutions.akka.actor.ActiveObject import reflect.BeanProperty import se.scalablesolutions.akka.config.ScalaConfig.RestartCallbacks import se.scalablesolutions.akka.dispatch.MessageDispatcher - +import se.scalablesolutions.akka.util.Logging /** * Factory bean for active objects. + * * @author michaelkober + * @author Johan Rask */ -class ActiveObjectFactoryBean extends AbstractFactoryBean[AnyRef] { +class ActiveObjectFactoryBean extends AbstractFactoryBean[AnyRef] with Logging { import StringReflect._ + import AkkaSpringConfigurationTags._ @BeanProperty var target: String = "" @BeanProperty var timeout: Long = _ @@ -28,22 +40,61 @@ class ActiveObjectFactoryBean extends AbstractFactoryBean[AnyRef] { @BeanProperty var port: Int = _ @BeanProperty var lifecycle: String = "" @BeanProperty var dispatcher: DispatcherProperties = _ + @BeanProperty var scope:String = VAL_SCOPE_SINGLETON + @BeanProperty var property:PropertyEntries = _ /* * @see org.springframework.beans.factory.FactoryBean#getObjectType() */ - def getObjectType: Class[AnyRef] = target.toClass - + def getObjectType: Class[AnyRef] = try { + target.toClass + } catch { + // required by contract to return null + case e: ClassNotFoundException => null + } /* * @see org.springframework.beans.factory.config.AbstractFactoryBean#createInstance() */ def createInstance: AnyRef = { + if(scope.equals(VAL_SCOPE_SINGLETON)) { + setSingleton(true) + } else { + setSingleton(false) + } var argumentList = "" if (isRemote) argumentList += "r" if (hasInterface) argumentList += "i" if (hasDispatcher) argumentList += "d" - create(argumentList) + + setProperties( + create(argumentList)) +} + + /** + * This method manages element by injecting either + * values () and bean references () + */ + private def setProperties(ref:AnyRef) : AnyRef = { + log.debug("Processing properties and dependencies for target class %s",target) + val beanWrapper = new BeanWrapperImpl(ref); + for(entry <- property.entryList) { + val propertyDescriptor = BeanUtils.getPropertyDescriptor(ref.getClass,entry.name) + val method = propertyDescriptor.getWriteMethod(); + + if(StringUtils.hasText(entry.ref)) { + log.debug("Setting property %s with bean ref %s using method %s", + entry.name,entry.ref,method.getName) + method.invoke(ref,getBeanFactory().getBean(entry.ref)) + } else if(StringUtils.hasText(entry.value)) { + log.debug("Setting property %s with value %s using method %s", + entry.name,entry.value,method.getName) + beanWrapper.setPropertyValue(entry.name,entry.value) + } else { + throw new AkkaBeansException("Either property@ref or property@value must be set on property element") + } + } + ref } // TODO: check if this works in 2.8 (type inferred to Nothing instead of AnyRef here) @@ -63,15 +114,15 @@ class ActiveObjectFactoryBean extends AbstractFactoryBean[AnyRef] { if (argList == "r") { ActiveObject.newRemoteInstance(target.toClass, timeout, transactional, host, port, callbacks) } else if (argList == "ri" ) { - ActiveObject.newRemoteInstance(interface.toClass, target.toClass, timeout, transactional, host, port, callbacks) + ActiveObject.newRemoteInstance(interface.toClass, aNewInstance(target.toClass), timeout, transactional, host, port, callbacks) } else if (argList == "rd") { ActiveObject.newRemoteInstance(target.toClass, timeout, transactional, dispatcherInstance, host, port, callbacks) } else if (argList == "rid") { - ActiveObject.newRemoteInstance(interface.toClass, target.toClass, timeout, transactional, dispatcherInstance, host, port, callbacks) + ActiveObject.newRemoteInstance(interface.toClass, aNewInstance(target.toClass), timeout, transactional, dispatcherInstance, host, port, callbacks) } else if (argList == "i") { - ActiveObject.newInstance(interface.toClass, target.toClass, timeout, transactional, callbacks) + ActiveObject.newInstance(interface.toClass, aNewInstance(target.toClass), timeout, transactional, callbacks) } else if (argList == "id") { - ActiveObject.newInstance(interface.toClass, target.toClass, timeout, transactional, dispatcherInstance, callbacks) + ActiveObject.newInstance(interface.toClass, aNewInstance(target.toClass), timeout, transactional, dispatcherInstance, callbacks) } else if (argList == "d") { ActiveObject.newInstance(target.toClass, timeout, transactional, dispatcherInstance, callbacks) } else { @@ -79,6 +130,10 @@ class ActiveObjectFactoryBean extends AbstractFactoryBean[AnyRef] { } } + def aNewInstance[T <: AnyRef](clazz: Class[T]) : T = { + clazz.newInstance().asInstanceOf[T] + } + /** * create Option[RestartCallback] */ diff --git a/akka-spring/src/main/scala/ActiveObjectParser.scala b/akka-spring/src/main/scala/ActiveObjectParser.scala index dd48f8dbe1..d3b25791c6 100644 --- a/akka-spring/src/main/scala/ActiveObjectParser.scala +++ b/akka-spring/src/main/scala/ActiveObjectParser.scala @@ -5,10 +5,12 @@ package se.scalablesolutions.akka.spring import org.springframework.util.xml.DomUtils import org.w3c.dom.Element +import scala.collection.JavaConversions._ /** * Parser trait for custom namespace configuration for active-object. * @author michaelkober + * @author Johan Rask */ trait ActiveObjectParser extends BeanParser with DispatcherParser { import AkkaSpringConfigurationTags._ @@ -23,6 +25,7 @@ trait ActiveObjectParser extends BeanParser with DispatcherParser { val remoteElement = DomUtils.getChildElementByTagName(element, REMOTE_TAG); val callbacksElement = DomUtils.getChildElementByTagName(element, RESTART_CALLBACKS_TAG); val dispatcherElement = DomUtils.getChildElementByTagName(element, DISPATCHER_TAG) + val propertyEntries = DomUtils.getChildElementsByTagName(element,PROPERTYENTRY_TAG) if (remoteElement != null) { objectProperties.host = mandatory(remoteElement, HOST) @@ -42,6 +45,14 @@ trait ActiveObjectParser extends BeanParser with DispatcherParser { objectProperties.dispatcher = dispatcherProperties } + for(element <- propertyEntries) { + val entry = new PropertyEntry() + entry.name = element.getAttribute("name"); + entry.value = element.getAttribute("value") + entry.ref = element.getAttribute("ref") + objectProperties.propertyEntries.add(entry) + } + try { objectProperties.timeout = mandatory(element, TIMEOUT).toLong } catch { @@ -58,8 +69,13 @@ trait ActiveObjectParser extends BeanParser with DispatcherParser { } if (!element.getAttribute(LIFECYCLE).isEmpty) { - objectProperties.lifecyclye = element.getAttribute(LIFECYCLE) + objectProperties.lifecycle = element.getAttribute(LIFECYCLE) } + + if (!element.getAttribute(SCOPE).isEmpty) { + objectProperties.scope = element.getAttribute(SCOPE) + } + objectProperties } diff --git a/akka-spring/src/main/scala/ActiveObjectProperties.scala b/akka-spring/src/main/scala/ActiveObjectProperties.scala index e273d27a8d..ba4828e2f9 100644 --- a/akka-spring/src/main/scala/ActiveObjectProperties.scala +++ b/akka-spring/src/main/scala/ActiveObjectProperties.scala @@ -20,8 +20,10 @@ class ActiveObjectProperties { var postRestart: String = "" var host: String = "" var port: Int = _ - var lifecyclye: String = "" + var lifecycle: String = "" + var scope:String = "" var dispatcher: DispatcherProperties = _ + var propertyEntries = new PropertyEntries() /** @@ -37,8 +39,10 @@ class ActiveObjectProperties { builder.addPropertyValue(TARGET, target) builder.addPropertyValue(INTERFACE, interface) builder.addPropertyValue(TRANSACTIONAL, transactional) - builder.addPropertyValue(LIFECYCLE, lifecyclye) + builder.addPropertyValue(LIFECYCLE, lifecycle) + builder.addPropertyValue(SCOPE, scope) builder.addPropertyValue(DISPATCHER_TAG, dispatcher) - } + builder.addPropertyValue(PROPERTYENTRY_TAG,propertyEntries) +} } diff --git a/akka-spring/src/main/scala/AkkaBeansException.scala b/akka-spring/src/main/scala/AkkaBeansException.scala new file mode 100644 index 0000000000..58928cf69e --- /dev/null +++ b/akka-spring/src/main/scala/AkkaBeansException.scala @@ -0,0 +1,14 @@ +package se.scalablesolutions.akka.spring + +import org.springframework.beans.BeansException + +/** +* Exception to use when something goes wrong during bean creation +@author Johan Rask +*/ +class AkkaBeansException(errorMsg:String,t:Throwable) extends BeansException(errorMsg,t) { + + def this(errorMsg:String) = { + this(errorMsg,null) + } +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/AkkaNamespaceHandler.scala b/akka-spring/src/main/scala/AkkaNamespaceHandler.scala index 88f2b4c81b..466dbeca30 100644 --- a/akka-spring/src/main/scala/AkkaNamespaceHandler.scala +++ b/akka-spring/src/main/scala/AkkaNamespaceHandler.scala @@ -15,5 +15,6 @@ class AkkaNamespaceHandler extends NamespaceHandlerSupport { registerBeanDefinitionParser(ACTIVE_OBJECT_TAG, new ActiveObjectBeanDefinitionParser()); registerBeanDefinitionParser(SUPERVISION_TAG, new SupervisionBeanDefinitionParser()); registerBeanDefinitionParser(DISPATCHER_TAG, new DispatcherBeanDefinitionParser()); + registerBeanDefinitionParser(CAMEL_SERVICE_TAG, new CamelServiceBeanDefinitionParser); } } diff --git a/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala b/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala index 8ceb1b8f6a..5e927ceba1 100644 --- a/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala +++ b/akka-spring/src/main/scala/AkkaSpringConfigurationTags.scala @@ -15,6 +15,8 @@ object AkkaSpringConfigurationTags { val ACTIVE_OBJECT_TAG = "active-object" val SUPERVISION_TAG = "supervision" val DISPATCHER_TAG = "dispatcher" + val PROPERTYENTRY_TAG = "property" + val CAMEL_SERVICE_TAG = "camel-service" // active-object sub tags val RESTART_CALLBACKS_TAG = "restart-callbacks" @@ -29,6 +31,9 @@ object AkkaSpringConfigurationTags { // dispatcher sub tags val THREAD_POOL_TAG = "thread-pool" + // camel-service sub tags + val CAMEL_CONTEXT_TAG = "camel-context" + // --- ATTRIBUTES // // active object attributes @@ -41,6 +46,7 @@ object AkkaSpringConfigurationTags { val PRE_RESTART = "pre" val POST_RESTART = "post" val LIFECYCLE = "lifecycle" + val SCOPE = "scope" // supervision attributes val FAILOVER = "failover" @@ -68,6 +74,9 @@ object AkkaSpringConfigurationTags { val VAL_LIFECYCYLE_TEMPORARY = "temporary" val VAL_LIFECYCYLE_PERMANENT = "permanent" + val VAL_SCOPE_SINGLETON = "singleton" + val VAL_SCOPE_PROTOTYPE = "prototype" + // Failover val VAL_ALL_FOR_ONE = "AllForOne" val VAL_ONE_FOR_ONE = "OneForOne" diff --git a/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala b/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala new file mode 100644 index 0000000000..f8234ec8c7 --- /dev/null +++ b/akka-spring/src/main/scala/CamelServiceBeanDefinitionParser.scala @@ -0,0 +1,41 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ +package se.scalablesolutions.akka.spring + +import org.springframework.beans.factory.support.BeanDefinitionBuilder +import org.springframework.beans.factory.xml.{ParserContext, AbstractSingleBeanDefinitionParser} +import org.springframework.util.xml.DomUtils +import org.w3c.dom.Element + +import se.scalablesolutions.akka.spring.AkkaSpringConfigurationTags._ + + +/** + * Parser for <camel-service> elements. + * + * @author Martin Krasser + */ +class CamelServiceBeanDefinitionParser extends AbstractSingleBeanDefinitionParser { + /** + * Parses the <camel-service> element. If a nested <camel-context> element + * is defined then the referenced context is set on the {@link CamelServiceFactoryBean}. + */ + override def doParse(element: Element, parserContext: ParserContext, builder: BeanDefinitionBuilder) { + val camelContextElement = DomUtils.getChildElementByTagName(element, CAMEL_CONTEXT_TAG); + if (camelContextElement ne null) { + val camelContextReference = camelContextElement.getAttribute("ref") + builder.addPropertyReference("camelContext", camelContextReference) + } + } + + /** + * Returns the class of {@link CamelServiceFactoryBean} + */ + override def getBeanClass(element: Element): Class[_] = classOf[CamelServiceFactoryBean] + + /** + * Returns true. + */ + override def shouldGenerateIdAsFallback = true +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/CamelServiceFactoryBean.scala b/akka-spring/src/main/scala/CamelServiceFactoryBean.scala new file mode 100644 index 0000000000..040473951e --- /dev/null +++ b/akka-spring/src/main/scala/CamelServiceFactoryBean.scala @@ -0,0 +1,44 @@ +/** + * Copyright (C) 2009-2010 Scalable Solutions AB + */ +package se.scalablesolutions.akka.spring + +import org.apache.camel.CamelContext +import org.springframework.beans.factory.{DisposableBean, InitializingBean, FactoryBean} +import se.scalablesolutions.akka.camel.{CamelContextManager, CamelService} + +/** + * Factory bean for a {@link CamelService}. + * + * @author Martin Krasser + */ +class CamelServiceFactoryBean extends FactoryBean[CamelService] with InitializingBean with DisposableBean { + @scala.reflect.BeanProperty var camelContext: CamelContext = _ + + var instance: CamelService = _ + + def isSingleton = true + + def getObjectType = classOf[CamelService] + + def getObject = instance + + /** + * Initializes the {@link CamelContextManager} with camelService if defined, then + * creates and starts the {@link CamelService} singleton. + */ + def afterPropertiesSet = { + if (camelContext ne null) { + CamelContextManager.init(camelContext) + } + instance = CamelService.newInstance + instance.load + } + + /** + * Stops the {@link CamelService} singleton. + */ + def destroy = { + instance.unload + } +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/PropertyEntries.scala b/akka-spring/src/main/scala/PropertyEntries.scala new file mode 100644 index 0000000000..935baac4f4 --- /dev/null +++ b/akka-spring/src/main/scala/PropertyEntries.scala @@ -0,0 +1,18 @@ +package se.scalablesolutions.akka.spring + +import org.springframework.beans.factory.support.BeanDefinitionBuilder + +import scala.collection.mutable._ + +/** +* Simple container for Properties +* @author Johan Rask +*/ +class PropertyEntries { + + var entryList:ListBuffer[PropertyEntry] = ListBuffer[PropertyEntry]() + + def add(entry:PropertyEntry) = { + entryList.append(entry) + } +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/PropertyEntry.scala b/akka-spring/src/main/scala/PropertyEntry.scala new file mode 100644 index 0000000000..a01241635b --- /dev/null +++ b/akka-spring/src/main/scala/PropertyEntry.scala @@ -0,0 +1,17 @@ +package se.scalablesolutions.akka.spring + +/** +* Represents a property element +* @author Johan Rask +*/ +class PropertyEntry { + + var name:String = _ + var value:String = null + var ref:String = null + + + override def toString(): String = { + format("name = %s,value = %s, ref = %s", name,value,ref) + } +} \ No newline at end of file diff --git a/akka-spring/src/main/scala/SupervisionFactoryBean.scala b/akka-spring/src/main/scala/SupervisionFactoryBean.scala index d82d329f79..d8c44c3502 100644 --- a/akka-spring/src/main/scala/SupervisionFactoryBean.scala +++ b/akka-spring/src/main/scala/SupervisionFactoryBean.scala @@ -40,7 +40,7 @@ class SupervisionFactoryBean extends AbstractFactoryBean[ActiveObjectConfigurato */ private[akka] def createComponent(props: ActiveObjectProperties): Component = { import StringReflect._ - val lifeCycle = if (!props.lifecyclye.isEmpty && props.lifecyclye.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new LifeCycle(new Temporary()) else new LifeCycle(new Permanent()) + val lifeCycle = if (!props.lifecycle.isEmpty && props.lifecycle.equalsIgnoreCase(VAL_LIFECYCYLE_TEMPORARY)) new LifeCycle(new Temporary()) else new LifeCycle(new Permanent()) val isRemote = (props.host != null) && (!props.host.isEmpty) val withInterface = (props.interface != null) && (!props.interface.isEmpty) if (isRemote) { diff --git a/akka-spring/src/test/resources/appContext.xml b/akka-spring/src/test/resources/appContext.xml new file mode 100644 index 0000000000..3dc4d63794 --- /dev/null +++ b/akka-spring/src/test/resources/appContext.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/akka-spring/src/test/resources/failing-appContext.xml b/akka-spring/src/test/resources/failing-appContext.xml new file mode 100644 index 0000000000..3ea9f552e0 --- /dev/null +++ b/akka-spring/src/test/resources/failing-appContext.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/akka-spring/src/test/scala/ActiveObjectBeanDefinitionParserTest.scala b/akka-spring/src/test/scala/ActiveObjectBeanDefinitionParserTest.scala index e7ed68c379..23972e8f2e 100644 --- a/akka-spring/src/test/scala/ActiveObjectBeanDefinitionParserTest.scala +++ b/akka-spring/src/test/scala/ActiveObjectBeanDefinitionParserTest.scala @@ -25,13 +25,18 @@ class ActiveObjectBeanDefinitionParserTest extends Spec with ShouldMatchers { val xml = + transactional="true" + scope="prototype"> + + val props = parser.parseActiveObject(dom(xml).getDocumentElement); assert(props != null) - assert(props.timeout == 1000) - assert(props.target == "foo.bar.MyPojo") + assert(props.timeout === 1000) + assert(props.target === "foo.bar.MyPojo") assert(props.transactional) + assert(props.scope === "prototype") + assert(props.propertyEntries.entryList.size === 1) } it("should throw IllegalArgumentException on missing mandatory attributes") { @@ -50,7 +55,7 @@ class ActiveObjectBeanDefinitionParserTest extends Spec with ShouldMatchers { val props = parser.parseActiveObject(dom(xml).getDocumentElement); assert(props != null) assert(props.dispatcher.dispatcherType == "thread-based") - } +} it("should parse remote ActiveObjects configuration") { val xml =