public TaskStatInfo GetTaskAllInfoStartedWith(ulong taskId, DateTime date) { Common.Utility.LogDebug(string.Format("Start of method GetTaskAllInfoStartedWith for taskId: {0}, time: {1}", taskId, date)); TaskStatInfo bufferData = null; Utility.ExceptionablePlaceWrapper(() => { TaskStatInfo cacheData = _taskCache.GetStartedWith(taskId, date, true); if (cacheData != null) { bufferData = cacheData; return; } StatisticalBufferClient farmBuffer = GetStatFarmBufferClient(); try { bufferData = farmBuffer.GetTaskInfoStartedWith(taskId, date); } finally { farmBuffer.Close(); } }, "Failed to get info for task with taskId=" + taskId, "Getting info for task with taskId=" + taskId + " have succeded"); Common.Utility.LogDebug(string.Format("End of method GetTaskAllInfoStartedWith for taskId: {0}, time: {1}", taskId, date)); return(bufferData); }
private Dictionary <U, V> GetAllInfoStartedWith <U, V>( Func <Dictionary <U, V> > cacheQueryProccessor, Func <StatisticalBufferClient, Dictionary <U, V> > serviceCallProccessor) { Dictionary <U, V> cacheData = cacheQueryProccessor();/*cache.GetAllInfoStartedWith(date);*/ StatisticalBufferClient farmBuffer = GetStatFarmBufferClient(); Dictionary <U, V> bufferData = null; try { //todo: remake it later //bufferData = new Dictionary<U, V>(); bufferData = serviceCallProccessor(farmBuffer); } finally { if (farmBuffer.State == CommunicationState.Faulted) { farmBuffer.Abort(); } else { farmBuffer.Close(); } } return(JoinCacheAndBufferData <U, V>(cacheData, bufferData)); }