File tree Expand file tree Collapse file tree
dubbo-common/src/main/java/org/apache/dubbo/common/constants
dubbo-rpc/dubbo-rpc-injvm/src
main/java/org/apache/dubbo/rpc/protocol/injvm
test/java/org/apache/dubbo/rpc/protocol/injvm Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -236,6 +236,11 @@ public interface CommonConstants {
236236 String PORT_KEY = "port" ;
237237 String DUBBO_IP_TO_BIND = "DUBBO_IP_TO_BIND" ;
238238
239+ /**
240+ * broadcast cluster.
241+ */
242+ String BROADCAST_CLUSTER = "broadcast" ;
243+
239244 /**
240245 * The property name for {@link NetworkInterface#getDisplayName() the name of network interface} that
241246 * the Dubbo application prefers
Original file line number Diff line number Diff line change 2929
3030import java .util .Map ;
3131
32+ import static org .apache .dubbo .common .constants .CommonConstants .BROADCAST_CLUSTER ;
33+ import static org .apache .dubbo .common .constants .CommonConstants .CLUSTER_KEY ;
3234import static org .apache .dubbo .rpc .Constants .SCOPE_KEY ;
3335import static org .apache .dubbo .rpc .Constants .SCOPE_LOCAL ;
3436import static org .apache .dubbo .rpc .Constants .SCOPE_REMOTE ;
@@ -111,6 +113,11 @@ public boolean isInjvmRefer(URL url) {
111113 // generic invocation is not local reference
112114 return false ;
113115 } else if (getExporter (exporterMap , url ) != null ) {
116+ // Broadcast cluster means that multiple machines will be called,
117+ // which is not converted to injvm protocol at this time.
118+ if (BROADCAST_CLUSTER .equalsIgnoreCase (url .getParameter (CLUSTER_KEY ))) {
119+ return false ;
120+ }
114121 // by default, go through local reference if there's the service exposed locally
115122 return true ;
116123 } else {
Original file line number Diff line number Diff line change @@ -119,6 +119,8 @@ public void testIsInjvmRefer() throws Exception {
119119 url = URL .valueOf ("fake://127.0.0.1/TestService" ).addParameter (GENERIC_KEY , true );
120120 assertFalse (InjvmProtocol .getInjvmProtocol ().isInjvmRefer (url ));
121121
122+ url = URL .valueOf ("fake://127.0.0.1/TestService" ).addParameter ("cluster" , "broadcast" );
123+ assertFalse (InjvmProtocol .getInjvmProtocol ().isInjvmRefer (url ));
122124 }
123125
124126
You can’t perform that action at this time.
0 commit comments