You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/12/12 01:56:23 UTC

[GitHub] [dubbo-spi-extensions] AlbumenJ commented on a diff in pull request #182: Bugfix of retries and missing field

AlbumenJ commented on code in PR #182:
URL: https://github.com/apache/dubbo-spi-extensions/pull/182#discussion_r1045346547


##########
dubbo-cluster-extensions/dubbo-cluster-common/pom.xml:
##########
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"

Review Comment:
   Please add ASF license header for this file



##########
dubbo-cluster-extensions/dubbo-cluster-common/pom.xml:
##########
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0"
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
+    <parent>
+        <artifactId>dubbo-cluster-extensions</artifactId>
+        <groupId>org.apache.dubbo.extensions</groupId>
+        <version>${revision}</version>
+        <relativePath>../pom.xml</relativePath>
+    </parent>
+    <modelVersion>4.0.0</modelVersion>
+
+    <artifactId>dubbo-cluster-common</artifactId>

Review Comment:
   Would this module rename to `dubbo-cluster-sprcify-address-common` be better?



##########
dubbo-cluster-extensions/dubbo-cluster-specify-address-dubbo2/src/main/java/org/apache/dubbo/rpc/cluster/specifyaddress/AddressSpecifyClusterInterceptor.java:
##########
@@ -0,0 +1,32 @@
+package org.apache.dubbo.rpc.cluster.specifyaddress;

Review Comment:
   Please add asf license header



##########
dubbo-cluster-extensions/dubbo-cluster-specify-address-dubbo2/src/main/java/org/apache/dubbo/rpc/cluster/specifyaddress/Address.java:
##########
@@ -17,10 +17,15 @@
 package org.apache.dubbo.rpc.cluster.specifyaddress;
 
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.cluster.common.SpecifyAddress;
 
 import java.io.Serializable;
 import java.util.Objects;
 
+/**
+ * Use {@link SpecifyAddress} instead.
+ */
+@Deprecated
 public class Address implements Serializable {

Review Comment:
   extend `org.apache.dubbo.rpc.cluster.common.SpecifyAddress`



##########
dubbo-cluster-extensions/dubbo-cluster-specify-address-dubbo2/src/main/java/org/apache/dubbo/rpc/cluster/specifyaddress/Address.java:
##########
@@ -17,10 +17,15 @@
 package org.apache.dubbo.rpc.cluster.specifyaddress;
 
 import org.apache.dubbo.common.URL;
+import org.apache.dubbo.rpc.cluster.common.SpecifyAddress;
 
 import java.io.Serializable;
 import java.util.Objects;
 
+/**
+ * Use {@link SpecifyAddress} instead.
+ */
+@Deprecated
 public class Address implements Serializable {

Review Comment:
   Or move this class to common module without change its package



##########
dubbo-cluster-extensions/dubbo-cluster-specify-address-dubbo2/src/main/java/org/apache/dubbo/rpc/cluster/specifyaddress/AddressSpecifyClusterInterceptor.java:
##########
@@ -0,0 +1,32 @@
+package org.apache.dubbo.rpc.cluster.specifyaddress;
+
+import org.apache.dubbo.common.URL;
+import org.apache.dubbo.common.constants.CommonConstants;
+import org.apache.dubbo.common.extension.Activate;
+import org.apache.dubbo.rpc.Invocation;
+import org.apache.dubbo.rpc.RpcContext;
+import org.apache.dubbo.rpc.cluster.common.SpecifyAddress;
+import org.apache.dubbo.rpc.cluster.interceptor.ClusterInterceptor;
+import org.apache.dubbo.rpc.cluster.support.AbstractClusterInvoker;
+
+/**
+ * The SPECIFY ADDRESS field is handed over to the attachment by the thread
+ */
+@Activate(group = CommonConstants.CONSUMER)
+public class AddressSpecifyClusterInterceptor implements ClusterInterceptor {
+
+    @Override
+    public void before(AbstractClusterInvoker<?> clusterInvoker, Invocation invocation) {
+        SpecifyAddress<URL> current = UserSpecifiedAddressUtil.current();
+        if (current != null) {
+            invocation.setAttachment(SpecifyAddress.name, current);

Review Comment:
   set to attribute, not attachment



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org