package org.springframework.cloud.client
类型:interface
说明
代表服务发现系统中的一个实例.
Represents an instance of a service in a discovery system.
类图
ServiceInstance类图类图说明
ServiceInstance代表在服务发现系统中的一个实例.也就是说可以被ServiceInstanceChooser选择。
他也有一些子类。子类到时候再详细说明。
源码分析
/**
* Represents an instance of a service in a discovery system.
* @author Spencer Gibb
* @author Tim Ysewyn
*/
public interface ServiceInstance {
/**
* @return The unique instance ID as registered.
*/
default String getInstanceId() {
return null;
}
/**
* @return The service ID as registered.
*/
String getServiceId();
/**
* @return The hostname of the registered service instance.
*/
String getHost();
/**
* @return The port of the registered service instance.
*/
int getPort();
/**
* @return Whether the port of the registered service instance uses HTTPS.
*/
boolean isSecure();
/**
* @return The service URI address.
*/
URI getUri();
/**
* @return The key / value pair metadata associated with the service instance.
*/
Map<String, String> getMetadata();
/**
* @return The scheme of the service instance.
*/
default String getScheme() {
return null;
}
}
网友评论