-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSentinelClusterConfigEntity.java
89 lines (72 loc) · 1.86 KB
/
SentinelClusterConfigEntity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
package com.sentinel.client.demo.config;
import com.alibaba.csp.sentinel.cluster.ClusterStateManager;
import com.alibaba.fastjson.annotation.JSONField;
import lombok.Data;
import java.util.Date;
import java.util.Objects;
import java.util.Set;
/**
* 集群机器配置
*/
@Data
public class SentinelClusterConfigEntity {
@Data
public static class Common {
private String ip;
private Integer port;
private Date gmtCreate;
}
@Data
public static class Mode extends Common {
/**
* 0-client
* 1-server
* -1 未指定
* {@link ClusterStateManager#CLUSTER_CLIENT}
*/
private Integer mode;
@JSONField(serialize = false)
public boolean isClientMode() {
return Objects.equals(this.mode, ClusterStateManager.CLUSTER_CLIENT);
}
@JSONField(serialize = false)
public boolean isServerMode() {
return Objects.equals(this.mode, ClusterStateManager.CLUSTER_SERVER);
}
}
@Data
public static class ClientConfig extends Common {
/**
* server的 ip
*/
private String serverHost;
/**
* server的 端口
*/
private Integer serverPort;
/**
* 请求超时时间 ms
*/
private Integer requestTimeout;
private Integer connectTimeout;
}
@Data
public static class ServerFlow extends Common {
/**
* 最大允许qps
*/
private Double maxAllowedQps;
}
@Data
public static class ServerTransport extends Common {
/**
* server的 端口
*/
private Integer serverPort;
private Integer idleSeconds;
}
@Data
public static class ServerNamespace extends Common {
private Set<String> namespaceSet;
}
}