This is an automated email from the ASF dual-hosted git repository.
liujun pushed a commit to branch 3.0
in repository https://gitbox.apache.org/repos/asf/dubbo.git
The following commit(s) were added to refs/heads/3.0 by this push:
new b2d308a enhance logs (#9214)
b2d308a is described below
commit b2d308a671251c775f06833d44f8cb1ed41513bf
Author: ken.lj <[email protected]>
AuthorDate: Fri Nov 5 16:17:38 2021 +0800
enhance logs (#9214)
---
.../migration/DefaultMigrationAddressComparator.java | 20 ++++++++++++++------
1 file changed, 14 insertions(+), 6 deletions(-)
diff --git
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
index 9daf71d..40a5d78 100644
---
a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
+++
b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
@@ -47,13 +47,13 @@ public class DefaultMigrationAddressComparator implements
MigrationAddressCompar
if (!newInvoker.hasProxyInvokers()) {
migrationData.put(OLD_ADDRESS_SIZE, getAddressSize(oldInvoker));
migrationData.put(NEW_ADDRESS_SIZE, -1);
- logger.info("No instance address available, stop compare.");
+ logger.info("No " + getInvokerType(newInvoker) + " address
available, stop compare.");
return false;
}
if (!oldInvoker.hasProxyInvokers()) {
migrationData.put(OLD_ADDRESS_SIZE, -1);
migrationData.put(NEW_ADDRESS_SIZE, getAddressSize(newInvoker));
- logger.info("No interface address available, stop compare.");
+ logger.info("No " + getInvokerType(oldInvoker) + " address
available, stop compare.");
return true;
}
@@ -64,11 +64,11 @@ public class DefaultMigrationAddressComparator implements
MigrationAddressCompar
migrationData.put(NEW_ADDRESS_SIZE, newAddressSize);
String rawThreshold = null;
- Float configuredThreshold = rule == null ? null :
rule.getThreshold(oldInvoker.getUrl());
- if (configuredThreshold != null && configuredThreshold >= 0) {
- rawThreshold = String.valueOf(configuredThreshold);
+ Float configedThreshold = rule == null ? null :
rule.getThreshold(oldInvoker.getUrl());
+ if (configedThreshold != null && configedThreshold >= 0) {
+ rawThreshold = String.valueOf(configedThreshold);
}
- rawThreshold = StringUtils.isNotEmpty(rawThreshold) ? rawThreshold :
ConfigurationUtils.getCachedDynamicProperty(newInvoker.getUrl().getScopeModel(),
MIGRATION_THRESHOLD, DEFAULT_THRESHOLD_STRING);
+ rawThreshold = StringUtils.isNotEmpty(rawThreshold) ? rawThreshold :
ConfigurationUtils.getCachedDynamicProperty(MIGRATION_THRESHOLD,
DEFAULT_THRESHOLD_STRING);
float threshold;
try {
threshold = Float.parseFloat(rawThreshold);
@@ -104,4 +104,12 @@ public class DefaultMigrationAddressComparator implements
MigrationAddressCompar
return serviceMigrationData.get(displayServiceKey);
}
+ private String getInvokerType(ClusterInvoker<?> invoker) {
+ if (invoker.isServiceDiscovery()) {
+ return "instance";
+ }
+ return "interface";
+ }
+
+
}