コード例 #1
0
        /// <summary>
        /// Executes the request to send the payload to the originating node
        /// </summary>
        public bool Execute(ISubGridProgressiveResponseRequestComputeFuncArgument arg)
        {
            try
            {
                var sw = Stopwatch.StartNew();

                var result = _immutableCompute.Apply(_computeFunc, arg);

                _log.LogDebug($"SubGridProgressiveResponseRequest.Execute() for request {arg.RequestDescriptor} with {arg.Payload.Bytes.Length} bytes completed in {sw.Elapsed}");
                return(result);
            }
            catch (Exception e)
            {
                _log.LogError(e, $"Exception in {nameof(SubGridProgressiveResponseRequest)}");
                return(false);
            }
        }
コード例 #2
0
 /// <summary>
 /// Performs computation ignoring leaving nodes.
 /// </summary>
 private static AssemblyRequestResult ComputeApplySafe(ICompute compute, GetAssemblyFunc func,
                                                       AssemblyRequest req)
 {
     try
     {
         return(compute.Apply(func, req));
     }
     catch (ClusterGroupEmptyException)
     {
         // Normal situation: node has left.
         return(null);
     }
     catch (AggregateException aex)
     {
         // Normal situation: node has left.
         aex.Handle(e => e is ClusterGroupEmptyException);
         return(null);
     }
 }