public virtual void Execute(IList<Action> ops, Action<IEnumerable<Action>> remainingOps) { for (var i = 0; i < ops.Count; i++) { if (!AcceptingJobs) { remainingOps.NotNull(obj => remainingOps(ops.Skip(i + 1))); break; } ops[i](); } }
/// <summary>Initialize a new Worker for the specified method to run. /// </summary> public Worker(Action processor, Action successCallback, Action<Exception> exceptionCallback) : this(successCallback, exceptionCallback) { processor.NotNull("processor"); this.Processor = processor; }
private TimeScheduler(string name, Action action) { name.NotNullOrEmpty("name"); action.NotNull("action"); this._name = name; this._action = action; this._timer = BuildTimer(); }
public override void Execute(IList<Action> ops, Action<IEnumerable<Action>> remainingOps) { var i = 0; try { for (; i < ops.Count; i++) { if (!AcceptingJobs) { // ReSharper disable once AccessToModifiedClosure remainingOps.NotNull(obj => remainingOps(ops.Skip(i + 1))); break; } ops[i](); } } catch (Exception ex) { remainingOps.NotNull(obj => remainingOps(ops.Skip(i + 1))); _exceptionCallback(ex); } }
public Task ExecuteAsync(IList<Action> ops, Action<IEnumerable<Action>> remainingOps) { return TaskRunner.Run(() => { for (var i = 0; i < ops.Count; i++) { if (!AcceptingJobs) { remainingOps.NotNull(obj => remainingOps(ops.Skip(i + 1))); break; } ops[i](); } }); }
/// <summary> /// Sets the assign principal factory /// </summary> /// <remarks>USE THIS ONLY UNIT TESTING</remarks> /// <param name="assignPrincipalFactory">The factory</param> internal void SetAssignPrincipalFactory( Action<HttpRequestMessage, IPrincipal> assignPrincipalFactory) { assignPrincipalFactory.NotNull(nameof(assignPrincipalFactory)); _assignPrincipalFactory = assignPrincipalFactory; }
public static void Initialize(Action<Dictionary<string, string>> initializer) { //TODO:Read the configs(web.config,app.config) to global variables dictinary. if (!hasInit) { globalVariables = new Dictionary<string, string>(); if (initializer.NotNull()) { initializer(globalVariables); hasInit = true; } } }