File tree Expand file tree Collapse file tree 1 file changed +11
-0
lines changed
dubbo-config/dubbo-config-api/src/main/java/com/alibaba/dubbo/config Expand file tree Collapse file tree 1 file changed +11
-0
lines changed Original file line number Diff line number Diff line change 3636import com .alibaba .dubbo .rpc .cluster .Cluster ;
3737import com .alibaba .dubbo .rpc .support .MockInvoker ;
3838
39+ import static com .alibaba .dubbo .common .utils .NetUtils .isInvalidLocalHost ;
40+
3941import java .util .ArrayList ;
4042import java .util .HashMap ;
4143import java .util .List ;
@@ -225,7 +227,16 @@ protected URL loadMonitor(URL registryURL) {
225227 if (ConfigUtils .getPid () > 0 ) {
226228 map .put (Constants .PID_KEY , String .valueOf (ConfigUtils .getPid ()));
227229 }
230+ //set ip
231+ String hostToRegistry = ConfigUtils .getSystemProperty (Constants .DUBBO_IP_TO_REGISTRY );
232+ if (hostToRegistry == null || hostToRegistry .length () == 0 ) {
233+ hostToRegistry = NetUtils .getLocalHost ();
234+ } else if (isInvalidLocalHost (hostToRegistry )) {
235+ throw new IllegalArgumentException ("Specified invalid registry ip from property:" + Constants .DUBBO_IP_TO_REGISTRY + ", value:" + hostToRegistry );
236+ }
237+ map .put (Constants .REGISTER_IP_KEY , hostToRegistry );
228238 appendParameters (map , monitor );
239+ appendParameters (map , application );
229240 String address = monitor .getAddress ();
230241 String sysaddress = System .getProperty ("dubbo.monitor.address" );
231242 if (sysaddress != null && sysaddress .length () > 0 ) {
You can’t perform that action at this time.
0 commit comments