springcloud源码解析-ServiceInstance

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;
    }
}
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容