/// <summary> /// Initialize Aerospike client with suitable hosts to seed the cluster map. /// The client policy is used to set defaults and size internal data structures. /// For each host connection that succeeds, the client will: /// <list type="bullet"> /// <item>Add host to the cluster map</item> /// <item>Request host's list of other nodes in cluster</item> /// <item>Add these nodes to cluster map</item> /// </list> /// <para> /// In most cases, only one host is necessary to seed the cluster. The remaining hosts /// are added as future seeds in case of a complete network failure. /// </para> /// <para> /// If one connection succeeds, the client is ready to process database requests. /// If all connections fail and the policy's failIfNotConnected is true, a connection /// exception will be thrown. Otherwise, the cluster will remain in a disconnected state /// until the server is activated. /// </para> /// </summary> /// <param name="policy">client configuration parameters, pass in null for defaults</param> /// <param name="hosts">array of potential hosts to seed the cluster</param> /// <exception cref="AerospikeException">if all host connections fail</exception> public AerospikeClient(ClientPolicy policy, params Host[] hosts) { if (policy == null) { policy = new ClientPolicy(); } this.readPolicyDefault = policy.readPolicyDefault; this.writePolicyDefault = policy.writePolicyDefault; this.scanPolicyDefault = policy.scanPolicyDefault; this.queryPolicyDefault = policy.queryPolicyDefault; this.batchPolicyDefault = policy.batchPolicyDefault; this.infoPolicyDefault = policy.infoPolicyDefault; cluster = new Cluster(policy, hosts); cluster.InitTendThread(policy.failIfNotConnected); }