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<>();
70 if (addresses ==
null || addresses.size() == 0) {
71 throw new IllegalArgumentException(
"Graph addresses cannot be empty.");
73 if (spaceName ==
null || spaceName.trim().isEmpty()) {
74 throw new IllegalArgumentException(
"space name cannot be blank.");
76 if (username ==
null || username.trim().isEmpty()) {
77 throw new IllegalArgumentException(
"user name cannot be blank.");
79 if (password ==
null || password.trim().isEmpty()) {
80 throw new IllegalArgumentException(
"password cannot be blank.");
83 this.graphAddressList = addresses;
84 this.spaceName = spaceName;
85 this.username = username;
86 this.password = password;
89 public String getUsername() {
93 public String getPassword() {
97 public List<HostAddress> getGraphAddressList() {
98 return graphAddressList;
101 public String getSpaceName() {
105 public int getMinSessionSize() {
106 return minSessionSize;
110 if (minSessionSize < 1) {
111 throw new IllegalArgumentException(
"minSessionSize cannot be less than 1.");
113 this.minSessionSize = minSessionSize;
117 public int getMaxSessionSize() {
118 return maxSessionSize;
122 if (maxSessionSize < 1) {
123 throw new IllegalArgumentException(
"maxSessionSize cannot be less than 1.");
125 this.maxSessionSize = maxSessionSize;
129 public int getTimeout() {
135 throw new IllegalArgumentException(
"timeout cannot be less than 0.");
137 this.timeout = timeout;
141 public int getCleanTime() {
147 throw new IllegalArgumentException(
"cleanTime cannot be less than 0.");
149 this.cleanTime = cleanTime;
153 public int getHealthCheckTime() {
154 return healthCheckTime;
158 if (healthCheckTime < 0) {
159 throw new IllegalArgumentException(
"cleanTime cannot be less than 0.");
161 this.healthCheckTime = healthCheckTime;
165 public int getRetryConnectTimes() {
166 return retryConnectTimes;
170 if (retryConnectTimes < 0) {
171 throw new IllegalArgumentException(
"retryConnectTimes cannot be less than 0.");
173 this.retryConnectTimes = retryConnectTimes;
177 public int getWaitTime() {
183 throw new IllegalArgumentException(
"waitTime cannot be less than 0.");
185 this.waitTime = waitTime;
189 public int getRetryTimes() {
194 if (retryTimes < 0) {
195 throw new IllegalArgumentException(
"retryTimes cannot be less than 0.");
197 this.retryTimes = retryTimes;
201 public int getIntervalTime() {
206 if (intervalTime < 0) {
207 throw new IllegalArgumentException(
"intervalTime cannot be less than 0.");
209 this.intervalTime = intervalTime;
213 public boolean isReconnect() {
218 this.reconnect = reconnect;
222 public boolean isEnableSsl() {
227 this.enableSsl = enableSsl;
236 this.sslParam = sslParam;
240 public boolean isUseHttp2() {
245 this.useHttp2 = useHttp2;
249 public Map<String, String> getCustomHeaders() {
250 return customHeaders;
254 this.customHeaders = customHeaders;
259 public String toString() {
260 return "SessionPoolConfig{"
261 +
"username='" + username +
'\''
262 +
", graphAddressList=" + graphAddressList
263 +
", spaceName='" + spaceName +
'\''
264 +
", minSessionSize=" + minSessionSize
265 +
", maxSessionSize=" + maxSessionSize
266 +
", timeout=" + timeout
267 +
", idleTime=" + cleanTime
268 +
", healthCheckTime=" + healthCheckTime
269 +
", waitTime=" + waitTime
270 +
", retryTimes=" + retryTimes
271 +
", intervalTIme=" + intervalTime
272 +
", reconnect=" + reconnect
273 +
", enableSsl=" + enableSsl
274 +
", sslParam=" + sslParam
275 +
", useHttp2=" + useHttp2
276 +
", customHeaders=" + customHeaders