private void Execute0(bool cancel, out object res, out bool success)
        {
            // 1. Inject resources.
            IComputeResourceInjector injector = _job as IComputeResourceInjector;

            if (injector != null)
            {
                injector.Inject(_ignite);
            }
            else
            {
                ResourceProcessor.Inject(_job, _ignite);
            }

            // 2. Execute.
            try
            {
                if (cancel)
                {
                    _job.Cancel();
                }

                res = _job.Execute();

                success = true;
            }
            catch (Exception e)
            {
                res = e;

                success = false;
            }
        }
Пример #2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="grid">Grid.</param>
        /// <param name="compute">Compute.</param>
        /// <param name="task">Task.</param>
        /// <param name="arg">Argument.</param>
        public ComputeTaskHolder(Ignite grid, ComputeImpl compute, IComputeTask <TA, T, TR> task, TA arg)
        {
            _compute = compute;
            _arg     = arg;
            _task    = task;

            ResourceTypeDescriptor resDesc = ResourceProcessor.Descriptor(task.GetType());

            IComputeResourceInjector injector = task as IComputeResourceInjector;

            if (injector != null)
            {
                injector.Inject(grid);
            }
            else
            {
                resDesc.InjectIgnite(task, grid);
            }

            _resCache = !resDesc.TaskNoResultCache;
        }