public AsyncScanExecutor
        (
            AsyncCluster cluster,
            ScanPolicy policy,
            RecordSequenceListener listener,
            string ns,
            string setName,
            string[] binNames
        )
        {
            this.listener = listener;

            Node[] nodes = cluster.Nodes;

            if (nodes.Length == 0)
            {
                throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Scan failed because cluster is empty.");
            }

            ulong taskId = RandomShift.ThreadLocalInstance.NextLong();

            // Create commands.
            AsyncScan[] tasks = new AsyncScan[nodes.Length];
            int         count = 0;

            foreach (Node node in nodes)
            {
                tasks[count++] = new AsyncScan(this, cluster, (AsyncNode)node, policy, listener, ns, setName, binNames, taskId);
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentNodes);
        }
        public AsyncScanExecutor
        (
            AsyncCluster cluster,
            ScanPolicy policy,
            RecordSequenceListener listener,
            string ns,
            string setName,
            string[] binNames
        )
        {
            this.listener = listener;

            Node[] nodes = cluster.Nodes;

            if (nodes.Length == 0)
            {
                throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Scan failed because cluster is empty.");
            }

            completedSize = nodes.Length;
            long taskId = Environment.TickCount;

            foreach (Node node in nodes)
            {
                AsyncScan async = new AsyncScan(this, cluster, (AsyncNode)node, policy, listener, ns, setName, binNames, taskId);
                async.Execute();
            }
        }
        public AsyncScanExecutor(
			AsyncCluster cluster,
			ScanPolicy policy,
			RecordSequenceListener listener,
			string ns,
			string setName,
			string[] binNames
		)
        {
            this.listener = listener;

            Node[] nodes = cluster.Nodes;

            if (nodes.Length == 0)
            {
                throw new AerospikeException(ResultCode.SERVER_NOT_AVAILABLE, "Scan failed because cluster is empty.");
            }

            ulong taskId = RandomShift.ThreadLocalInstance.NextLong();

            // Create commands.
            AsyncScan[] tasks = new AsyncScan[nodes.Length];
            int count = 0;

            foreach (Node node in nodes)
            {
                tasks[count++] = new AsyncScan(this, cluster, (AsyncNode)node, policy, listener, ns, setName, binNames, taskId);
            }
            // Dispatch commands to nodes.
            Execute(tasks, policy.maxConcurrentNodes);
        }
        public AsyncScanExecutor
        (
            AsyncCluster cluster,
            ScanPolicy policy,
            RecordSequenceListener listener,
            string ns,
            string setName,
            string[] binNames,
            Node[] nodes
        ) : base(cluster)
        {
            this.listener = listener;
            policy.Validate();

            ulong taskId = RandomShift.ThreadLocalInstance.NextLong();

            // Create commands.
            AsyncScan[] tasks            = new AsyncScan[nodes.Length];
            int         count            = 0;
            bool        hasClusterStable = true;

            foreach (Node node in nodes)
            {
                if (!node.HasClusterStable)
                {
                    hasClusterStable = false;
                }
                tasks[count++] = new AsyncScan(this, cluster, (AsyncNode)node, policy, listener, ns, setName, binNames, taskId);
            }

            // Dispatch commands to nodes.
            if (policy.failOnClusterChange && hasClusterStable)
            {
                ExecuteValidate(tasks, policy.maxConcurrentNodes, ns);
            }
            else
            {
                Execute(tasks, policy.maxConcurrentNodes);
            }
        }