6 package com.vesoft.nebula.client.graph;
8 import com.vesoft.nebula.client.graph.data.HostAddress;
9 import com.vesoft.nebula.client.graph.data.SSLParam;
10 import java.io.Serializable;
11 import java.util.HashMap;
12 import java.util.List;
17 private static final long serialVersionUID = -2266013330384849132L;
19 private final List<HostAddress> graphAddressList;
21 private final String username;
22 private final String password;
23 private final String spaceName;
26 private int minSessionSize = 1;
29 private int maxSessionSize = 10;
32 private int timeout = 0;
36 private int cleanTime = 3600;
39 private int healthCheckTime = 600;
42 private int retryConnectTimes = 1;
45 private int waitTime = 0;
48 private int retryTimes = 3;
51 private int intervalTime = 0;
54 private boolean reconnect =
false;
57 private boolean enableSsl =
false;
62 private boolean useHttp2 =
false;
64 private Map<String, String> customHeaders =
new HashMap<>();
71 if (addresses ==
null || addresses.size() == 0) {
72 throw new IllegalArgumentException(
"Graph addresses cannot be empty.");
74 if (spaceName ==
null || spaceName.trim().isEmpty()) {
75 throw new IllegalArgumentException(
"space name cannot be blank.");
77 if (username ==
null || username.trim().isEmpty()) {
78 throw new IllegalArgumentException(
"user name cannot be blank.");
80 if (password ==
null || password.trim().isEmpty()) {
81 throw new IllegalArgumentException(
"password cannot be blank.");
84 this.graphAddressList = addresses;
85 this.spaceName = spaceName;
86 this.username = username;
87 this.password = password;
90 public String getUsername() {
94 public String getPassword() {
98 public List<HostAddress> getGraphAddressList() {
99 return graphAddressList;
102 public String getSpaceName() {
106 public int getMinSessionSize() {
107 return minSessionSize;
111 if (minSessionSize < 1) {
112 throw new IllegalArgumentException(
"minSessionSize cannot be less than 1.");
114 this.minSessionSize = minSessionSize;
118 public int getMaxSessionSize() {
119 return maxSessionSize;
123 if (maxSessionSize < 1) {
124 throw new IllegalArgumentException(
"maxSessionSize cannot be less than 1.");
126 this.maxSessionSize = maxSessionSize;
130 public int getTimeout() {
136 throw new IllegalArgumentException(
"timeout cannot be less than 0.");
138 this.timeout = timeout;
142 public int getCleanTime() {
148 throw new IllegalArgumentException(
"cleanTime cannot be less than 0.");
150 this.cleanTime = cleanTime;
154 public int getHealthCheckTime() {
155 return healthCheckTime;
159 if (healthCheckTime < 0) {
160 throw new IllegalArgumentException(
"cleanTime cannot be less than 0.");
162 this.healthCheckTime = healthCheckTime;
166 public int getRetryConnectTimes() {
167 return retryConnectTimes;
171 if (retryConnectTimes < 0) {
172 throw new IllegalArgumentException(
"retryConnectTimes cannot be less than 0.");
174 this.retryConnectTimes = retryConnectTimes;
178 public int getWaitTime() {
184 throw new IllegalArgumentException(
"waitTime cannot be less than 0.");
186 this.waitTime = waitTime;
190 public int getRetryTimes() {
195 if (retryTimes < 0) {
196 throw new IllegalArgumentException(
"retryTimes cannot be less than 0.");
198 this.retryTimes = retryTimes;
202 public int getIntervalTime() {
207 if (intervalTime < 0) {
208 throw new IllegalArgumentException(
"intervalTime cannot be less than 0.");
210 this.intervalTime = intervalTime;
214 public boolean isReconnect() {
219 this.reconnect = reconnect;
223 public boolean isEnableSsl() {
228 this.enableSsl = enableSsl;
237 this.sslParam = sslParam;
241 public boolean isUseHttp2() {
246 this.useHttp2 = useHttp2;
250 public Map<String, String> getCustomHeaders() {
251 return customHeaders;
255 this.customHeaders = customHeaders;
260 public String toString() {
261 return "SessionPoolConfig{"
262 +
"username='" + username +
'\''
263 +
", graphAddressList=" + graphAddressList
264 +
", spaceName='" + spaceName +
'\''
265 +
", minSessionSize=" + minSessionSize
266 +
", maxSessionSize=" + maxSessionSize
267 +
", timeout=" + timeout
268 +
", idleTime=" + cleanTime
269 +
", healthCheckTime=" + healthCheckTime
270 +
", waitTime=" + waitTime
271 +
", retryTimes=" + retryTimes
272 +
", intervalTIme=" + intervalTime
273 +
", reconnect=" + reconnect
274 +
", enableSsl=" + enableSsl
275 +
", sslParam=" + sslParam
276 +
", useHttp2=" + useHttp2
277 +
", customHeaders=" + customHeaders