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

Introduce getConfig QoS Command #11664

Merged
merged 3 commits into from
Feb 27, 2023
Merged
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 @@ -539,10 +539,12 @@ protected void appendAnnotation(Class<?> annotationClass, Object annotation) {
* @see AbstractConfig#checkDefault()
* @see AbstractConfig#appendParameters(Map, Object, String)
*/
@Transient
public Map<String, String> getMetaData() {
return getMetaData(null);
}

@Transient
public Map<String, String> getMetaData(String prefix) {
Map<String, String> metaData = new HashMap<>();
appendAttributes(metaData, this, prefix);
Expand All @@ -569,6 +571,7 @@ private static boolean isWritableProperty(BeanInfo beanInfo, String key) {
}

@Parameter(excluded = true, attribute = false)
@Transient
public List<String> getPrefixes() {
List<String> prefixes = new ArrayList<>();
if (StringUtils.hasText(this.getId())) {
Expand All @@ -595,6 +598,7 @@ public static String getTypePrefix(Class<? extends AbstractConfig> cls) {
return CommonConstants.DUBBO + "." + getTagName(cls);
}

@Transient
public ConfigMode getConfigMode() {
return getApplicationModel().getApplicationConfigManager().getConfigMode();
}
Expand Down Expand Up @@ -1030,6 +1034,7 @@ public int hashCode() {
return hashCode;
}

@Transient
private List<Method> getAttributedMethods() {
Class<? extends AbstractConfig> cls = this.getClass();
return ConcurrentHashMapUtils.computeIfAbsent(attributedMethodCache, cls, (key) -> computeAttributedMethods());
Expand Down Expand Up @@ -1063,6 +1068,7 @@ protected List<Method> computeAttributedMethods() {
return methods;
}

@Transient
protected ConfigManager getConfigManager() {
return getApplicationModel().getApplicationConfigManager();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,6 @@
*/
package org.apache.dubbo.config;

import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.common.Version;
import org.apache.dubbo.common.config.ConfigurationUtils;
Expand All @@ -43,6 +34,16 @@
import org.apache.dubbo.rpc.model.ScopeModelUtil;
import org.apache.dubbo.rpc.model.ServiceMetadata;

import java.beans.Transient;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.stream.Collectors;

import static org.apache.dubbo.common.constants.CommonConstants.COMMA_SPLIT_PATTERN;
import static org.apache.dubbo.common.constants.CommonConstants.DUBBO_VERSION_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.INVOKER_LISTENER_KEY;
Expand Down Expand Up @@ -207,8 +208,9 @@ public AbstractInterfaceConfig(ModuleModel moduleModel) {
/**
* The url of the reference service
*/
protected final List<URL> urls = new ArrayList<URL>();
protected transient final List<URL> urls = new ArrayList<URL>();

@Transient
public List<URL> getExportedUrls() {
return urls;
}
Expand Down Expand Up @@ -903,6 +905,7 @@ public void setInterface(String interfaceName) {
this.interfaceName = interfaceName;
}

@Transient
public ClassLoader getInterfaceClassLoader() {
return interfaceClassLoader;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.dubbo.rpc.model.ModuleModel;
import org.apache.dubbo.rpc.model.ScopeModel;

import java.beans.Transient;
import java.util.Map;

/**
Expand Down Expand Up @@ -108,11 +109,13 @@ public AbstractMethodConfig(ModuleModel moduleModel) {
}

@Override
@Transient
public ModuleModel getScopeModel() {
return (ModuleModel) super.getScopeModel();
}

@Override
@Transient
protected ScopeModel getDefaultModel() {
return ApplicationModel.defaultModel().getDefaultModule();
}
Expand All @@ -127,6 +130,7 @@ protected void checkScopeModel(ScopeModel scopeModel) {
}
}

@Transient
protected ModuleConfigManager getModuleConfigManager() {
return getScopeModel().getConfigManager();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import org.apache.dubbo.config.support.Parameter;
import org.apache.dubbo.rpc.model.ModuleModel;

import java.beans.Transient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
Expand Down Expand Up @@ -371,6 +372,7 @@ public void setExecutor(Executor executor) {
}

@Parameter(key = SERVICE_EXECUTOR)
@Transient
public Executor getExecutor() {
return executor;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.apache.dubbo.rpc.service.GenericService;
import org.apache.dubbo.rpc.support.ProtocolUtils;

import java.beans.Transient;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
Expand Down Expand Up @@ -294,6 +295,7 @@ public void setUnloadClusterRelated(Boolean unloadClusterRelated) {
this.unloadClusterRelated = unloadClusterRelated;
}

@Transient
public ServiceMetadata getServiceMetadata() {
return serviceMetadata;
}
Expand Down Expand Up @@ -365,6 +367,7 @@ public Boolean shouldReferAsync() {
return shouldReferAsync;
}

@Transient
public abstract T get();

public void destroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import org.apache.dubbo.rpc.service.GenericService;
import org.apache.dubbo.rpc.support.ProtocolUtils;

import java.beans.Transient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
Expand Down Expand Up @@ -59,7 +60,7 @@ public abstract class ServiceConfigBase<T> extends AbstractServiceConfig {
/**
* The reference of the interface implementation
*/
protected T ref;
protected transient T ref;

/**
* The service name
Expand Down Expand Up @@ -296,6 +297,7 @@ public void setInterface(Class<?> interfaceClass) {
}
}

@Transient
public T getRef() {
return ref;
}
Expand Down Expand Up @@ -346,11 +348,13 @@ public void setGeneric(String generic) {
}
}

@Transient
public ServiceMetadata getServiceMetadata() {
return serviceMetadata;
}

@Override
@Transient
@Parameter(excluded = true, attribute = false)
public List<String> getPrefixes() {
List<String> prefixes = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import org.apache.dubbo.config.support.Parameter;
import org.apache.dubbo.rpc.model.ApplicationModel;

import java.beans.Transient;
import java.io.IOException;
import java.io.InputStream;

Expand Down Expand Up @@ -142,6 +143,7 @@ public void setClientTrustCertCollectionPath(String clientTrustCertCollectionPat
this.clientTrustCertCollectionPath = clientTrustCertCollectionPath;
}

@Transient
public InputStream getServerKeyCertChainPathStream() throws IOException {
if (serverKeyCertChainPath != null) {
serverKeyCertChainPathStream = IOUtils.getURL(serverKeyCertChainPath).openStream();
Expand All @@ -153,6 +155,7 @@ public void setServerKeyCertChainPathStream(InputStream serverKeyCertChainPathSt
this.serverKeyCertChainPathStream = serverKeyCertChainPathStream;
}

@Transient
public InputStream getServerPrivateKeyPathStream() throws IOException {
if (serverPrivateKeyPath != null) {
serverPrivateKeyPathStream = IOUtils.getURL(serverPrivateKeyPath).openStream();
Expand All @@ -164,6 +167,7 @@ public void setServerPrivateKeyPathStream(InputStream serverPrivateKeyPathStream
this.serverPrivateKeyPathStream = serverPrivateKeyPathStream;
}

@Transient
public InputStream getServerTrustCertCollectionPathStream() throws IOException {
if (serverTrustCertCollectionPath != null) {
serverTrustCertCollectionPathStream = IOUtils.getURL(serverTrustCertCollectionPath).openStream();
Expand All @@ -175,6 +179,7 @@ public void setServerTrustCertCollectionPathStream(InputStream serverTrustCertCo
this.serverTrustCertCollectionPathStream = serverTrustCertCollectionPathStream;
}

@Transient
public InputStream getClientKeyCertChainPathStream() throws IOException {
if (clientKeyCertChainPath != null) {
clientKeyCertChainPathStream = IOUtils.getURL(clientKeyCertChainPath).openStream();
Expand All @@ -186,6 +191,7 @@ public void setClientKeyCertChainPathStream(InputStream clientKeyCertChainPathSt
this.clientKeyCertChainPathStream = clientKeyCertChainPathStream;
}

@Transient
public InputStream getClientPrivateKeyPathStream() throws IOException {
if (clientPrivateKeyPath != null) {
clientPrivateKeyPathStream = IOUtils.getURL(clientPrivateKeyPath).openStream();
Expand All @@ -197,6 +203,7 @@ public void setClientPrivateKeyPathStream(InputStream clientPrivateKeyPathStream
this.clientPrivateKeyPathStream = clientPrivateKeyPathStream;
}

@Transient
public InputStream getClientTrustCertCollectionPathStream() throws IOException {
if (clientTrustCertCollectionPath != null) {
clientTrustCertCollectionPathStream = IOUtils.getURL(clientTrustCertCollectionPath).openStream();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,9 @@
*/
package org.apache.dubbo.config.nested;

public class AggregationConfig {
import java.io.Serializable;

public class AggregationConfig implements Serializable {

/**
* Enable local aggregation or not
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import org.apache.dubbo.config.support.Nested;

public class PrometheusConfig {
import java.io.Serializable;

public class PrometheusConfig implements Serializable {

/**
* Prometheus exporter configuration
Expand Down Expand Up @@ -48,7 +50,7 @@ public void setPushgateway(Pushgateway pushgateway) {
this.pushgateway = pushgateway;
}

public static class Exporter {
public static class Exporter implements Serializable {

/**
* Enable prometheus exporter
Expand Down Expand Up @@ -116,7 +118,7 @@ public void setMetricsPath(String metricsPath) {
}
}

public static class Pushgateway {
public static class Pushgateway implements Serializable {

/**
* Enable publishing via a Prometheus Pushgateway
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@
import org.apache.dubbo.rpc.stub.StubSuppliers;
import org.apache.dubbo.rpc.support.ProtocolUtils;

import java.beans.Transient;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Comparator;
Expand Down Expand Up @@ -217,6 +218,7 @@ public void setServices(String services) {
}

@Override
@Transient
public T get() {
if (destroyed) {
throw new IllegalStateException("The invoker of ReferenceConfig(" + url + ") has already destroyed!");
Expand Down Expand Up @@ -765,10 +767,12 @@ private void postProcessConfig() {
* @return
*/
@Deprecated
@Transient
public Invoker<?> getInvoker() {
return invoker;
}

@Transient
public Runnable getDestroyRunner() {
return this::destroy;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import org.apache.dubbo.rpc.model.ServiceDescriptor;
import org.apache.dubbo.rpc.service.GenericService;

import java.beans.Transient;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.Arrays;
Expand Down Expand Up @@ -927,6 +928,7 @@ private static void putRandomPort(String protocol, Integer port) {
}
}

@Transient
public Runnable getDestroyRunner() {
return this::unexport;
}
Expand Down
Loading