public AsyncBatchGetArrayExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            RecordArrayListener listener,
            Key[] keys,
            string[] binNames,
            int readAttr
        )
        {
            this.keys     = keys;
            this.records  = new Record[keys.Length];
            this.listener = listener;

            // Create commands.
            List <BatchNode> batchNodes = BatchNode.GenerateList(cluster, policy, keys);

            AsyncBatchCommand[] commands = new AsyncBatchCommand[batchNodes.Count];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                commands[count++] = new AsyncBatchGetArrayCommand(this, cluster, batchNode, policy, keys, binNames, records, readAttr);
            }
            // Dispatch commands to nodes.
            Execute(commands);
        }
        public AsyncBatchGetArrayExecutor(AsyncCluster cluster, BatchPolicy policy, RecordArrayListener listener, Key[] keys, HashSet <string> binNames, int readAttr)
            : base(cluster, policy, keys)
        {
            this.recordArray = new Record[keys.Length];
            this.listener    = listener;

            // Dispatch asynchronous commands to nodes.
            foreach (BatchNode batchNode in batchNodes)
            {
                foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                {
                    AsyncBatchGetArray async = new AsyncBatchGetArray(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, binNames, recordArray, readAttr);
                    async.Execute();
                }
            }
        }
        public AsyncBatchGetArrayExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            RecordArrayListener listener,
            Key[] keys,
            string[] binNames,
            int readAttr
        ) : base(cluster, policy, keys)
        {
            this.recordArray = new Record[keys.Length];
            this.listener    = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (batchNode.node.UseNewBatch(policy))
                {
                    // New batch
                    tasks[count++] = new AsyncBatchGetArrayCommand(this, cluster, batchNode, policy, keys, binNames, recordArray, readAttr);
                }
                else
                {
                    // Old batch only allows one namespace per call.
                    foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                    {
                        tasks[count++] = new AsyncBatchGetArrayDirect(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, binNames, recordArray, readAttr);
                    }
                }
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
        public AsyncBatchGetArrayExecutor
        (
            AsyncCluster cluster,
            BatchPolicy policy,
            RecordArrayListener listener,
            Key[] keys,
            string[] binNames,
            int readAttr
        ) : base(cluster, policy, keys, true)
        {
            this.recordArray = new Record[keys.Length];
            this.listener    = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                tasks[count++] = new AsyncBatchGetArrayCommand(this, cluster, batchNode, policy, keys, binNames, recordArray, readAttr);
            }
            // Dispatch commands to nodes.
            Execute(tasks, 0);
        }
        public AsyncBatchGetArrayExecutor(
			AsyncCluster cluster,
			BatchPolicy policy,
			RecordArrayListener listener,
			Key[] keys,
			string[] binNames,
			int readAttr
		)
            : base(cluster, policy, keys)
        {
            this.recordArray = new Record[keys.Length];
            this.listener = listener;

            // Create commands.
            AsyncMultiCommand[] tasks = new AsyncMultiCommand[base.taskSize];
            int count = 0;

            foreach (BatchNode batchNode in batchNodes)
            {
                if (batchNode.node.UseNewBatch(policy))
                {
                    // New batch
                    tasks[count++] = new AsyncBatchGetArrayCommand(this, cluster, batchNode, policy, keys, binNames, recordArray, readAttr);
                }
                else
                {
                    // Old batch only allows one namespace per call.
                    foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                    {
                        tasks[count++] = new AsyncBatchGetArrayDirect(this, cluster, (AsyncNode)batchNode.node, batchNamespace, policy, keys, binNames, recordArray, readAttr);
                    }
                }
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentThreads);
        }
 /// <summary>
 /// Asynchronously read multiple record headers and bins for specified keys in one batch call.
 /// Schedule the batch get command with a channel selector and return.
 /// Another thread will process the command and send the results to the listener in a single call.
 /// <para>
 /// If a key is not found, the record will be null.
 /// The policy can be used to specify timeouts.
 /// </para>
 /// </summary>
 /// <param name="policy">generic configuration parameters, pass in null for defaults</param>
 /// <param name="listener">where to send results</param>
 /// <param name="keys">array of unique record identifiers</param>
 /// <param name="binNames">array of bins to retrieve</param>
 /// <exception cref="AerospikeException">if queue is full</exception>
 public void Get(BatchPolicy policy, RecordArrayListener listener, Key[] keys, params string[] binNames)
 {
     if (keys.Length == 0)
     {
         listener.OnSuccess(keys, new Record[0]);
         return;
     }
     if (policy == null)
     {
         policy = batchPolicyDefault;
     }
     new AsyncBatchGetArrayExecutor(cluster, policy, listener, keys, binNames, Command.INFO1_READ);
 }
 public void Get(Policy policy, RecordArrayListener listener, Key[] keys, params string[] binNames)
 {
     BatchPolicy batchPolicy = GetAsyncBatchPolicy(policy);
     Get(batchPolicy, listener, keys, binNames);
 }
 public void Get(Policy policy, RecordArrayListener listener, Key[] keys)
 {
     BatchPolicy batchPolicy = GetAsyncBatchPolicy(policy);
     Get(batchPolicy, listener, keys);
 }
 /// <summary>
 /// Asynchronously read multiple record header data for specified keys in one batch call.
 /// Schedule the batch get header command with a channel selector and return.
 /// Another thread will process the command and send the results to the listener in a single call.
 /// <para>
 /// If a key is not found, the record will be null.
 /// The policy can be used to specify timeouts.
 /// </para>
 /// </summary>
 /// <param name="policy">generic configuration parameters, pass in null for defaults</param>
 /// <param name="listener">where to send results</param>
 /// <param name="keys">array of unique record identifiers</param>
 /// <exception cref="AerospikeException">if queue is full</exception>
 public void GetHeader(BatchPolicy policy, RecordArrayListener listener, Key[] keys)
 {
     if (keys.Length == 0)
     {
         listener.OnSuccess(keys, new Record[0]);
         return;
     }
     if (policy == null)
     {
         policy = batchPolicyDefault;
     }
     new AsyncBatchGetArrayExecutor(cluster, policy, listener, keys, null, Command.INFO1_READ | Command.INFO1_NOBINDATA);
 }