-
Notifications
You must be signed in to change notification settings - Fork 26.5k
Feat support check for config-center and metadata-center #15639
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.3
Are you sure you want to change the base?
Changes from 30 commits
7f027a8
2642ddb
3b84280
815f205
35b34fe
94633f0
8c4fa9d
e06c7d4
9f47eea
89aedba
add3b82
8323884
9cedd32
8d8dbb6
ed5f167
ccfc70c
d19100d
e0d360f
4d44b1f
fbea966
a6b75ef
5b8198e
62300ad
eb72841
6ecb905
34d9ca0
236240a
ad7909f
f53ad95
712763e
f5a0b31
4042caf
4cc8185
f758db1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,7 +26,6 @@ | |
| import org.apache.dubbo.common.logger.ErrorTypeAwareLogger; | ||
| import org.apache.dubbo.common.logger.LoggerFactory; | ||
| import org.apache.dubbo.common.threadpool.manager.ExecutorRepository; | ||
| import org.apache.dubbo.common.threadpool.manager.FrameworkExecutorRepository; | ||
| import org.apache.dubbo.common.url.component.ServiceConfigURL; | ||
| import org.apache.dubbo.common.utils.ClassUtils; | ||
| import org.apache.dubbo.common.utils.CollectionUtils; | ||
|
|
@@ -71,7 +70,6 @@ | |
| import java.util.UUID; | ||
| import java.util.concurrent.ConcurrentHashMap; | ||
| import java.util.concurrent.CopyOnWriteArrayList; | ||
| import java.util.concurrent.ScheduledExecutorService; | ||
| import java.util.concurrent.TimeUnit; | ||
| import java.util.concurrent.atomic.AtomicBoolean; | ||
|
|
||
|
|
@@ -400,11 +398,7 @@ protected void exported() { | |
| exportedURLs.forEach(url -> { | ||
| if (url.getParameter(SERVICE_NAME_MAPPING_KEY, false)) { | ||
| ServiceNameMapping serviceNameMapping = ServiceNameMapping.getDefaultExtension(getScopeModel()); | ||
| ScheduledExecutorService scheduledExecutor = getScopeModel() | ||
| .getBeanFactory() | ||
| .getBean(FrameworkExecutorRepository.class) | ||
| .getSharedScheduledExecutor(); | ||
| mapServiceName(url, serviceNameMapping, scheduledExecutor); | ||
| mapServiceName(url, serviceNameMapping); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why remove scheduledExecutor
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was move to a new class https://github.com/apache/dubbo/blob/eb728417846025108aa61fb7ae777018b9ea96af/dubbo-metadata/dubbo-metadata-api/src/main/java/org/apache/dubbo/metadata/report/MetadataReportRetryTask.java |
||
| } | ||
| }); | ||
|
|
||
|
|
@@ -423,49 +417,24 @@ public boolean hasRegistrySpecified() { | |
| .getRegistries()); | ||
| } | ||
|
|
||
| protected void mapServiceName( | ||
| URL url, ServiceNameMapping serviceNameMapping, ScheduledExecutorService scheduledExecutor) { | ||
| protected void mapServiceName(URL url, ServiceNameMapping serviceNameMapping) { | ||
| if (!exported) { | ||
| return; | ||
| } | ||
| logger.info("[INSTANCE_REGISTER] [METADATA_REGISTER] Try to register interface application mapping for service " | ||
| + url.getServiceKey()); | ||
| boolean succeeded = false; | ||
| try { | ||
| succeeded = serviceNameMapping.map(url); | ||
| if (succeeded) { | ||
| logger.info( | ||
| "[INSTANCE_REGISTER][METADATA_REGISTER] Successfully registered interface application mapping for service " | ||
| + url.getServiceKey()); | ||
| } else { | ||
| logger.error( | ||
| CONFIG_SERVER_DISCONNECTED, | ||
| "configuration server disconnected", | ||
| "", | ||
| "[INSTANCE_REGISTER] [METADATA_REGISTER] Failed register interface application mapping for service " | ||
| + url.getServiceKey()); | ||
| } | ||
| } catch (Exception e) { | ||
| if (serviceNameMapping.map(url)) { | ||
| logger.info( | ||
| "[INSTANCE_REGISTER][METADATA_REGISTER] Successfully registered interface application mapping for service " | ||
| + url.getServiceKey()); | ||
| } else { | ||
| logger.error( | ||
| CONFIG_SERVER_DISCONNECTED, | ||
| "configuration server disconnected", | ||
| "", | ||
| "[INSTANCE_REGISTER] [METADATA_REGISTER] Failed register interface application mapping for service " | ||
| + url.getServiceKey(), | ||
| e); | ||
| + url.getServiceKey()); | ||
| } | ||
| if (!succeeded && serviceNameMapping.hasValidMetadataCenter()) { | ||
| scheduleToMapping(scheduledExecutor, serviceNameMapping, url); | ||
| } | ||
| } | ||
|
|
||
| private void scheduleToMapping( | ||
| ScheduledExecutorService scheduledExecutor, ServiceNameMapping serviceNameMapping, URL url) { | ||
| Integer mappingRetryInterval = getApplication().getMappingRetryInterval(); | ||
| scheduledExecutor.schedule( | ||
| () -> mapServiceName(url, serviceNameMapping, scheduledExecutor), | ||
| mappingRetryInterval == null ? 5000 : mappingRetryInterval, | ||
| TimeUnit.MILLISECONDS); | ||
| } | ||
|
|
||
| private void checkAndUpdateSubConfigs() { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why check url.getPort() != 0?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It just kept the original logic, maybe it can be removed.