类 ServiceInstanceMetadataUtils
- java.lang.Object
-
- org.apache.dubbo.registry.client.metadata.ServiceInstanceMetadataUtils
-
public class ServiceInstanceMetadataUtils extends Object
The Utilities class for themetadata of the service instance- 从以下版本开始:
- 2.7.5
- 另请参阅:
StandardMetadataServiceURLBuilder,ServiceInstance.getMetadata(),MetadataService,URL
-
-
嵌套类概要
嵌套类 修饰符和类型 类 说明 static classServiceInstanceMetadataUtils.Endpoint
-
字段概要
字段 修饰符和类型 字段 说明 static StringENDPOINTSstatic StringEXPORTED_SERVICES_REVISION_PROPERTY_NAMEThe property name of The revision for all exported Dubbo services.static StringINSTANCE_REVISION_UPDATED_KEYstatic StringMETADATA_CLUSTER_PROPERTY_NAMEstatic StringMETADATA_SERVICE_PREFIXThe prefix ofMetadataService: "dubbo.metadata-service."static StringMETADATA_SERVICE_URL_PARAMS_PROPERTY_NAMEThe property name of metadata JSON ofMetadataService'sURLstatic StringMETADATA_SERVICE_URLS_PROPERTY_NAMETheURLsproperty name ofMetadataService: "dubbo.metadata-service.urls", which is used to be compatible with Dubbo Spring Cloud and discovery the metadata of instancestatic StringMETADATA_STORAGE_TYPE_PROPERTY_NAMEThe property name of metadata storage type.
-
构造器概要
构造器 构造器 说明 ServiceInstanceMetadataUtils()
-
方法概要
所有方法 静态方法 具体方法 修饰符和类型 方法 说明 static voidcalInstanceRevision(ServiceDiscovery serviceDiscovery, ServiceInstance instance)static StringgetExportedServicesRevision(ServiceInstance serviceInstance)The revision for all exported Dubbo services from the specifiedServiceInstance.static StringgetMetadataServiceParameter(List<URL> urls)static Map<String,String>getMetadataServiceURLParams(ServiceInstance serviceInstance, String protocol)Get theurl'sparameters ofMetadataService'sMetadatastatic Map<String,Map<String,String>>getMetadataServiceURLsParams(ServiceInstance serviceInstance)Get the multipleurls'parameters ofMetadataService'sMetadatastatic StringgetMetadataStorageType(URL registryURL)Get metadata's storage typestatic StringgetMetadataStorageType(ServiceInstance serviceInstance)Get the metadata's storage type is used to whichWritableMetadataServiceinstance.static IntegergetProtocolPort(ServiceInstance serviceInstance, String protocol)Get the property value of port by the specifiedthe metadata of service instanceand protocolstatic StringgetRemoteCluster(ServiceInstance serviceInstance)static booleanisDubboServiceInstance(ServiceInstance serviceInstance)Is Dubbo Service instance or notstatic booleanisInstanceUpdated(ServiceInstance instance)static voidrefreshMetadataAndInstance()static voidresetInstanceUpdateKey(ServiceInstance instance)static voidsetEndpoints(ServiceInstance serviceInstance, Map<String,Integer> protocolPorts)static voidsetMetadataStorageType(ServiceInstance serviceInstance, String metadataType)Set the metadata storage type in specifiedservice instance
-
-
-
字段详细资料
-
METADATA_SERVICE_PREFIX
public static final String METADATA_SERVICE_PREFIX
The prefix ofMetadataService: "dubbo.metadata-service."- 另请参阅:
- 常量字段值
-
METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME
public static String METADATA_SERVICE_URL_PARAMS_PROPERTY_NAME
The property name of metadata JSON ofMetadataService'sURL
-
METADATA_SERVICE_URLS_PROPERTY_NAME
public static final String METADATA_SERVICE_URLS_PROPERTY_NAME
TheURLsproperty name ofMetadataService: "dubbo.metadata-service.urls", which is used to be compatible with Dubbo Spring Cloud and discovery the metadata of instance- 另请参阅:
- 常量字段值
-
EXPORTED_SERVICES_REVISION_PROPERTY_NAME
public static String EXPORTED_SERVICES_REVISION_PROPERTY_NAME
The property name of The revision for all exported Dubbo services.
-
METADATA_STORAGE_TYPE_PROPERTY_NAME
public static String METADATA_STORAGE_TYPE_PROPERTY_NAME
The property name of metadata storage type.
-
METADATA_CLUSTER_PROPERTY_NAME
public static String METADATA_CLUSTER_PROPERTY_NAME
-
INSTANCE_REVISION_UPDATED_KEY
public static String INSTANCE_REVISION_UPDATED_KEY
-
-
方法详细资料
-
getMetadataServiceURLsParams
public static Map<String,Map<String,String>> getMetadataServiceURLsParams(ServiceInstance serviceInstance)
Get the multipleurls'parameters ofMetadataService'sMetadata- 参数:
serviceInstance- the instance ofServiceInstance- 返回:
- non-null
Map, the key isthe protocol of URL, the value isgetMetadataServiceURLParams(ServiceInstance, String)
-
getMetadataServiceURLParams
public static Map<String,String> getMetadataServiceURLParams(ServiceInstance serviceInstance, String protocol)
Get theurl'sparameters ofMetadataService'sMetadata- 参数:
serviceInstance- the instance ofServiceInstance- 返回:
- non-null
Map
-
getExportedServicesRevision
public static String getExportedServicesRevision(ServiceInstance serviceInstance)
The revision for all exported Dubbo services from the specifiedServiceInstance.- 参数:
serviceInstance- the specifiedServiceInstance- 返回:
nullif not exits
-
getMetadataStorageType
public static String getMetadataStorageType(URL registryURL)
Get metadata's storage type- 参数:
registryURL- theURLto connect the registry- 返回:
- if not found in
parametersofregistry URL, return
-
getMetadataStorageType
public static String getMetadataStorageType(ServiceInstance serviceInstance)
Get the metadata's storage type is used to whichWritableMetadataServiceinstance.- 参数:
serviceInstance- the specifiedServiceInstance- 返回:
- if not found in
metadataofServiceInstance, return
-
setMetadataStorageType
public static void setMetadataStorageType(ServiceInstance serviceInstance, String metadataType)
Set the metadata storage type in specifiedservice instance- 参数:
serviceInstance-service instancemetadataType- remote or local
-
getRemoteCluster
public static String getRemoteCluster(ServiceInstance serviceInstance)
-
isDubboServiceInstance
public static boolean isDubboServiceInstance(ServiceInstance serviceInstance)
Is Dubbo Service instance or not- 参数:
serviceInstance-service instance- 返回:
- if Dubbo Service instance, return
true, orfalse
-
setEndpoints
public static void setEndpoints(ServiceInstance serviceInstance, Map<String,Integer> protocolPorts)
-
getProtocolPort
public static Integer getProtocolPort(ServiceInstance serviceInstance, String protocol)
Get the property value of port by the specifiedthe metadata of service instanceand protocol- 参数:
serviceInstance-service instanceprotocol- the name of protocol, e.g, dubbo, rest, and so on- 返回:
- if not found, return
null
-
calInstanceRevision
public static void calInstanceRevision(ServiceDiscovery serviceDiscovery, ServiceInstance instance)
-
isInstanceUpdated
public static boolean isInstanceUpdated(ServiceInstance instance)
-
resetInstanceUpdateKey
public static void resetInstanceUpdateKey(ServiceInstance instance)
-
refreshMetadataAndInstance
public static void refreshMetadataAndInstance()
-
-