You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
36 lines
777 B
36 lines
777 B
package mxdx1;
|
|
|
|
import java.util.List;
|
|
|
|
//服务信息模型
|
|
public class ServiceInfo {
|
|
private String serviceName; // 服务名称
|
|
private String host; // 主机地址
|
|
private int port; // 端口号
|
|
|
|
// 构造方法、getter和setter
|
|
public ServiceInfo(String serviceName, String host, int port) {
|
|
this.serviceName = serviceName;
|
|
this.host = host;
|
|
this.port = port;
|
|
}
|
|
|
|
public String getHost() {
|
|
return host;
|
|
}
|
|
|
|
public int getPort() {
|
|
return port;
|
|
}
|
|
|
|
public String getServiceName() {
|
|
return serviceName;
|
|
}
|
|
|
|
// getter和setter省略...
|
|
}
|
|
|
|
//服务观察者接口(观察者模式)
|
|
public interface ServiceObserver {
|
|
void onServiceChanged(String serviceName, List<ServiceInfo> serviceInfos);
|
|
} |