Package org.apache.dubbo.registry.client
Class DefaultServiceInstance
java.lang.Object
org.apache.dubbo.registry.client.DefaultServiceInstance
- All Implemented Interfaces:
Serializable,ServiceInstance
The default implementation of
ServiceInstance.- Since:
- 2.7.5
- See Also:
-
Nested Class Summary
Nested Classes -
Constructor Summary
ConstructorsConstructorDescriptionDefaultServiceInstance(String serviceName, String host, Integer port, ApplicationModel applicationModel) DefaultServiceInstance(String serviceName, ApplicationModel applicationModel) -
Method Summary
Modifier and TypeMethodDescriptioncopyFrom(int port) copyFrom(DefaultServiceInstance.Endpoint endpoint) booleangetExtendParam(String key) getHost()The hostname of the registered service instance.The key / value pair metadata associated with the service instance.intgetPort()The port of the registered service instance.The name of service that current instance belongs to.inthashCode()booleanThe enabled status of the registered service instance.booleanThe registered service instance is health or not.putExtendParam(String key, String value) putExtendParamIfAbsent(String key, String value) removeExtendParam(String key) voidsetApplicationModel(ApplicationModel applicationModel) voidsetEnabled(boolean enabled) voidsetEndpoints(List<DefaultServiceInstance.Endpoint> endpoints) voidsetHealthy(boolean healthy) voidvoidsetMetadata(Map<String, String> metadata) voidsetPort(int port) voidsetRawAddress(String rawAddress) voidsetRegistryCluster(String registryCluster) voidsetServiceMetadata(MetadataInfo serviceMetadata) voidsetServiceName(String serviceName) toString()Methods inherited from interface org.apache.dubbo.registry.client.ServiceInstance
getMetadata, getMetadata, getOrDefaultApplicationModel
-
Constructor Details
-
DefaultServiceInstance
public DefaultServiceInstance() -
DefaultServiceInstance
-
DefaultServiceInstance
public DefaultServiceInstance(String serviceName, String host, Integer port, ApplicationModel applicationModel) -
DefaultServiceInstance
-
-
Method Details
-
setRawAddress
-
setServiceName
-
setHost
-
getServiceName
Description copied from interface:ServiceInstanceThe name of service that current instance belongs to.- Specified by:
getServiceNamein interfaceServiceInstance- Returns:
- non-null
-
getHost
Description copied from interface:ServiceInstanceThe hostname of the registered service instance.- Specified by:
getHostin interfaceServiceInstance- Returns:
- non-null
-
setPort
public void setPort(int port) -
getPort
public int getPort()Description copied from interface:ServiceInstanceThe port of the registered service instance.- Specified by:
getPortin interfaceServiceInstance- Returns:
- the positive integer if present
-
getAddress
- Specified by:
getAddressin interfaceServiceInstance
-
isEnabled
public boolean isEnabled()Description copied from interface:ServiceInstanceThe enabled status of the registered service instance.- Specified by:
isEnabledin interfaceServiceInstance- Returns:
- if
true, indicates current instance is enabled, or disable, the client should remove this one. The default value istrue
-
setEnabled
public void setEnabled(boolean enabled) -
isHealthy
public boolean isHealthy()Description copied from interface:ServiceInstanceThe registered service instance is health or not.- Specified by:
isHealthyin interfaceServiceInstance- Returns:
- if
true, indicates current instance is healthy, or unhealthy, the client may ignore this one. The default value istrue
-
setHealthy
public void setHealthy(boolean healthy) -
getMetadata
Description copied from interface:ServiceInstanceThe key / value pair metadata associated with the service instance.- Specified by:
getMetadatain interfaceServiceInstance- Returns:
- non-null, mutable and unsorted
Map
-
getSortedMetadata
- Specified by:
getSortedMetadatain interfaceServiceInstance
-
getRegistryCluster
- Specified by:
getRegistryClusterin interfaceServiceInstance
-
setRegistryCluster
- Specified by:
setRegistryClusterin interfaceServiceInstance
-
getExtendParams
- Specified by:
getExtendParamsin interfaceServiceInstance
-
getExtendParam
- Specified by:
getExtendParamin interfaceServiceInstance
-
putExtendParam
- Specified by:
putExtendParamin interfaceServiceInstance
-
putExtendParamIfAbsent
- Specified by:
putExtendParamIfAbsentin interfaceServiceInstance
-
removeExtendParam
- Specified by:
removeExtendParamin interfaceServiceInstance
-
setEndpoints
-
getEndpoints
-
copyFrom
-
copyFrom
-
getAllParams
- Specified by:
getAllParamsin interfaceServiceInstance
-
setApplicationModel
- Specified by:
setApplicationModelin interfaceServiceInstance
-
getApplicationModel
- Specified by:
getApplicationModelin interfaceServiceInstance
-
setMetadata
-
getServiceMetadata
- Specified by:
getServiceMetadatain interfaceServiceInstance
-
setServiceMetadata
- Specified by:
setServiceMetadatain interfaceServiceInstance
-
toURL
- Specified by:
toURLin interfaceServiceInstance
-
equals
-
hashCode
public int hashCode() -
toString
-
toFullString
-