/** * 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 final boolean findSeed(Host search) { for (Host seed : seeds) { if (seed.equals(search)) { return true; } } return false; }
hosts = Host.parseHosts(cl.getOptionValue("hosts"), port); } else { hosts = new Host[1]; hosts[0] = new Host("127.0.0.1", port);
List<Host> hosts = Host.parseServiceHosts(result); Host h; h = new Host(alt, h.port); if (h.equals(this.primaryHost)) { h = new Host(alt, h.port); this.primaryHost = new Host(address.getHostAddress(), tlsName, h.port); this.primaryAddress = socketAddress; this.primaryConn.close();
List<Host> hosts = Host.parseServiceHosts(result); Host clearHost; clearHost = new Host(alternativeHost, clearHost.port);
/** * Connect and run one or more client examples. */ public static void runExamples(Console console, Parameters params, List<String> examples) throws Exception { ClientPolicy policy = new ClientPolicy(); policy.user = params.user; policy.password = params.password; policy.authMode = params.authMode; policy.tlsPolicy = params.tlsPolicy; params.policy = policy.readPolicyDefault; params.writePolicy = policy.writePolicyDefault; Host[] hosts = Host.parseHosts(params.host, params.port); AerospikeClient client = new AerospikeClient(policy, hosts); try { params.setServerSpecific(client); for (String exampleName : examples) { runExample(exampleName, client, params, console); } } finally { client.close(); } }
this.hosts = Host.parseHosts(line.getOptionValue("hosts"), this.port); this.hosts[0] = new Host("127.0.0.1", this.port);
List<Host> hosts = Host.parseServiceHosts(result); Host h; h = new Host(alt, h.port); if (h.equals(this.primaryHost)) { h = new Host(alt, h.port); this.primaryHost = new Host(address.getHostAddress(), tlsName, h.port); this.primaryAddress = socketAddress; this.primaryConn.close();
List<Host> hosts = Host.parseServiceHosts(result); Host clearHost; clearHost = new Host(alternativeHost, clearHost.port);
params.writePolicy = policy.writePolicyDefault; Host[] hosts = Host.parseHosts(params.host, params.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 final boolean findSeed(Host search) { for (Host seed : seeds) { if (seed.equals(search)) { return true; } } return false; }
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; }