// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/AbstractMonitor.java
// public abstract class AbstractMonitor {
// 
//     /**
//      * 返回remoteKey下所有节点数据，并监控变化
//      *
//      * @param monitor 消息listener
//      * @return 返回现在的数据
//      */
//     public abstract List<RegistryConfig> monitorRemoteKey(RegistryConfigListener monitor);
// 
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/RegistryConfig.java
// @Setter
// @Getter
// @Builder
// @EqualsAndHashCode(of = {"serverInfo", "appKey"}, callSuper = false)
// public class RegistryConfig extends AbstractConfig {
//     @Singular
//     private List<ServiceConfig> servers = Collections.emptyList();
//     private ThriftServerInfo serverInfo;
//     private String appKey;
//     private String registry;
//     private String hostName;
//     private int weight; //权重
// 
//     public RegistryConfig() {
//         super("registry");
//     }
// 
//     public RegistryConfig(List<ServiceConfig> servers, ThriftServerInfo serverInfo, String appKey, String registry, String hostName, int weight) {
//         this();
//         this.servers = servers;
//         this.serverInfo = serverInfo;
//         this.appKey = appKey;
//         this.registry = registry;
//         this.hostName = hostName;
//         this.weight = weight;
//     }
// 
//     public String toJsonString() {
//         this.servers.stream().forEach(AbstractConfig::fillId);
//         this.fillId();
//         return JsonUtils.toJson(this);
//     }
// 
//     public static RegistryConfig parse(String json) {
//         return JsonUtils.fromJson(json, RegistryConfig.class);
//     }
// 
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/ServiceConfig.java
// @Getter
// public class ServiceConfig extends AbstractConfig {
//     @NotBlank
//     private String service;
//     @Min(0)
//     @Max(100)
//     private int weight = -1;
//     @Min(0)
//     private int timeout = (int) TimeUnit.SECONDS.toMillis(3);
// 
//     private ServiceConfig() {
//         super("service");
//     }
// 
//     public ServiceConfig(String service, int weight) {
//         this();
//         this.service = service;
//         this.weight = weight;
//     }
// 
//     public ServiceConfig(String service, int weight, int timeout) {
//         this();
//         this.service = service;
//         this.weight = weight;
//         this.timeout = timeout;
//     }
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/ThriftServerInfo.java
// @Data
// @AllArgsConstructor
// @EqualsAndHashCode
// public class ThriftServerInfo {
//     private String ip;
//     private int port;
// 
//     public ThriftServerInfo(String ipPort) {
//         checkNotNull(ipPort);
//         String[] splits = ipPort.split(":");
//         checkArgument(splits.length == 2, "ipPort format error");
//         this.ip = splits[0];
//         this.port = NumberUtils.toInt(splits[1]);
//     }
// 
//     @Override
//     public String toString() {
//         return ip + ":" + port;
//     }
// 
//     public static ThriftServerInfo parse(String info) {
//         String[] splits = StringUtils.split(info, ":");
//         if (splits == null || splits.length != 2) {
//             return null;
//         }
//         return new ThriftServerInfo(splits[0], NumberUtils.toInt(splits[1]));
//     }
// }


import com.github.sofn.trpc.core.AbstractMonitor;
import com.github.sofn.trpc.core.config.RegistryConfig;
import com.github.sofn.trpc.core.config.ServiceConfig;
import com.github.sofn.trpc.core.config.ThriftServerInfo;
import java.util.List;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;
package com.github.sofn.trpc.core.monitor;




/**
 * Authors: sofn
 * Version: 1.0  Created at 2016-10-09 22:35.
 */
public class StaticMonitor extends AbstractMonitor {

    private List<ThriftServerInfo> servers;
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/AbstractMonitor.java
// public abstract class AbstractMonitor {
// 
//     /**
//      * 返回remoteKey下所有节点数据，并监控变化
//      *
//      * @param monitor 消息listener
//      * @return 返回现在的数据
//      */
//     public abstract List<RegistryConfig> monitorRemoteKey(RegistryConfigListener monitor);
// 
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/RegistryConfig.java
// @Setter
// @Getter
// @Builder
// @EqualsAndHashCode(of = {"serverInfo", "appKey"}, callSuper = false)
// public class RegistryConfig extends AbstractConfig {
//     @Singular
//     private List<ServiceConfig> servers = Collections.emptyList();
//     private ThriftServerInfo serverInfo;
//     private String appKey;
//     private String registry;
//     private String hostName;
//     private int weight; //权重
// 
//     public RegistryConfig() {
//         super("registry");
//     }
// 
//     public RegistryConfig(List<ServiceConfig> servers, ThriftServerInfo serverInfo, String appKey, String registry, String hostName, int weight) {
//         this();
//         this.servers = servers;
//         this.serverInfo = serverInfo;
//         this.appKey = appKey;
//         this.registry = registry;
//         this.hostName = hostName;
//         this.weight = weight;
//     }
// 
//     public String toJsonString() {
//         this.servers.stream().forEach(AbstractConfig::fillId);
//         this.fillId();
//         return JsonUtils.toJson(this);
//     }
// 
//     public static RegistryConfig parse(String json) {
//         return JsonUtils.fromJson(json, RegistryConfig.class);
//     }
// 
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/ServiceConfig.java
// @Getter
// public class ServiceConfig extends AbstractConfig {
//     @NotBlank
//     private String service;
//     @Min(0)
//     @Max(100)
//     private int weight = -1;
//     @Min(0)
//     private int timeout = (int) TimeUnit.SECONDS.toMillis(3);
// 
//     private ServiceConfig() {
//         super("service");
//     }
// 
//     public ServiceConfig(String service, int weight) {
//         this();
//         this.service = service;
//         this.weight = weight;
//     }
// 
//     public ServiceConfig(String service, int weight, int timeout) {
//         this();
//         this.service = service;
//         this.weight = weight;
//         this.timeout = timeout;
//     }
// }
// 
// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/config/ThriftServerInfo.java
// @Data
// @AllArgsConstructor
// @EqualsAndHashCode
// public class ThriftServerInfo {
//     private String ip;
//     private int port;
// 
//     public ThriftServerInfo(String ipPort) {
//         checkNotNull(ipPort);
//         String[] splits = ipPort.split(":");
//         checkArgument(splits.length == 2, "ipPort format error");
//         this.ip = splits[0];
//         this.port = NumberUtils.toInt(splits[1]);
//     }
// 
//     @Override
//     public String toString() {
//         return ip + ":" + port;
//     }
// 
//     public static ThriftServerInfo parse(String info) {
//         String[] splits = StringUtils.split(info, ":");
//         if (splits == null || splits.length != 2) {
//             return null;
//         }
//         return new ThriftServerInfo(splits[0], NumberUtils.toInt(splits[1]));
//     }
// }


// Path: trpc-core/src/main/java/com/github/sofn/trpc/core/monitor/StaticMonitor.java
import com.github.sofn.trpc.core.AbstractMonitor;
import com.github.sofn.trpc.core.config.RegistryConfig;
import com.github.sofn.trpc.core.config.ServiceConfig;
import com.github.sofn.trpc.core.config.ThriftServerInfo;
import java.util.List;
import java.util.stream.Collectors;
import static com.google.common.base.Preconditions.checkNotNull;

package com.github.sofn.trpc.core.monitor;




/**
 * Authors: sofn
 * Version: 1.0  Created at 2016-10-09 22:35.
 */
public class StaticMonitor extends AbstractMonitor {

    private List<ThriftServerInfo> servers;
    private List<String> services;