/** * Initialize Aerospike client. * The client policy is used to set defaults and size internal data structures. * If the host connection succeeds, the client will: * <p> * - Add host to the cluster map <br> * - Request host's list of other nodes in cluster <br> * - Add these nodes to cluster map <br> * <p> * If the connection succeeds, the client is ready to process database requests. * If the connection fails and the policy's failOnInvalidHosts is true, a connection * exception will be thrown. Otherwise, the cluster will remain in a disconnected state * until the server is activated. * * @param policy client configuration parameters, pass in null for defaults * @param hostname host name * @param port host port * @throws AerospikeException if host connection fails */ public AerospikeClient(ClientPolicy policy, String hostname, int port) throws AerospikeException { this(policy, new Host(hostname, port)); }
/** * Initialize Aerospike client. * The client policy is used to set defaults and size internal data structures. * If the host connection succeeds, the client will: * <p> * - Add host to the cluster map <br> * - Request host's list of other nodes in cluster <br> * - Add these nodes to cluster map <br> * <p> * If the connection succeeds, the client is ready to process database requests. * If the connection fails and the policy's failOnInvalidHosts is true, a connection * exception will be thrown. Otherwise, the cluster will remain in a disconnected state * until the server is activated. * * @param policy client configuration parameters, pass in null for defaults * @param hostname host name * @param port host port * @throws AerospikeException if host connection fails */ public AerospikeClient(ClientPolicy policy, String hostname, int port) throws AerospikeException { this(policy, new Host(hostname, port)); }
private void setAliases(InetAddress[] addresses, String tlsName, int port) { // Add capacity for current address aliases plus IPV6 address and hostname. this.aliases = new ArrayList<Host>(addresses.length + 2); for (InetAddress address : addresses) { this.aliases.add(new Host(address.getHostAddress(), tlsName, port)); } }
private void setAliases(InetAddress[] addresses, String tlsName, int port) { // Add capacity for current address aliases plus IPV6 address and hostname. this.aliases = new ArrayList<Host>(addresses.length + 2); for (InetAddress address : addresses) { this.aliases.add(new Host(address.getHostAddress(), tlsName, port)); } }
public static void globalConfig(String defaultNamespace, int port, String... urls) { Host[] hosts = new Host[urls.length]; for (int i = 0; i < hosts.length; i++) { hosts[i] = new Host(urls[i], port); } globalConfig(defaultNamespace, hosts); }
/** * Creates a new instance of Spikeify with given parameters. * * @param namespace Default namespace * @param port Default port * @param hosts Aerospike server hosts * @return Spikeify instance */ public static Spikeify instance(String namespace, int port, String... hosts) { Host[] hostsH = new Host[hosts.length]; for (int i = 0; i < hosts.length; i++) { hostsH[i] = new Host(hosts[i], port); } return instance(namespace, hostsH); }
/** * Initialize Aerospike client. * If the host connection succeeds, the client will: * <p> * - Add host to the cluster map <br> * - Request host's list of other nodes in cluster <br> * - Add these nodes to cluster map <br> * <p> * If the connection succeeds, the client is ready to process database requests. * If the connection fails, the cluster will remain in a disconnected state * until the server is activated. * * @param hostname host name * @param port host port * @throws AerospikeException if host connection fails */ public AerospikeClient(String hostname, int port) throws AerospikeException { this(new ClientPolicy(), new Host(hostname, port)); }
/** * Initialize Aerospike client. * If the host connection succeeds, the client will: * <p> * - Add host to the cluster map <br> * - Request host's list of other nodes in cluster <br> * - Add these nodes to cluster map <br> * <p> * If the connection succeeds, the client is ready to process database requests. * If the connection fails, the cluster will remain in a disconnected state * until the server is activated. * * @param hostname host name * @param port host port * @throws AerospikeException if host connection fails */ public AerospikeClient(String hostname, int port) throws AerospikeException { this(new ClientPolicy(), new Host(hostname, port)); }
private List<Host> parseServiceHosts() { ArrayList<Host> list = new ArrayList<Host>(); String hostname; int port; while (offset < length) { if (c != ',') { throw new RuntimeException(); } hostname = parseHost(); if (c != ':') { throw new RuntimeException(); } String s = parseString(); port = Integer.parseInt(s); list.add(new Host(hostname, port)); } return list; }
private List<Host> parseServiceHosts() { ArrayList<Host> list = new ArrayList<Host>(); String hostname; int port; while (offset < length) { if (c != ',') { throw new RuntimeException(); } hostname = parseHost(); if (c != ':') { throw new RuntimeException(); } String s = parseString(); port = Integer.parseInt(s); list.add(new Host(hostname, port)); } return list; }
Host host = new Host(hostname, port);
Host host = new Host(hostname, port);
list.add(new Host(hostname, tlsname, port));
list.add(new Host(hostname, tlsname, port));
} else { hosts = new Host[1]; hosts[0] = new Host("127.0.0.1", port);
clearHost = new Host(alternativeHost, clearHost.port);
clearHost = new Host(alternativeHost, clearHost.port);