6 package com.vesoft.nebula.client.meta;
8 import com.facebook.thrift.protocol.THeaderProtocol;
9 import com.facebook.thrift.protocol.TProtocol;
10 import com.facebook.thrift.transport.THeaderTransport;
11 import com.facebook.thrift.transport.TTransport;
12 import com.google.common.base.Preconditions;
13 import com.google.common.net.InetAddresses;
14 import com.google.common.net.InternetDomainName;
15 import com.vesoft.nebula.client.graph.data.HostAddress;
16 import java.io.Serializable;
17 import java.net.InetAddress;
18 import java.net.UnknownHostException;
19 import java.util.List;
22 protected final List<HostAddress> addresses;
23 protected final int connectionRetry;
24 protected final int executionRetry;
25 protected final int timeout;
27 protected THeaderProtocol protocol;
28 protected THeaderTransport transport;
31 int connectionRetry,
int executionRetry)
throws UnknownHostException {
32 Preconditions.checkArgument(timeout > 0);
33 Preconditions.checkArgument(connectionRetry >= 0);
34 Preconditions.checkArgument(executionRetry >= 0);
36 String host = InetAddress.getByName(address.getHost()).getHostAddress();
37 int port = address.getPort();
39 if (!(InetAddresses.isInetAddress(host)
40 || InetAddresses.isUriInetAddress(host)
41 || InternetDomainName.isValid(host))
42 || (port <= 0 || port >= 65535)) {
43 throw new IllegalArgumentException(String.format(
"%s:%d is not a valid address",
48 this.addresses = addresses;
49 this.timeout = timeout;
50 this.connectionRetry = connectionRetry;
51 this.executionRetry = executionRetry;
54 public int getConnectionRetry() {
55 return connectionRetry;
58 public int getExecutionRetry() {
59 return executionRetry;
62 public int getTimeout() {