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); }
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); }