Skip to content
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

Read remote metadata once during application runtime #15006

Open
wants to merge 1 commit into
base: 3.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ public class MetadataInfo implements Serializable {
private transient ConcurrentNavigableMap<String, SortedSet<URL>> subscribedServiceURLs;
private transient ConcurrentNavigableMap<String, SortedSet<URL>> exportedServiceURLs;
private transient ExtensionLoader<MetadataParamsFilter> loader;
private transient volatile boolean remoteLoaded = false;

public MetadataInfo() {
this(null);
Expand Down Expand Up @@ -488,6 +489,14 @@ private Object readResolve() {
return new MetadataInfo(this.app, this.revision, this.services);
}

public boolean isRemoteLoaded() {
return remoteLoaded;
}

public void setRemoteLoaded(boolean remoteLoaded) {
this.remoteLoaded = remoteLoaded;
}

public static class ServiceInfo implements Serializable {
private String name;
private String group;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public MetadataInfo getLocalMetadata(String revision) {
public MetadataInfo getRemoteMetadata(String revision, List<ServiceInstance> instances) {
MetadataInfo metadata = metaCacheManager.get(revision);

if (metadata != null && metadata != MetadataInfo.EMPTY) {
if (metadata != null && metadata != MetadataInfo.EMPTY && metadata.isRemoteLoaded()) {
metadata.init();
// metadata loaded from cache
if (logger.isDebugEnabled()) {
Expand Down Expand Up @@ -279,6 +279,7 @@ public MetadataInfo getRemoteMetadata(String revision, List<ServiceInstance> ins
"Failed to get metadata for revision after 3 retries, revision=" + revision);
} else {
metaCacheManager.put(revision, metadata);
metadata.setRemoteLoaded(true);
}
}
return metadata;
Expand Down
Loading