コード例 #1
0
        public InnerData ReadSimple(InnerData data)
        {
            InnerData result = null;

            if (data.Transaction.Destination.Count == 1)
            {
                result = _net.ReadOperation(data.Transaction.Destination.First(), data);
            }
            else
            {
                var retList = new List <InnerData>();

                var list = data.Transaction.Destination.Select((server, i) => _tasks[i].ContinueWith((e) =>
                {
                    var ret = _net.ReadOperation(server, data);
                    if (ret != null)
                    {
                        lock (_lock)
                        {
                            retList.Add(ret);
                        }
                    }
                }));

                Task.WaitAll(list.ToArray());

                result = GetData(retList);
            }

            return(result);
        }
コード例 #2
0
        private void ReadProcess(InnerData data)
        {
            var list = new List <InnerData>();

            foreach (var serverId in data.Transaction.Destination)
            {
                var result = _net.ReadOperation(serverId, data);
                if (result != null)
                {
                    list.Add(result);
                }
            }
            var readResult = ChooseReadResult(list);

            ProcessReadResult(data, readResult, data.Transaction.ProxyServerId);
        }