private static void ExecuteNode(Cluster cluster, BatchNode batchNode, BatchPolicy policy, Key[] keys, bool[] existsArray, Record[] records, string[] binNames, int readAttr)
 {
     if (records != null)
     {
         MultiCommand command = new BatchGetArrayCommand(cluster, null, batchNode, policy, keys, binNames, records, readAttr);
         command.Execute();
     }
     else
     {
         MultiCommand command = new BatchExistsArrayCommand(cluster, null, batchNode, policy, keys, existsArray);
         command.Execute();
     }
 }
Esempio n. 2
0
        protected internal override bool RetryBatch(Cluster cluster, int socketTimeout, int totalTimeout, DateTime deadline, int iteration, int commandSentCounter)
        {
            // Retry requires keys for this node to be split among other nodes.
            // This is both recursive and exponential.
            List <BatchNode> batchNodes = BatchNode.GenerateList(cluster, policy, keys, sequence, batch);

            if (batchNodes.Count == 1 && batchNodes[0].node == batch.node)
            {
                // Batch node is the same.  Go through normal retry.
                return(false);
            }

            // Run batch requests sequentially in same thread.
            foreach (BatchNode batchNode in batchNodes)
            {
                MultiCommand command = new BatchExistsArrayCommand(parent, batchNode, policy, keys, existsArray);
                command.sequence = sequence;
                command.Execute(cluster, policy, null, batchNode.node, true, socketTimeout, totalTimeout, deadline, iteration, commandSentCounter);
            }
            return(true);
        }
        private static void ExecuteNode(Cluster cluster, BatchNode batchNode, BatchPolicy policy, Key[] keys, bool[] existsArray, Record[] records, string[] binNames, int readAttr)
        {
            if (batchNode.node.UseNewBatch(policy))
            {
                // New batch
                if (records != null)
                {
                    MultiCommand command = new BatchGetArrayCommand(batchNode, policy, keys, binNames, records, readAttr);
                    command.Execute(cluster, policy, null, batchNode.node, true);
                }
                else
                {
                    MultiCommand command = new BatchExistsArrayCommand(batchNode, policy, keys, existsArray);
                    command.Execute(cluster, policy, null, batchNode.node, true);
                }
            }
            else
            {
                // Old batch only allows one namespace per call.
                batchNode.SplitByNamespace(keys);

                foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                {
                    if (records != null)
                    {
                        MultiCommand command = new BatchGetArrayDirect(batchNamespace, policy, keys, binNames, records, readAttr);
                        command.Execute(cluster, policy, null, batchNode.node, true);
                    }
                    else
                    {
                        MultiCommand command = new BatchExistsArrayDirect(batchNamespace, policy, keys, existsArray);
                        command.Execute(cluster, policy, null, batchNode.node, true);
                    }
                }
            }
        }
        private static void ExecuteNode(BatchNode batchNode, BatchPolicy policy, Key[] keys, bool[] existsArray, Record[] records, string[] binNames, int readAttr)
        {
            if (batchNode.node.UseNewBatch(policy))
            {
                // New batch
                if (records != null)
                {
                    MultiCommand command = new BatchGetArrayCommand(batchNode, policy, keys, binNames, records, readAttr);
                    command.Execute();
                }
                else
                {
                    MultiCommand command = new BatchExistsArrayCommand(batchNode, policy, keys, existsArray);
                    command.Execute();
                }
            }
            else
            {
                // Old batch only allows one namespace per call.
                batchNode.SplitByNamespace(keys);

                foreach (BatchNode.BatchNamespace batchNamespace in batchNode.batchNamespaces)
                {
                    if (records != null)
                    {
                        MultiCommand command = new BatchGetArrayDirect(batchNode.node, batchNamespace, policy, keys, binNames, records, readAttr);
                        command.Execute();
                    }
                    else
                    {
                        MultiCommand command = new BatchExistsArrayDirect(batchNode.node, batchNamespace, policy, keys, existsArray);
                        command.Execute();
                    }
                }
            }
        }