You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ch...@apache.org on 2022/11/09 09:40:08 UTC

[flink] branch release-1.16 updated: [FLINK-29927][akka] Use singleton ExtensionId

This is an automated email from the ASF dual-hosted git repository.

chesnay pushed a commit to branch release-1.16
in repository https://gitbox.apache.org/repos/asf/flink.git


The following commit(s) were added to refs/heads/release-1.16 by this push:
     new 313e30483e9 [FLINK-29927][akka] Use singleton ExtensionId
313e30483e9 is described below

commit 313e30483e9770d18461b5dc655da423d465b7e3
Author: Chesnay Schepler <ch...@apache.org>
AuthorDate: Tue Nov 8 11:19:06 2022 +0100

    [FLINK-29927][akka] Use singleton ExtensionId
---
 .../src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java    | 2 +-
 .../org/apache/flink/runtime/rpc/akka/RemoteAddressExtension.java     | 4 ++++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java
index 5bcad68262d..65bf7a7f41b 100644
--- a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java
+++ b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/AkkaUtils.java
@@ -518,7 +518,7 @@ class AkkaUtils {
      * @return {@link Address} of the given {@link ActorSystem}
      */
     public static Address getAddress(ActorSystem system) {
-        return new RemoteAddressExtension().apply(system).getAddress();
+        return RemoteAddressExtension.INSTANCE.apply(system).getAddress();
     }
 
     /**
diff --git a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/RemoteAddressExtension.java b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/RemoteAddressExtension.java
index ce4947399c5..ff02d72d70c 100644
--- a/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/RemoteAddressExtension.java
+++ b/flink-rpc/flink-rpc-akka/src/main/java/org/apache/flink/runtime/rpc/akka/RemoteAddressExtension.java
@@ -29,6 +29,10 @@ import akka.actor.Extension;
 public class RemoteAddressExtension
         extends AbstractExtensionId<RemoteAddressExtension.RemoteAddressExtensionImpl> {
 
+    public static final RemoteAddressExtension INSTANCE = new RemoteAddressExtension();
+
+    private RemoteAddressExtension() {}
+
     @Override
     public RemoteAddressExtensionImpl createExtension(ExtendedActorSystem system) {
         return new RemoteAddressExtensionImpl(system);