diff --git a/akka-actor/src/main/resources/reference.conf b/akka-actor/src/main/resources/reference.conf
index 194814a916..378e45e9b9 100644
--- a/akka-actor/src/main/resources/reference.conf
+++ b/akka-actor/src/main/resources/reference.conf
@@ -15,12 +15,12 @@ akka {
# Loggers to register at boot time (akka.event.Logging$DefaultLogger logs
# to STDOUT)
loggers = ["akka.event.Logging$DefaultLogger"]
-
- # Filter of log events that is used by the LoggingAdapter before
+
+ # Filter of log events that is used by the LoggingAdapter before
# publishing log events to the eventStream. It can perform
# fine grained filtering based on the log source. The default
# implementation filters on the `loglevel`.
- # FQCN of the LoggingFilter. The Class of the FQCN must implement
+ # FQCN of the LoggingFilter. The Class of the FQCN must implement
# akka.event.LoggingFilter and have a public constructor with
# (akka.actor.ActorSystem.Settings, akka.event.EventStream) parameters.
logging-filter = "akka.event.DefaultLoggingFilter"
@@ -109,6 +109,10 @@ akka {
# this is only intended for testing.
serialize-messages = off
+ # Additional serialization bindings which are enabled automatically when allow-java-serialization is disabled.
+ # settings are provided
+ java-serialization-disabled-additional-serialization-bindings = {}
+
# Serializes and deserializes creators (in Props) to ensure that they can be
# sent over the network, this is only intended for testing. Purely local deployments
# as marked with deploy.scope == LocalScope are exempt from verification.
@@ -123,7 +127,7 @@ akka {
# Default timeout for typed actor methods with non-void return type
timeout = 5s
}
-
+
# Mapping between ´deployment.router' short names to fully qualified class names
router.type-mapping {
from-code = "akka.routing.NoRouter"
@@ -147,7 +151,7 @@ akka {
# deployment id pattern - on the format: /parent/child etc.
default {
-
+
# The id of the dispatcher to use for this actor.
# If undefined or empty the dispatcher specified in code
# (Props.withDispatcher) is used, or default-dispatcher if not
@@ -204,9 +208,9 @@ akka {
# precedence over nr-of-instances
paths = []
}
-
+
# To use a dedicated dispatcher for the routees of the pool you can
- # define the dispatcher configuration inline with the property name
+ # define the dispatcher configuration inline with the property name
# 'pool-dispatcher' in the deployment section of the router.
# For example:
# pool-dispatcher {
@@ -217,7 +221,7 @@ akka {
# Routers with dynamically resizable number of routees; this feature is
# enabled by including (parts of) this section in the deployment
resizer {
-
+
enabled = off
# The fewest number of routees the router should ever have.
@@ -455,20 +459,20 @@ akka {
thread-pool-executor {
# Keep alive time for threads
keep-alive-time = 60s
-
+
# Define a fixed thread pool size with this property. The corePoolSize
# and the maximumPoolSize of the ThreadPoolExecutor will be set to this
# value, if it is defined. Then the other pool-size properties will not
- # be used.
- #
+ # be used.
+ #
# Valid values are: `off` or a positive integer.
fixed-pool-size = off
# Min number of threads to cap factor-based corePoolSize number to
core-pool-size-min = 8
- # The core-pool-size-factor is used to determine corePoolSize of the
- # ThreadPoolExecutor using the following formula:
+ # The core-pool-size-factor is used to determine corePoolSize of the
+ # ThreadPoolExecutor using the following formula:
# ceil(available processors * factor).
# Resulting size is then bounded by the core-pool-size-min and
# core-pool-size-max values.
@@ -480,7 +484,7 @@ akka {
# Minimum number of threads to cap factor-based maximumPoolSize number to
max-pool-size-min = 8
- # The max-pool-size-factor is used to determine maximumPoolSize of the
+ # The max-pool-size-factor is used to determine maximumPoolSize of the
# ThreadPoolExecutor using the following formula:
# ceil(available processors * factor)
# The maximumPoolSize will not be less than corePoolSize.
@@ -628,7 +632,7 @@ akka {
# com.typesafe.config.Config) parameters.
mailbox-type = "akka.dispatch.BoundedControlAwareMailbox"
}
-
+
# The LoggerMailbox will drain all messages in the mailbox
# when the system is shutdown and deliver them to the StandardOutLogger.
# Do not change this unless you know what you are doing.
@@ -661,28 +665,28 @@ akka {
# enable WARN logging of misconfigured routers
router-misconfiguration = off
}
-
- # SECURITY BEST-PRACTICE is to disable java serialization for its multiple
- # known attack surfaces.
- #
+
+ # SECURITY BEST-PRACTICE is to disable java serialization for its multiple
+ # known attack surfaces.
+ #
# This setting is a short-cut to
# - using DisabledJavaSerializer instead of JavaSerializer
# - enable-additional-serialization-bindings = on
#
- # Completely disable the use of `akka.serialization.JavaSerialization` by the
- # Akka Serialization extension, instead DisabledJavaSerializer will
+ # Completely disable the use of `akka.serialization.JavaSerialization` by the
+ # Akka Serialization extension, instead DisabledJavaSerializer will
# be inserted which will fail explicitly if attempts to use java serialization are made.
- #
- # The log messages emitted by such serializer SHOULD be treated as potential
- # attacks which the serializer prevented, as they MAY indicate an external operator
+ #
+ # The log messages emitted by such serializer SHOULD be treated as potential
+ # attacks which the serializer prevented, as they MAY indicate an external operator
# attempting to send malicious messages intending to use java serialization as attack vector.
# The attempts are logged with the SECURITY marker.
- #
+ #
# Please note that this option does not stop you from manually invoking java serialization
- #
+ #
# The default value for this might be changed to off in future versions of Akka.
allow-java-serialization = on
-
+
# Entries for pluggable serializers and their bindings.
serializers {
java = "akka.serialization.JavaSerializer"
@@ -700,18 +704,18 @@ akka {
"[B" = bytes
"java.io.Serializable" = java
}
-
- # Additional serialization-bindings that are replacing Java serialization are
- # defined in this section for backwards compatibility reasons. They are included
- # by default but can be excluded for backwards compatibility with Akka 2.4.x.
- # They can be disabled with enable-additional-serialization-bindings=off.
- #
- # This should only be needed for backwards compatibility reasons.
- enable-additional-serialization-bindings = on
-
+
# Additional serialization-bindings that are replacing Java serialization are
# defined in this section for backwards compatibility reasons. They are included
- # by default but can be excluded for backwards compatibility with Akka 2.4.x.
+ # by default but can be excluded for backwards compatibility with Akka 2.4.x.
+ # They can be disabled with enable-additional-serialization-bindings=off.
+ #
+ # This should only be needed for backwards compatibility reasons.
+ enable-additional-serialization-bindings = on
+
+ # Additional serialization-bindings that are replacing Java serialization are
+ # defined in this section for backwards compatibility reasons. They are included
+ # by default but can be excluded for backwards compatibility with Akka 2.4.x.
# They can be disabled with enable-additional-serialization-bindings=off.
additional-serialization-bindings {
}
@@ -838,7 +842,7 @@ akka {
# The maximum number of bytes delivered by a `Received` message. Before
# more data is read from the network the connection actor will try to
# do other work.
- # The purpose of this setting is to impose a smaller limit than the
+ # The purpose of this setting is to impose a smaller limit than the
# configured receive buffer size. When using value 'unlimited' it will
# try to read all from the receive buffer.
max-received-message-size = unlimited
@@ -980,7 +984,7 @@ akka {
# The maximal number of direct buffers kept in the direct buffer pool for
# reuse.
direct-buffer-pool-limit = 1000
-
+
# Enable fine grained logging of what goes on inside the implementation.
# Be aware that this may log more than once per message sent to the actors
# of the tcp implementation.
@@ -1036,31 +1040,31 @@ akka {
# - JVM shutdown hook will by default run CoordinatedShutdown
# - Cluster node will automatically run CoordinatedShutdown when it
# sees itself as Exiting
- # - A management console or other application specific command can
+ # - A management console or other application specific command can
# run CoordinatedShutdown
coordinated-shutdown {
- # The timeout that will be used for a phase if not specified with
+ # The timeout that will be used for a phase if not specified with
# 'timeout' in the phase
default-phase-timeout = 5 s
-
+
# Terminate the ActorSystem in the last phase actor-system-terminate.
terminate-actor-system = on
-
+
# Exit the JVM (System.exit(0)) in the last phase actor-system-terminate
- # if this is set to 'on'. It is done after termination of the
- # ActorSystem if terminate-actor-system=on, otherwise it is done
- # immediately when the last phase is reached.
+ # if this is set to 'on'. It is done after termination of the
+ # ActorSystem if terminate-actor-system=on, otherwise it is done
+ # immediately when the last phase is reached.
exit-jvm = off
-
+
# Run the coordinated shutdown when the JVM process exits, e.g.
# via kill SIGTERM signal (SIGINT ctrl-c doesn't work).
# This property is related to `akka.jvm-shutdown-hooks` above.
run-by-jvm-shutdown-hook = on
-
+
#//#coordinated-shutdown-phases
# CoordinatedShutdown will run the tasks that are added to these
- # phases. The phases can be ordered as a DAG by defining the
- # dependencies between the phases.
+ # phases. The phases can be ordered as a DAG by defining the
+ # dependencies between the phases.
# Each phase is defined as a named config section with the
# following optional properties:
# - timeout=15s: Override the default-phase-timeout for this phase.
@@ -1071,68 +1075,68 @@ akka {
# The first pre-defined phase that applications can add tasks to.
# Note that more phases can be added in the application's
- # configuration by overriding this phase with an additional
+ # configuration by overriding this phase with an additional
# depends-on.
before-service-unbind {
}
-
+
# Stop accepting new incoming requests in for example HTTP.
service-unbind {
depends-on = [before-service-unbind]
}
-
+
# Wait for requests that are in progress to be completed.
service-requests-done {
depends-on = [service-unbind]
}
-
+
# Final shutdown of service endpoints.
service-stop {
depends-on = [service-requests-done]
}
-
+
# Phase for custom application tasks that are to be run
# after service shutdown and before cluster shutdown.
before-cluster-shutdown {
depends-on = [service-stop]
}
-
+
# Graceful shutdown of the Cluster Sharding regions.
cluster-sharding-shutdown-region {
timeout = 10 s
depends-on = [before-cluster-shutdown]
}
-
+
# Emit the leave command for the node that is shutting down.
cluster-leave {
depends-on = [cluster-sharding-shutdown-region]
}
-
+
# Shutdown cluster singletons
cluster-exiting {
timeout = 10 s
depends-on = [cluster-leave]
}
-
+
# Wait until exiting has been completed
cluster-exiting-done {
depends-on = [cluster-exiting]
}
-
+
# Shutdown the cluster extension
cluster-shutdown {
depends-on = [cluster-exiting-done]
}
-
+
# Phase for custom application tasks that are to be run
# after cluster shutdown and before ActorSystem termination.
before-actor-system-terminate {
depends-on = [cluster-shutdown]
}
-
+
# Last phase. See terminate-actor-system and exit-jvm above.
- # Don't add phases that depends on this phase because the
- # dispatcher and scheduler of the ActorSystem have been shutdown.
+ # Don't add phases that depends on this phase because the
+ # dispatcher and scheduler of the ActorSystem have been shutdown.
actor-system-terminate {
timeout = 10 s
depends-on = [before-actor-system-terminate]
diff --git a/akka-actor/src/main/scala/akka/serialization/Serialization.scala b/akka-actor/src/main/scala/akka/serialization/Serialization.scala
index 39941d2521..072f923b78 100644
--- a/akka-actor/src/main/scala/akka/serialization/Serialization.scala
+++ b/akka-actor/src/main/scala/akka/serialization/Serialization.scala
@@ -41,14 +41,22 @@ object Serialization {
val Serializers: Map[String, String] = configToMap(config.getConfig("akka.actor.serializers"))
val SerializationBindings: Map[String, String] = {
val defaultBindings = config.getConfig("akka.actor.serialization-bindings")
- val bindings =
+ val bindings = {
if (config.getBoolean("akka.actor.enable-additional-serialization-bindings") ||
!config.getBoolean("akka.actor.allow-java-serialization") ||
config.hasPath("akka.remote.artery.enabled") && config.getBoolean("akka.remote.artery.enabled")) {
- defaultBindings.withFallback(config.getConfig("akka.actor.additional-serialization-bindings"))
+
+ val bs = defaultBindings.withFallback(config.getConfig("akka.actor.additional-serialization-bindings"))
+
+ // in addition to the additional settings, we also enable even more bindings if java serialization is disabled:
+ val additionalWhenJavaOffKey = "akka.actor.java-serialization-disabled-additional-serialization-bindings"
+ if (!config.getBoolean("akka.actor.allow-java-serialization")) {
+ bs.withFallback(config.getConfig(additionalWhenJavaOffKey))
+ } else bs
} else {
defaultBindings
}
+ }
configToMap(bindings)
}
diff --git a/akka-docs/src/main/paradox/serialization.md b/akka-docs/src/main/paradox/serialization.md
index f0ef696d44..7d289eafcb 100644
--- a/akka-docs/src/main/paradox/serialization.md
+++ b/akka-docs/src/main/paradox/serialization.md
@@ -2,7 +2,7 @@
The messages that Akka actors send to each other are JVM objects (e.g. instances of Scala case classes). Message passing between actors that live on the same JVM is straightforward. It is simply done via reference passing. However, messages that have to escape the JVM to reach an actor running on a different host have to undergo some form of serialization (i.e. the objects have to be converted to and from byte arrays).
-Akka itself uses Protocol Buffers to serialize internal messages (i.e. cluster gossip messages). However, the serialization mechanism in Akka allows you to write custom serializers and to define which serializer to use for what.
+Akka itself uses Protocol Buffers to serialize internal messages (i.e. cluster gossip messages). However, the serialization mechanism in Akka allows you to write custom serializers and to define which serializer to use for what.
## Usage
@@ -45,15 +45,23 @@ to disable a default serializer, see @ref:[Disabling the Java Serializer](remoti
### Enable additional bindings
-`akka.Done` is by default serialized by the Java serializer, add the following binding to avoid that.
-It's not enabled by default for compatibility reasons.
+A few types in Akka are, for backwards-compatibility reasons, still serialized by using Java serializer by default.
+You can switch them to using protocol buffers instead by adding the following bindings or set `akka.actor.allow-java-serialization=off`, which will make them serialized using protocol buffers instead.
+Refer to @ref[Rolling Upgrades](#rolling-upgrades) to understand how it is possible to turn and start using these new
+serializers in your clustered applications.
+
+You can enable them one by one adding by adding their bindings to the misc serializer, like this:
```
akka.actor.serialization-bindings {
- "akka.Done" = akka-misc
+ "akka.Done" = akka-misc
+ "akka.actor.Address" = akka-misc
+ "akka.remote.UniqueAddress" = akka-misc
}
```
+Alternatively, you can disable all Java serialization which then automatically will add the `java-serialization-disabled-additional-serialization-bindings` bindings to the active bindings.
+
### Verification
Normally, messages sent between local actors (i.e. same JVM) do not undergo serialization. For testing, sometimes, it may be desirable to force serialization on all messages (both remote and local). If you want to do this in order to verify that your messages are serializable you can enable the following config option:
@@ -83,7 +91,7 @@ Java
Scala
-: @@snip [SerializationDocSpec.scala]($code$/scala/docs/serialization/SerializationDocSpec.scala) { #programmatic }
+: @@snip [SerializationDocSpec.scala]($code$/scala/docs/serialization/SerializationDocSpec.scala) { #programmatic }
Java
: @@snip [SerializationDocTest.java]($code$/java/jdocs/serialization/SerializationDocTest.java) { #programmatic }
@@ -149,11 +157,11 @@ that should be serialized using it.
It's recommended to throw `java.io.NotSerializableException` in `fromBinary`
if the manifest is unknown. This makes it possible to introduce new message types and
-send them to nodes that don't know about them. This is typically needed when performing
+send them to nodes that don't know about them. This is typically needed when performing
rolling upgrades, i.e. running a cluster with mixed versions for while.
-`NotSerializableException` is treated as a transient problem in the TCP based remoting
+`NotSerializableException` is treated as a transient problem in the TCP based remoting
layer. The problem will be logged and message is dropped. Other exceptions will tear down
-the TCP connection because it can be an indication of corrupt bytes from the underlying
+the TCP connection because it can be an indication of corrupt bytes from the underlying
transport.
### Serializing ActorRefs
@@ -254,13 +262,13 @@ incompatibility as Java serialization does.
A serialized remote message (or persistent event) consists of serializer-id, the manifest, and the binary payload.
When deserializing it is only looking at the serializer-id to pick which `Serializer` to use for `fromBinary`.
-The message class (the bindings) is not used for deserialization. The manifest is only used within the
+The message class (the bindings) is not used for deserialization. The manifest is only used within the
`Serializer` to decide how to deserialize the payload, so one `Serializer` can handle many classes.
That means that it is possible to change serialization for a message by performing two rolling upgrade steps to
switch to the new serializer.
-1. Add the `Serializer` class and define it in `akka.actor.serializers` config section, but not in
+1. Add the `Serializer` class and define it in `akka.actor.serializers` config section, but not in
`akka.actor.serialization-bindings`. Perform a rolling upgrade for this change. This means that the
serializer class exists on all nodes and is registered, but it is still not used for serializing any
messages. That is important because during the rolling upgrade the old nodes still don't know about
@@ -273,7 +281,7 @@ switch to the new serializer.
messages and new nodes will be able to deserialize the old format.
As an optional third step the old serializer can be completely removed if it was not used for persistent events.
-It must still be possible to deserialize the events that were stored with the old serializer.
+It must still be possible to deserialize the events that were stored with the old serializer.
## External Akka Serializers
diff --git a/akka-remote/src/main/java/akka/remote/WireFormats.java b/akka-remote/src/main/java/akka/remote/WireFormats.java
index e46d0669a0..684f7fd039 100644
--- a/akka-remote/src/main/java/akka/remote/WireFormats.java
+++ b/akka-remote/src/main/java/akka/remote/WireFormats.java
@@ -7981,6 +7981,910 @@ public final class WireFormats {
// @@protoc_insertion_point(class_scope:DeployData)
}
+ public interface AddressDataOrBuilder
+ extends akka.protobuf.MessageOrBuilder {
+
+ // required string system = 1;
+ /**
+ * required string system = 1;
+ */
+ boolean hasSystem();
+ /**
+ * required string system = 1;
+ */
+ java.lang.String getSystem();
+ /**
+ * required string system = 1;
+ */
+ akka.protobuf.ByteString
+ getSystemBytes();
+
+ // required string hostname = 2;
+ /**
+ * required string hostname = 2;
+ */
+ boolean hasHostname();
+ /**
+ * required string hostname = 2;
+ */
+ java.lang.String getHostname();
+ /**
+ * required string hostname = 2;
+ */
+ akka.protobuf.ByteString
+ getHostnameBytes();
+
+ // required uint32 port = 3;
+ /**
+ * required uint32 port = 3;
+ */
+ boolean hasPort();
+ /**
+ * required uint32 port = 3;
+ */
+ int getPort();
+
+ // optional string protocol = 4;
+ /**
+ * optional string protocol = 4;
+ */
+ boolean hasProtocol();
+ /**
+ * optional string protocol = 4;
+ */
+ java.lang.String getProtocol();
+ /**
+ * optional string protocol = 4;
+ */
+ akka.protobuf.ByteString
+ getProtocolBytes();
+ }
+ /**
+ * Protobuf type {@code AddressData}
+ *
+ *
+ ** + * Defines a remote address, for classic remoting. + * + * Note that while the same message definition exists in cluster, as well as an updated one exists for Artery. + * This encoding will ONLY be used when an `akka.actor.Address` is attempted to be serialized *directly*. + *+ */ + public static final class AddressData extends + akka.protobuf.GeneratedMessage + implements AddressDataOrBuilder { + // Use AddressData.newBuilder() to construct. + private AddressData(akka.protobuf.GeneratedMessage.Builder> builder) { + super(builder); + this.unknownFields = builder.getUnknownFields(); + } + private AddressData(boolean noInit) { this.unknownFields = akka.protobuf.UnknownFieldSet.getDefaultInstance(); } + + private static final AddressData defaultInstance; + public static AddressData getDefaultInstance() { + return defaultInstance; + } + + public AddressData getDefaultInstanceForType() { + return defaultInstance; + } + + private final akka.protobuf.UnknownFieldSet unknownFields; + @java.lang.Override + public final akka.protobuf.UnknownFieldSet + getUnknownFields() { + return this.unknownFields; + } + private AddressData( + akka.protobuf.CodedInputStream input, + akka.protobuf.ExtensionRegistryLite extensionRegistry) + throws akka.protobuf.InvalidProtocolBufferException { + initFields(); + int mutable_bitField0_ = 0; + akka.protobuf.UnknownFieldSet.Builder unknownFields = + akka.protobuf.UnknownFieldSet.newBuilder(); + try { + boolean done = false; + while (!done) { + int tag = input.readTag(); + switch (tag) { + case 0: + done = true; + break; + default: { + if (!parseUnknownField(input, unknownFields, + extensionRegistry, tag)) { + done = true; + } + break; + } + case 10: { + bitField0_ |= 0x00000001; + system_ = input.readBytes(); + break; + } + case 18: { + bitField0_ |= 0x00000002; + hostname_ = input.readBytes(); + break; + } + case 24: { + bitField0_ |= 0x00000004; + port_ = input.readUInt32(); + break; + } + case 34: { + bitField0_ |= 0x00000008; + protocol_ = input.readBytes(); + break; + } + } + } + } catch (akka.protobuf.InvalidProtocolBufferException e) { + throw e.setUnfinishedMessage(this); + } catch (java.io.IOException e) { + throw new akka.protobuf.InvalidProtocolBufferException( + e.getMessage()).setUnfinishedMessage(this); + } finally { + this.unknownFields = unknownFields.build(); + makeExtensionsImmutable(); + } + } + public static final akka.protobuf.Descriptors.Descriptor + getDescriptor() { + return akka.remote.WireFormats.internal_static_AddressData_descriptor; + } + + protected akka.protobuf.GeneratedMessage.FieldAccessorTable + internalGetFieldAccessorTable() { + return akka.remote.WireFormats.internal_static_AddressData_fieldAccessorTable + .ensureFieldAccessorsInitialized( + akka.remote.WireFormats.AddressData.class, akka.remote.WireFormats.AddressData.Builder.class); + } + + public static akka.protobuf.Parser
required string system = 1;
+ */
+ public boolean hasSystem() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string system = 1;
+ */
+ public java.lang.String getSystem() {
+ java.lang.Object ref = system_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ akka.protobuf.ByteString bs =
+ (akka.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ system_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string system = 1;
+ */
+ public akka.protobuf.ByteString
+ getSystemBytes() {
+ java.lang.Object ref = system_;
+ if (ref instanceof java.lang.String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ system_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+
+ // required string hostname = 2;
+ public static final int HOSTNAME_FIELD_NUMBER = 2;
+ private java.lang.Object hostname_;
+ /**
+ * required string hostname = 2;
+ */
+ public boolean hasHostname() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public java.lang.String getHostname() {
+ java.lang.Object ref = hostname_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ akka.protobuf.ByteString bs =
+ (akka.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ hostname_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public akka.protobuf.ByteString
+ getHostnameBytes() {
+ java.lang.Object ref = hostname_;
+ if (ref instanceof java.lang.String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ hostname_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+
+ // required uint32 port = 3;
+ public static final int PORT_FIELD_NUMBER = 3;
+ private int port_;
+ /**
+ * required uint32 port = 3;
+ */
+ public boolean hasPort() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * required uint32 port = 3;
+ */
+ public int getPort() {
+ return port_;
+ }
+
+ // optional string protocol = 4;
+ public static final int PROTOCOL_FIELD_NUMBER = 4;
+ private java.lang.Object protocol_;
+ /**
+ * optional string protocol = 4;
+ */
+ public boolean hasProtocol() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public java.lang.String getProtocol() {
+ java.lang.Object ref = protocol_;
+ if (ref instanceof java.lang.String) {
+ return (java.lang.String) ref;
+ } else {
+ akka.protobuf.ByteString bs =
+ (akka.protobuf.ByteString) ref;
+ java.lang.String s = bs.toStringUtf8();
+ if (bs.isValidUtf8()) {
+ protocol_ = s;
+ }
+ return s;
+ }
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public akka.protobuf.ByteString
+ getProtocolBytes() {
+ java.lang.Object ref = protocol_;
+ if (ref instanceof java.lang.String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ protocol_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+
+ private void initFields() {
+ system_ = "";
+ hostname_ = "";
+ port_ = 0;
+ protocol_ = "";
+ }
+ private byte memoizedIsInitialized = -1;
+ public final boolean isInitialized() {
+ byte isInitialized = memoizedIsInitialized;
+ if (isInitialized != -1) return isInitialized == 1;
+
+ if (!hasSystem()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasHostname()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ if (!hasPort()) {
+ memoizedIsInitialized = 0;
+ return false;
+ }
+ memoizedIsInitialized = 1;
+ return true;
+ }
+
+ public void writeTo(akka.protobuf.CodedOutputStream output)
+ throws java.io.IOException {
+ getSerializedSize();
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ output.writeBytes(1, getSystemBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ output.writeBytes(2, getHostnameBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ output.writeUInt32(3, port_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ output.writeBytes(4, getProtocolBytes());
+ }
+ getUnknownFields().writeTo(output);
+ }
+
+ private int memoizedSerializedSize = -1;
+ public int getSerializedSize() {
+ int size = memoizedSerializedSize;
+ if (size != -1) return size;
+
+ size = 0;
+ if (((bitField0_ & 0x00000001) == 0x00000001)) {
+ size += akka.protobuf.CodedOutputStream
+ .computeBytesSize(1, getSystemBytes());
+ }
+ if (((bitField0_ & 0x00000002) == 0x00000002)) {
+ size += akka.protobuf.CodedOutputStream
+ .computeBytesSize(2, getHostnameBytes());
+ }
+ if (((bitField0_ & 0x00000004) == 0x00000004)) {
+ size += akka.protobuf.CodedOutputStream
+ .computeUInt32Size(3, port_);
+ }
+ if (((bitField0_ & 0x00000008) == 0x00000008)) {
+ size += akka.protobuf.CodedOutputStream
+ .computeBytesSize(4, getProtocolBytes());
+ }
+ size += getUnknownFields().getSerializedSize();
+ memoizedSerializedSize = size;
+ return size;
+ }
+
+ private static final long serialVersionUID = 0L;
+ @java.lang.Override
+ protected java.lang.Object writeReplace()
+ throws java.io.ObjectStreamException {
+ return super.writeReplace();
+ }
+
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ akka.protobuf.ByteString data)
+ throws akka.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ akka.protobuf.ByteString data,
+ akka.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws akka.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(byte[] data)
+ throws akka.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ byte[] data,
+ akka.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws akka.protobuf.InvalidProtocolBufferException {
+ return PARSER.parseFrom(data, extensionRegistry);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ java.io.InputStream input,
+ akka.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+ public static akka.remote.WireFormats.AddressData parseDelimitedFrom(java.io.InputStream input)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input);
+ }
+ public static akka.remote.WireFormats.AddressData parseDelimitedFrom(
+ java.io.InputStream input,
+ akka.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseDelimitedFrom(input, extensionRegistry);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ akka.protobuf.CodedInputStream input)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input);
+ }
+ public static akka.remote.WireFormats.AddressData parseFrom(
+ akka.protobuf.CodedInputStream input,
+ akka.protobuf.ExtensionRegistryLite extensionRegistry)
+ throws java.io.IOException {
+ return PARSER.parseFrom(input, extensionRegistry);
+ }
+
+ public static Builder newBuilder() { return Builder.create(); }
+ public Builder newBuilderForType() { return newBuilder(); }
+ public static Builder newBuilder(akka.remote.WireFormats.AddressData prototype) {
+ return newBuilder().mergeFrom(prototype);
+ }
+ public Builder toBuilder() { return newBuilder(this); }
+
+ @java.lang.Override
+ protected Builder newBuilderForType(
+ akka.protobuf.GeneratedMessage.BuilderParent parent) {
+ Builder builder = new Builder(parent);
+ return builder;
+ }
+ /**
+ * Protobuf type {@code AddressData}
+ *
+ * + ** + * Defines a remote address, for classic remoting. + * + * Note that while the same message definition exists in cluster, as well as an updated one exists for Artery. + * This encoding will ONLY be used when an `akka.actor.Address` is attempted to be serialized *directly*. + *+ */ + public static final class Builder extends + akka.protobuf.GeneratedMessage.Builder
required string system = 1;
+ */
+ public boolean hasSystem() {
+ return ((bitField0_ & 0x00000001) == 0x00000001);
+ }
+ /**
+ * required string system = 1;
+ */
+ public java.lang.String getSystem() {
+ java.lang.Object ref = system_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((akka.protobuf.ByteString) ref)
+ .toStringUtf8();
+ system_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string system = 1;
+ */
+ public akka.protobuf.ByteString
+ getSystemBytes() {
+ java.lang.Object ref = system_;
+ if (ref instanceof String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ system_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string system = 1;
+ */
+ public Builder setSystem(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ system_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string system = 1;
+ */
+ public Builder clearSystem() {
+ bitField0_ = (bitField0_ & ~0x00000001);
+ system_ = getDefaultInstance().getSystem();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string system = 1;
+ */
+ public Builder setSystemBytes(
+ akka.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000001;
+ system_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required string hostname = 2;
+ private java.lang.Object hostname_ = "";
+ /**
+ * required string hostname = 2;
+ */
+ public boolean hasHostname() {
+ return ((bitField0_ & 0x00000002) == 0x00000002);
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public java.lang.String getHostname() {
+ java.lang.Object ref = hostname_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((akka.protobuf.ByteString) ref)
+ .toStringUtf8();
+ hostname_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public akka.protobuf.ByteString
+ getHostnameBytes() {
+ java.lang.Object ref = hostname_;
+ if (ref instanceof String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ hostname_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public Builder setHostname(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ hostname_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public Builder clearHostname() {
+ bitField0_ = (bitField0_ & ~0x00000002);
+ hostname_ = getDefaultInstance().getHostname();
+ onChanged();
+ return this;
+ }
+ /**
+ * required string hostname = 2;
+ */
+ public Builder setHostnameBytes(
+ akka.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000002;
+ hostname_ = value;
+ onChanged();
+ return this;
+ }
+
+ // required uint32 port = 3;
+ private int port_ ;
+ /**
+ * required uint32 port = 3;
+ */
+ public boolean hasPort() {
+ return ((bitField0_ & 0x00000004) == 0x00000004);
+ }
+ /**
+ * required uint32 port = 3;
+ */
+ public int getPort() {
+ return port_;
+ }
+ /**
+ * required uint32 port = 3;
+ */
+ public Builder setPort(int value) {
+ bitField0_ |= 0x00000004;
+ port_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * required uint32 port = 3;
+ */
+ public Builder clearPort() {
+ bitField0_ = (bitField0_ & ~0x00000004);
+ port_ = 0;
+ onChanged();
+ return this;
+ }
+
+ // optional string protocol = 4;
+ private java.lang.Object protocol_ = "";
+ /**
+ * optional string protocol = 4;
+ */
+ public boolean hasProtocol() {
+ return ((bitField0_ & 0x00000008) == 0x00000008);
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public java.lang.String getProtocol() {
+ java.lang.Object ref = protocol_;
+ if (!(ref instanceof java.lang.String)) {
+ java.lang.String s = ((akka.protobuf.ByteString) ref)
+ .toStringUtf8();
+ protocol_ = s;
+ return s;
+ } else {
+ return (java.lang.String) ref;
+ }
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public akka.protobuf.ByteString
+ getProtocolBytes() {
+ java.lang.Object ref = protocol_;
+ if (ref instanceof String) {
+ akka.protobuf.ByteString b =
+ akka.protobuf.ByteString.copyFromUtf8(
+ (java.lang.String) ref);
+ protocol_ = b;
+ return b;
+ } else {
+ return (akka.protobuf.ByteString) ref;
+ }
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public Builder setProtocol(
+ java.lang.String value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000008;
+ protocol_ = value;
+ onChanged();
+ return this;
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public Builder clearProtocol() {
+ bitField0_ = (bitField0_ & ~0x00000008);
+ protocol_ = getDefaultInstance().getProtocol();
+ onChanged();
+ return this;
+ }
+ /**
+ * optional string protocol = 4;
+ */
+ public Builder setProtocolBytes(
+ akka.protobuf.ByteString value) {
+ if (value == null) {
+ throw new NullPointerException();
+ }
+ bitField0_ |= 0x00000008;
+ protocol_ = value;
+ onChanged();
+ return this;
+ }
+
+ // @@protoc_insertion_point(builder_scope:AddressData)
+ }
+
+ static {
+ defaultInstance = new AddressData(true);
+ defaultInstance.initFields();
+ }
+
+ // @@protoc_insertion_point(class_scope:AddressData)
+ }
+
public interface AkkaProtocolMessageOrBuilder
extends akka.protobuf.MessageOrBuilder {
@@ -9991,904 +10895,6 @@ public final class WireFormats {
// @@protoc_insertion_point(class_scope:AkkaHandshakeInfo)
}
- public interface AddressDataOrBuilder
- extends akka.protobuf.MessageOrBuilder {
-
- // required string system = 1;
- /**
- * required string system = 1;
- */
- boolean hasSystem();
- /**
- * required string system = 1;
- */
- java.lang.String getSystem();
- /**
- * required string system = 1;
- */
- akka.protobuf.ByteString
- getSystemBytes();
-
- // required string hostname = 2;
- /**
- * required string hostname = 2;
- */
- boolean hasHostname();
- /**
- * required string hostname = 2;
- */
- java.lang.String getHostname();
- /**
- * required string hostname = 2;
- */
- akka.protobuf.ByteString
- getHostnameBytes();
-
- // required uint32 port = 3;
- /**
- * required uint32 port = 3;
- */
- boolean hasPort();
- /**
- * required uint32 port = 3;
- */
- int getPort();
-
- // optional string protocol = 4;
- /**
- * optional string protocol = 4;
- */
- boolean hasProtocol();
- /**
- * optional string protocol = 4;
- */
- java.lang.String getProtocol();
- /**
- * optional string protocol = 4;
- */
- akka.protobuf.ByteString
- getProtocolBytes();
- }
- /**
- * Protobuf type {@code AddressData}
- *
- * - ** - * Defines a remote address. - *- */ - public static final class AddressData extends - akka.protobuf.GeneratedMessage - implements AddressDataOrBuilder { - // Use AddressData.newBuilder() to construct. - private AddressData(akka.protobuf.GeneratedMessage.Builder> builder) { - super(builder); - this.unknownFields = builder.getUnknownFields(); - } - private AddressData(boolean noInit) { this.unknownFields = akka.protobuf.UnknownFieldSet.getDefaultInstance(); } - - private static final AddressData defaultInstance; - public static AddressData getDefaultInstance() { - return defaultInstance; - } - - public AddressData getDefaultInstanceForType() { - return defaultInstance; - } - - private final akka.protobuf.UnknownFieldSet unknownFields; - @java.lang.Override - public final akka.protobuf.UnknownFieldSet - getUnknownFields() { - return this.unknownFields; - } - private AddressData( - akka.protobuf.CodedInputStream input, - akka.protobuf.ExtensionRegistryLite extensionRegistry) - throws akka.protobuf.InvalidProtocolBufferException { - initFields(); - int mutable_bitField0_ = 0; - akka.protobuf.UnknownFieldSet.Builder unknownFields = - akka.protobuf.UnknownFieldSet.newBuilder(); - try { - boolean done = false; - while (!done) { - int tag = input.readTag(); - switch (tag) { - case 0: - done = true; - break; - default: { - if (!parseUnknownField(input, unknownFields, - extensionRegistry, tag)) { - done = true; - } - break; - } - case 10: { - bitField0_ |= 0x00000001; - system_ = input.readBytes(); - break; - } - case 18: { - bitField0_ |= 0x00000002; - hostname_ = input.readBytes(); - break; - } - case 24: { - bitField0_ |= 0x00000004; - port_ = input.readUInt32(); - break; - } - case 34: { - bitField0_ |= 0x00000008; - protocol_ = input.readBytes(); - break; - } - } - } - } catch (akka.protobuf.InvalidProtocolBufferException e) { - throw e.setUnfinishedMessage(this); - } catch (java.io.IOException e) { - throw new akka.protobuf.InvalidProtocolBufferException( - e.getMessage()).setUnfinishedMessage(this); - } finally { - this.unknownFields = unknownFields.build(); - makeExtensionsImmutable(); - } - } - public static final akka.protobuf.Descriptors.Descriptor - getDescriptor() { - return akka.remote.WireFormats.internal_static_AddressData_descriptor; - } - - protected akka.protobuf.GeneratedMessage.FieldAccessorTable - internalGetFieldAccessorTable() { - return akka.remote.WireFormats.internal_static_AddressData_fieldAccessorTable - .ensureFieldAccessorsInitialized( - akka.remote.WireFormats.AddressData.class, akka.remote.WireFormats.AddressData.Builder.class); - } - - public static akka.protobuf.Parser
required string system = 1;
- */
- public boolean hasSystem() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * required string system = 1;
- */
- public java.lang.String getSystem() {
- java.lang.Object ref = system_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- akka.protobuf.ByteString bs =
- (akka.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- system_ = s;
- }
- return s;
- }
- }
- /**
- * required string system = 1;
- */
- public akka.protobuf.ByteString
- getSystemBytes() {
- java.lang.Object ref = system_;
- if (ref instanceof java.lang.String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- system_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
-
- // required string hostname = 2;
- public static final int HOSTNAME_FIELD_NUMBER = 2;
- private java.lang.Object hostname_;
- /**
- * required string hostname = 2;
- */
- public boolean hasHostname() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * required string hostname = 2;
- */
- public java.lang.String getHostname() {
- java.lang.Object ref = hostname_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- akka.protobuf.ByteString bs =
- (akka.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- hostname_ = s;
- }
- return s;
- }
- }
- /**
- * required string hostname = 2;
- */
- public akka.protobuf.ByteString
- getHostnameBytes() {
- java.lang.Object ref = hostname_;
- if (ref instanceof java.lang.String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- hostname_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
-
- // required uint32 port = 3;
- public static final int PORT_FIELD_NUMBER = 3;
- private int port_;
- /**
- * required uint32 port = 3;
- */
- public boolean hasPort() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * required uint32 port = 3;
- */
- public int getPort() {
- return port_;
- }
-
- // optional string protocol = 4;
- public static final int PROTOCOL_FIELD_NUMBER = 4;
- private java.lang.Object protocol_;
- /**
- * optional string protocol = 4;
- */
- public boolean hasProtocol() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * optional string protocol = 4;
- */
- public java.lang.String getProtocol() {
- java.lang.Object ref = protocol_;
- if (ref instanceof java.lang.String) {
- return (java.lang.String) ref;
- } else {
- akka.protobuf.ByteString bs =
- (akka.protobuf.ByteString) ref;
- java.lang.String s = bs.toStringUtf8();
- if (bs.isValidUtf8()) {
- protocol_ = s;
- }
- return s;
- }
- }
- /**
- * optional string protocol = 4;
- */
- public akka.protobuf.ByteString
- getProtocolBytes() {
- java.lang.Object ref = protocol_;
- if (ref instanceof java.lang.String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- protocol_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
-
- private void initFields() {
- system_ = "";
- hostname_ = "";
- port_ = 0;
- protocol_ = "";
- }
- private byte memoizedIsInitialized = -1;
- public final boolean isInitialized() {
- byte isInitialized = memoizedIsInitialized;
- if (isInitialized != -1) return isInitialized == 1;
-
- if (!hasSystem()) {
- memoizedIsInitialized = 0;
- return false;
- }
- if (!hasHostname()) {
- memoizedIsInitialized = 0;
- return false;
- }
- if (!hasPort()) {
- memoizedIsInitialized = 0;
- return false;
- }
- memoizedIsInitialized = 1;
- return true;
- }
-
- public void writeTo(akka.protobuf.CodedOutputStream output)
- throws java.io.IOException {
- getSerializedSize();
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- output.writeBytes(1, getSystemBytes());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- output.writeBytes(2, getHostnameBytes());
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- output.writeUInt32(3, port_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- output.writeBytes(4, getProtocolBytes());
- }
- getUnknownFields().writeTo(output);
- }
-
- private int memoizedSerializedSize = -1;
- public int getSerializedSize() {
- int size = memoizedSerializedSize;
- if (size != -1) return size;
-
- size = 0;
- if (((bitField0_ & 0x00000001) == 0x00000001)) {
- size += akka.protobuf.CodedOutputStream
- .computeBytesSize(1, getSystemBytes());
- }
- if (((bitField0_ & 0x00000002) == 0x00000002)) {
- size += akka.protobuf.CodedOutputStream
- .computeBytesSize(2, getHostnameBytes());
- }
- if (((bitField0_ & 0x00000004) == 0x00000004)) {
- size += akka.protobuf.CodedOutputStream
- .computeUInt32Size(3, port_);
- }
- if (((bitField0_ & 0x00000008) == 0x00000008)) {
- size += akka.protobuf.CodedOutputStream
- .computeBytesSize(4, getProtocolBytes());
- }
- size += getUnknownFields().getSerializedSize();
- memoizedSerializedSize = size;
- return size;
- }
-
- private static final long serialVersionUID = 0L;
- @java.lang.Override
- protected java.lang.Object writeReplace()
- throws java.io.ObjectStreamException {
- return super.writeReplace();
- }
-
- public static akka.remote.WireFormats.AddressData parseFrom(
- akka.protobuf.ByteString data)
- throws akka.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(
- akka.protobuf.ByteString data,
- akka.protobuf.ExtensionRegistryLite extensionRegistry)
- throws akka.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(byte[] data)
- throws akka.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(
- byte[] data,
- akka.protobuf.ExtensionRegistryLite extensionRegistry)
- throws akka.protobuf.InvalidProtocolBufferException {
- return PARSER.parseFrom(data, extensionRegistry);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(
- java.io.InputStream input,
- akka.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
- public static akka.remote.WireFormats.AddressData parseDelimitedFrom(java.io.InputStream input)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input);
- }
- public static akka.remote.WireFormats.AddressData parseDelimitedFrom(
- java.io.InputStream input,
- akka.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseDelimitedFrom(input, extensionRegistry);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(
- akka.protobuf.CodedInputStream input)
- throws java.io.IOException {
- return PARSER.parseFrom(input);
- }
- public static akka.remote.WireFormats.AddressData parseFrom(
- akka.protobuf.CodedInputStream input,
- akka.protobuf.ExtensionRegistryLite extensionRegistry)
- throws java.io.IOException {
- return PARSER.parseFrom(input, extensionRegistry);
- }
-
- public static Builder newBuilder() { return Builder.create(); }
- public Builder newBuilderForType() { return newBuilder(); }
- public static Builder newBuilder(akka.remote.WireFormats.AddressData prototype) {
- return newBuilder().mergeFrom(prototype);
- }
- public Builder toBuilder() { return newBuilder(this); }
-
- @java.lang.Override
- protected Builder newBuilderForType(
- akka.protobuf.GeneratedMessage.BuilderParent parent) {
- Builder builder = new Builder(parent);
- return builder;
- }
- /**
- * Protobuf type {@code AddressData}
- *
- * - ** - * Defines a remote address. - *- */ - public static final class Builder extends - akka.protobuf.GeneratedMessage.Builder
required string system = 1;
- */
- public boolean hasSystem() {
- return ((bitField0_ & 0x00000001) == 0x00000001);
- }
- /**
- * required string system = 1;
- */
- public java.lang.String getSystem() {
- java.lang.Object ref = system_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((akka.protobuf.ByteString) ref)
- .toStringUtf8();
- system_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * required string system = 1;
- */
- public akka.protobuf.ByteString
- getSystemBytes() {
- java.lang.Object ref = system_;
- if (ref instanceof String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- system_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
- /**
- * required string system = 1;
- */
- public Builder setSystem(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- system_ = value;
- onChanged();
- return this;
- }
- /**
- * required string system = 1;
- */
- public Builder clearSystem() {
- bitField0_ = (bitField0_ & ~0x00000001);
- system_ = getDefaultInstance().getSystem();
- onChanged();
- return this;
- }
- /**
- * required string system = 1;
- */
- public Builder setSystemBytes(
- akka.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000001;
- system_ = value;
- onChanged();
- return this;
- }
-
- // required string hostname = 2;
- private java.lang.Object hostname_ = "";
- /**
- * required string hostname = 2;
- */
- public boolean hasHostname() {
- return ((bitField0_ & 0x00000002) == 0x00000002);
- }
- /**
- * required string hostname = 2;
- */
- public java.lang.String getHostname() {
- java.lang.Object ref = hostname_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((akka.protobuf.ByteString) ref)
- .toStringUtf8();
- hostname_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * required string hostname = 2;
- */
- public akka.protobuf.ByteString
- getHostnameBytes() {
- java.lang.Object ref = hostname_;
- if (ref instanceof String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- hostname_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
- /**
- * required string hostname = 2;
- */
- public Builder setHostname(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000002;
- hostname_ = value;
- onChanged();
- return this;
- }
- /**
- * required string hostname = 2;
- */
- public Builder clearHostname() {
- bitField0_ = (bitField0_ & ~0x00000002);
- hostname_ = getDefaultInstance().getHostname();
- onChanged();
- return this;
- }
- /**
- * required string hostname = 2;
- */
- public Builder setHostnameBytes(
- akka.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000002;
- hostname_ = value;
- onChanged();
- return this;
- }
-
- // required uint32 port = 3;
- private int port_ ;
- /**
- * required uint32 port = 3;
- */
- public boolean hasPort() {
- return ((bitField0_ & 0x00000004) == 0x00000004);
- }
- /**
- * required uint32 port = 3;
- */
- public int getPort() {
- return port_;
- }
- /**
- * required uint32 port = 3;
- */
- public Builder setPort(int value) {
- bitField0_ |= 0x00000004;
- port_ = value;
- onChanged();
- return this;
- }
- /**
- * required uint32 port = 3;
- */
- public Builder clearPort() {
- bitField0_ = (bitField0_ & ~0x00000004);
- port_ = 0;
- onChanged();
- return this;
- }
-
- // optional string protocol = 4;
- private java.lang.Object protocol_ = "";
- /**
- * optional string protocol = 4;
- */
- public boolean hasProtocol() {
- return ((bitField0_ & 0x00000008) == 0x00000008);
- }
- /**
- * optional string protocol = 4;
- */
- public java.lang.String getProtocol() {
- java.lang.Object ref = protocol_;
- if (!(ref instanceof java.lang.String)) {
- java.lang.String s = ((akka.protobuf.ByteString) ref)
- .toStringUtf8();
- protocol_ = s;
- return s;
- } else {
- return (java.lang.String) ref;
- }
- }
- /**
- * optional string protocol = 4;
- */
- public akka.protobuf.ByteString
- getProtocolBytes() {
- java.lang.Object ref = protocol_;
- if (ref instanceof String) {
- akka.protobuf.ByteString b =
- akka.protobuf.ByteString.copyFromUtf8(
- (java.lang.String) ref);
- protocol_ = b;
- return b;
- } else {
- return (akka.protobuf.ByteString) ref;
- }
- }
- /**
- * optional string protocol = 4;
- */
- public Builder setProtocol(
- java.lang.String value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000008;
- protocol_ = value;
- onChanged();
- return this;
- }
- /**
- * optional string protocol = 4;
- */
- public Builder clearProtocol() {
- bitField0_ = (bitField0_ & ~0x00000008);
- protocol_ = getDefaultInstance().getProtocol();
- onChanged();
- return this;
- }
- /**
- * optional string protocol = 4;
- */
- public Builder setProtocolBytes(
- akka.protobuf.ByteString value) {
- if (value == null) {
- throw new NullPointerException();
- }
- bitField0_ |= 0x00000008;
- protocol_ = value;
- onChanged();
- return this;
- }
-
- // @@protoc_insertion_point(builder_scope:AddressData)
- }
-
- static {
- defaultInstance = new AddressData(true);
- defaultInstance.initFields();
- }
-
- // @@protoc_insertion_point(class_scope:AddressData)
- }
-
public interface FiniteDurationOrBuilder
extends akka.protobuf.MessageOrBuilder {
@@ -16987,6 +16993,11 @@ public final class WireFormats {
private static
akka.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_DeployData_fieldAccessorTable;
+ private static akka.protobuf.Descriptors.Descriptor
+ internal_static_AddressData_descriptor;
+ private static
+ akka.protobuf.GeneratedMessage.FieldAccessorTable
+ internal_static_AddressData_fieldAccessorTable;
private static akka.protobuf.Descriptors.Descriptor
internal_static_AkkaProtocolMessage_descriptor;
private static
@@ -17002,11 +17013,6 @@ public final class WireFormats {
private static
akka.protobuf.GeneratedMessage.FieldAccessorTable
internal_static_AkkaHandshakeInfo_fieldAccessorTable;
- private static akka.protobuf.Descriptors.Descriptor
- internal_static_AddressData_descriptor;
- private static
- akka.protobuf.GeneratedMessage.FieldAccessorTable
- internal_static_AddressData_fieldAccessorTable;
private static akka.protobuf.Descriptors.Descriptor
internal_static_FiniteDuration_descriptor;
private static
@@ -17080,15 +17086,15 @@ public final class WireFormats {
"(\005\022\025\n\rscopeManifest\030\007 \001(\t\022\032\n\022configSeria" +
"lizerId\030\010 \001(\005\022\026\n\016configManifest\030\t \001(\t\022 \n" +
"\030routerConfigSerializerId\030\n \001(\005\022\034\n\024route" +
- "rConfigManifest\030\013 \001(\t\"P\n\023AkkaProtocolMes" +
- "sage\022\017\n\007payload\030\001 \001(\014\022(\n\013instruction\030\002 \001" +
- "(\0132\023.AkkaControlMessage\"b\n\022AkkaControlMe" +
- "ssage\022!\n\013commandType\030\001 \002(\0162\014.CommandType" +
- "\022)\n\rhandshakeInfo\030\002 \001(\0132\022.AkkaHandshakeI" +
- "nfo\"N\n\021AkkaHandshakeInfo\022\034\n\006origin\030\001 \002(\013",
- "2\014.AddressData\022\013\n\003uid\030\002 \002(\006\022\016\n\006cookie\030\003 " +
- "\001(\t\"O\n\013AddressData\022\016\n\006system\030\001 \002(\t\022\020\n\010ho" +
- "stname\030\002 \002(\t\022\014\n\004port\030\003 \002(\r\022\020\n\010protocol\030\004" +
+ "rConfigManifest\030\013 \001(\t\"O\n\013AddressData\022\016\n\006" +
+ "system\030\001 \002(\t\022\020\n\010hostname\030\002 \002(\t\022\014\n\004port\030\003" +
+ " \002(\r\022\020\n\010protocol\030\004 \001(\t\"P\n\023AkkaProtocolMe" +
+ "ssage\022\017\n\007payload\030\001 \001(\014\022(\n\013instruction\030\002 " +
+ "\001(\0132\023.AkkaControlMessage\"b\n\022AkkaControlM" +
+ "essage\022!\n\013commandType\030\001 \002(\0162\014.CommandTyp",
+ "e\022)\n\rhandshakeInfo\030\002 \001(\0132\022.AkkaHandshake" +
+ "Info\"N\n\021AkkaHandshakeInfo\022\034\n\006origin\030\001 \002(" +
+ "\0132\014.AddressData\022\013\n\003uid\030\002 \002(\006\022\016\n\006cookie\030\003" +
" \001(\t\"8\n\016FiniteDuration\022\r\n\005value\030\001 \002(\003\022\027\n" +
"\004unit\030\002 \002(\0162\t.TimeUnit\")\n\013RemoteScope\022\032\n" +
"\004node\030\001 \002(\0132\014.AddressData\"\261\001\n\016DefaultRes" +
@@ -17169,30 +17175,30 @@ public final class WireFormats {
akka.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_DeployData_descriptor,
new java.lang.String[] { "Path", "Config", "RouterConfig", "Scope", "Dispatcher", "ScopeSerializerId", "ScopeManifest", "ConfigSerializerId", "ConfigManifest", "RouterConfigSerializerId", "RouterConfigManifest", });
- internal_static_AkkaProtocolMessage_descriptor =
+ internal_static_AddressData_descriptor =
getDescriptor().getMessageTypes().get(8);
+ internal_static_AddressData_fieldAccessorTable = new
+ akka.protobuf.GeneratedMessage.FieldAccessorTable(
+ internal_static_AddressData_descriptor,
+ new java.lang.String[] { "System", "Hostname", "Port", "Protocol", });
+ internal_static_AkkaProtocolMessage_descriptor =
+ getDescriptor().getMessageTypes().get(9);
internal_static_AkkaProtocolMessage_fieldAccessorTable = new
akka.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_AkkaProtocolMessage_descriptor,
new java.lang.String[] { "Payload", "Instruction", });
internal_static_AkkaControlMessage_descriptor =
- getDescriptor().getMessageTypes().get(9);
+ getDescriptor().getMessageTypes().get(10);
internal_static_AkkaControlMessage_fieldAccessorTable = new
akka.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_AkkaControlMessage_descriptor,
new java.lang.String[] { "CommandType", "HandshakeInfo", });
internal_static_AkkaHandshakeInfo_descriptor =
- getDescriptor().getMessageTypes().get(10);
+ getDescriptor().getMessageTypes().get(11);
internal_static_AkkaHandshakeInfo_fieldAccessorTable = new
akka.protobuf.GeneratedMessage.FieldAccessorTable(
internal_static_AkkaHandshakeInfo_descriptor,
new java.lang.String[] { "Origin", "Uid", "Cookie", });
- internal_static_AddressData_descriptor =
- getDescriptor().getMessageTypes().get(11);
- internal_static_AddressData_fieldAccessorTable = new
- akka.protobuf.GeneratedMessage.FieldAccessorTable(
- internal_static_AddressData_descriptor,
- new java.lang.String[] { "System", "Hostname", "Port", "Protocol", });
internal_static_FiniteDuration_descriptor =
getDescriptor().getMessageTypes().get(12);
internal_static_FiniteDuration_fieldAccessorTable = new
diff --git a/akka-remote/src/main/protobuf/WireFormats.proto b/akka-remote/src/main/protobuf/WireFormats.proto
index ea009f6d34..b38c6f307a 100644
--- a/akka-remote/src/main/protobuf/WireFormats.proto
+++ b/akka-remote/src/main/protobuf/WireFormats.proto
@@ -136,16 +136,6 @@ enum CommandType {
DISASSOCIATE_QUARANTINED = 5; // Remote system refused the association since the current system is quarantined
}
-/**
- * Defines a remote address.
- */
-message AddressData {
- required string system = 1;
- required string hostname = 2;
- required uint32 port = 3;
- optional string protocol = 4;
-}
-
/**
* java.util.concurrent.TimeUnit enum
*/
@@ -203,7 +193,17 @@ message TailChoppingPool {
required FiniteDuration interval = 3;
}
+/**
+ * Defines a remote address.
+ */
+message AddressData {
+ required string system = 1;
+ required string hostname = 2;
+ required uint32 port = 3;
+ optional string protocol = 4;
+}
+
message RemoteRouterConfig {
required Payload local = 1;
repeated AddressData nodes = 2;
-}
\ No newline at end of file
+}
diff --git a/akka-remote/src/main/resources/reference.conf b/akka-remote/src/main/resources/reference.conf
index 0576308d94..49f8ca27a6 100644
--- a/akka-remote/src/main/resources/reference.conf
+++ b/akka-remote/src/main/resources/reference.conf
@@ -47,19 +47,22 @@ akka {
# This com.google.protobuf serialization binding is only used if the class can be loaded,
# i.e. com.google.protobuf dependency has been added in the application project.
"com.google.protobuf.GeneratedMessage" = proto
-
+
"java.util.Optional" = akka-misc
- # akka.Done is handled by the MiscMessageSerializer, but it is not enabled for
- # compatibility reasons (it was added in Akka 2.5.8). Enable by adding
+
+ # The following are handled by the MiscMessageSerializer, but they are not enabled for
+ # compatibility reasons (it was added in Akka 2.5.[8,9]). Enable them by adding:
# akka.actor.serialization-bindings {
- # "akka.Done" = akka-misc
+ # "akka.Done" = akka-misc
+ # "akka.actor.Address" = akka-misc
+ # "akka.remote.UniqueAddress" = akka-misc
# }
}
# Additional serialization-bindings that are replacing Java serialization are
# defined in this section for backwards compatibility reasons. They are included
- # by default but can be excluded for backwards compatibility with Akka 2.4.x.
+ # by default but can be excluded for backwards compatibility with Akka 2.4.x.
# They can be disabled with enable-additional-serialization-bindings=off.
additional-serialization-bindings {
"akka.actor.Identify" = akka-misc
@@ -123,6 +126,13 @@ akka {
"akka.remote.routing.RemoteRouterConfig" = akka-misc
}
+ # Additional serialization bindings which are enabled automatically when allow-java-serialization is disabled.
+ java-serialization-disabled-additional-serialization-bindings = {
+ "akka.Done" = akka-misc
+ "akka.actor.Address" = akka-misc
+ "akka.remote.UniqueAddress" = akka-misc
+ }
+
serialization-identifiers {
"akka.remote.serialization.ProtobufSerializer" = 2
"akka.remote.serialization.DaemonMsgCreateSerializer" = 3
@@ -249,12 +259,12 @@ akka {
expected-response-after = 1 s
}
-
+
# remote deployment configuration section
deployment {
# If true, will only allow specific classes to be instanciated on this system via remote deployment
enable-whitelist = off
-
+
whitelist = []
}
#//#shared
@@ -299,7 +309,7 @@ akka {
# If the transport is akka.remote.netty.tcp or akka.remote.netty.ssl
# the configured connection-timeout for the transport will be used instead.
handshake-timeout = 15 s
-
+
### Security settings
# Enable untrusted mode for full security of server managed actors, prevents
@@ -815,7 +825,7 @@ akka {
buffer-pool-size = 128
# Maximum serialized message size for the large messages, including header data.
- # It is currently restricted to 1/8th the size of a term buffer that can be
+ # It is currently restricted to 1/8th the size of a term buffer that can be
# configured by setting the 'aeron.term.buffer.length' system property.
# See 'large-message-destinations'.
maximum-large-frame-size = 2 MiB
@@ -867,12 +877,12 @@ akka {
# Level 1 strongly prefer low CPU consumption over low latency.
# Level 10 strongly prefer low latency over low CPU consumption.
idle-cpu-level = 5
-
+
# Total number of inbound lanes, shared among all inbound associations. A value
# greater than 1 means that deserialization can be performed in parallel for
# different destination actors. The selection of lane is based on consistent
# hashing of the recipient ActorRef to preserve message ordering per receiver.
- # Lowest latency can be achieved with inbound-lanes=1 because of one less
+ # Lowest latency can be achieved with inbound-lanes=1 because of one less
# asynchronous boundary.
inbound-lanes = 4
@@ -995,7 +1005,7 @@ akka {
# interval between new table compression advertisements.
# this means the time during which we collect heavy-hitter data and then turn it into a compression table.
- advertisement-interval = 1 minute
+ advertisement-interval = 1 minute
}
manifests {
# Max number of compressed manifests
diff --git a/akka-remote/src/main/scala/akka/remote/serialization/MiscMessageSerializer.scala b/akka-remote/src/main/scala/akka/remote/serialization/MiscMessageSerializer.scala
index 652023706d..cc4645d836 100644
--- a/akka-remote/src/main/scala/akka/remote/serialization/MiscMessageSerializer.scala
+++ b/akka-remote/src/main/scala/akka/remote/serialization/MiscMessageSerializer.scala
@@ -11,8 +11,9 @@ import java.util.concurrent.TimeUnit
import akka.Done
import akka.actor._
import akka.dispatch.Dispatchers
+import akka.remote.WireFormats.AddressData
import akka.remote.routing.RemoteRouterConfig
-import akka.remote.{ ContainerFormats, RemoteScope, RemoteWatcher, WireFormats }
+import akka.remote._
import akka.routing._
import akka.serialization.{ BaseSerializer, Serialization, SerializationExtension, SerializerWithStringManifest }
import com.typesafe.config.{ Config, ConfigFactory, ConfigRenderOptions }
@@ -48,6 +49,8 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
case hbrsp: RemoteWatcher.HeartbeatRsp ⇒ serializeHeartbeatRsp(hbrsp)
case rs: RemoteScope ⇒ serializeRemoteScope(rs)
case LocalScope ⇒ ParameterlessSerializedMessage
+ case a: Address ⇒ serializeAddressData(a)
+ case u: UniqueAddress ⇒ serializeClassicUniqueAddress(u)
case c: Config ⇒ serializeConfig(c)
case dr: DefaultResizer ⇒ serializeDefaultResizer(dr)
case fc: FromConfig ⇒ serializeFromConfig(fc)
@@ -135,6 +138,35 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
c.root.render(ConfigRenderOptions.concise()).getBytes(StandardCharsets.UTF_8)
}
+ private def protoForAddressData(address: Address): AddressData.Builder =
+ address match {
+ case Address(protocol, actorSystem, Some(host), Some(port)) ⇒
+ WireFormats.AddressData.newBuilder()
+ .setSystem(actorSystem)
+ .setHostname(host)
+ .setPort(port)
+ .setProtocol(protocol)
+ case _ ⇒ throw new IllegalArgumentException(s"Address [$address] could not be serialized: host or port missing.")
+ }
+ private def protoForAddress(address: Address): ArteryControlFormats.Address.Builder =
+ address match {
+ case Address(protocol, actorSystem, Some(host), Some(port)) ⇒
+ ArteryControlFormats.Address.newBuilder()
+ .setSystem(actorSystem)
+ .setHostname(host)
+ .setPort(port)
+ .setProtocol(protocol)
+ case _ ⇒ throw new IllegalArgumentException(s"Address [$address] could not be serialized: host or port missing.")
+ }
+ private def serializeAddressData(address: Address): Array[Byte] =
+ protoForAddressData(address).build().toByteArray
+
+ private def serializeClassicUniqueAddress(uniqueAddress: UniqueAddress): Array[Byte] =
+ ArteryControlFormats.UniqueAddress.newBuilder()
+ .setUid(uniqueAddress.uid)
+ .setAddress(protoForAddress(uniqueAddress.address))
+ .build().toByteArray
+
private def serializeDefaultResizer(dr: DefaultResizer): Array[Byte] = {
val builder = WireFormats.DefaultResizer.newBuilder()
builder.setBackoffRate(dr.backoffRate)
@@ -256,6 +288,8 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
private val KillManifest = "K"
private val RemoteWatcherHBManifest = "RWHB"
private val DoneManifest = "DONE"
+ private val AddressManifest = "AD"
+ private val UniqueAddressManifest = "UD"
private val RemoteWatcherHBRespManifest = "RWHR"
private val ActorInitializationExceptionManifest = "AIEX"
private val LocalScopeManifest = "LS"
@@ -285,6 +319,8 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
KillManifest → ((_) ⇒ Kill),
RemoteWatcherHBManifest → ((_) ⇒ RemoteWatcher.Heartbeat),
DoneManifest → ((_) ⇒ Done),
+ AddressManifest → deserializeAddressData,
+ UniqueAddressManifest → deserializeUniqueAddress,
RemoteWatcherHBRespManifest → deserializeHeartbeatRsp,
ActorInitializationExceptionManifest → deserializeActorInitializationException,
LocalScopeManifest → ((_) ⇒ LocalScope),
@@ -316,6 +352,8 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
case Kill ⇒ KillManifest
case RemoteWatcher.Heartbeat ⇒ RemoteWatcherHBManifest
case Done ⇒ DoneManifest
+ case _: Address ⇒ AddressManifest
+ case _: UniqueAddress ⇒ UniqueAddressManifest
case _: RemoteWatcher.HeartbeatRsp ⇒ RemoteWatcherHBRespManifest
case LocalScope ⇒ LocalScopeManifest
case _: RemoteScope ⇒ RemoteScopeManifest
@@ -387,6 +425,36 @@ class MiscMessageSerializer(val system: ExtendedActorSystem) extends SerializerW
private def deserializeStatusFailure(bytes: Array[Byte]): Status.Failure =
Status.Failure(payloadSupport.deserializePayload(ContainerFormats.Payload.parseFrom(bytes)).asInstanceOf[Throwable])
+ private def deserializeAddressData(bytes: Array[Byte]): Address =
+ addressFromDataProto(WireFormats.AddressData.parseFrom(bytes))
+
+ private def addressFromDataProto(a: WireFormats.AddressData): Address = {
+ Address(
+ a.getProtocol,
+ a.getSystem,
+ // technicaly the presence of hostname and port are guaranteed, see our serializeAddressData
+ if (a.hasHostname) Some(a.getHostname) else None,
+ if (a.hasPort) Some(a.getPort) else None
+ )
+ }
+ private def addressFromProto(a: ArteryControlFormats.Address): Address = {
+ Address(
+ a.getProtocol,
+ a.getSystem,
+ // technicaly the presence of hostname and port are guaranteed, see our serializeAddressData
+ if (a.hasHostname) Some(a.getHostname) else None,
+ if (a.hasPort) Some(a.getPort) else None
+ )
+ }
+
+ private def deserializeUniqueAddress(bytes: Array[Byte]): UniqueAddress = {
+ val u = ArteryControlFormats.UniqueAddress.parseFrom(bytes)
+ UniqueAddress(
+ addressFromProto(u.getAddress),
+ u.getUid
+ )
+ }
+
private def deserializeHeartbeatRsp(bytes: Array[Byte]): RemoteWatcher.HeartbeatRsp = {
RemoteWatcher.HeartbeatRsp(ContainerFormats.WatcherHeartbeatResponse.parseFrom(bytes).getUid.toInt)
}
diff --git a/akka-remote/src/test/scala/akka/remote/serialization/MiscMessageSerializerSpec.scala b/akka-remote/src/test/scala/akka/remote/serialization/MiscMessageSerializerSpec.scala
index 40df5c14c8..5f7f8cdea2 100644
--- a/akka-remote/src/test/scala/akka/remote/serialization/MiscMessageSerializerSpec.scala
+++ b/akka-remote/src/test/scala/akka/remote/serialization/MiscMessageSerializerSpec.scala
@@ -5,7 +5,7 @@
package akka.remote.serialization
import akka.actor._
-import akka.remote.{ RemoteScope, RemoteWatcher }
+import akka.remote.{ RemoteScope, RemoteWatcher, UniqueAddress }
import akka.serialization.SerializationExtension
import akka.testkit.AkkaSpec
import com.typesafe.config.ConfigFactory
@@ -16,16 +16,15 @@ import java.util.Optional
import java.io.NotSerializableException
import akka.Done
+import akka.remote.ArteryControlFormats.UniqueAddress
import akka.remote.routing.RemoteRouterConfig
import akka.routing._
object MiscMessageSerializerSpec {
val serializationTestOverrides =
"""
- akka.actor.serialization-bindings {
- "akka.remote.serialization.MiscMessageSerializerSpec$TestException" = akka-misc
- # not enabled by default
- "akka.Done" = akka-misc
+ akka.actor {
+ serialization-bindings = { "akka.remote.serialization.MiscMessageSerializerSpec$TestException" = akka-misc } ${akka.actor.java-serialization-disabled-additional-serialization-bindings}
}
"""
@@ -89,6 +88,8 @@ class MiscMessageSerializerSpec extends AkkaSpec(MiscMessageSerializerSpec.testC
"RemoteWatcher.Heartbeat" → RemoteWatcher.Heartbeat,
"RemoteWatcher.HertbeatRsp" → RemoteWatcher.HeartbeatRsp(65537),
"Done" → Done,
+ "Address" → Address("akka", "system", "host", 1337),
+ "UniqueAddress" → akka.remote.UniqueAddress(Address("akka", "system", "host", 1337), 82751),
"LocalScope" → LocalScope,
"RemoteScope" → RemoteScope(Address("akka", "system", "localhost", 2525)),
"Config" → system.settings.config,