public void SetException(Exception e) { lock (_stateLock) { try { if (HasEnded()) { // Note that this is possible if the job is already DONE, but a // Task Close is triggered prior to the DONE signal propagates to the // Driver. If the Task Close handler is not implemented, the Handler will // mark the Task with an Exception, although for all intents and purposes // the Task is already done and should not be affected. return; } if (!_lastException.IsPresent()) { _lastException = Optional <Exception> .Of(e); } State = TaskState.Failed; _taskLifeCycle.Stop(); } finally { Heartbeat(); } } }
public void SetException(Exception e) { lock (_stateLock) { if (!_lastException.IsPresent()) { _lastException = Optional <Exception> .Of(e); } State = TaskState.Failed; _taskLifeCycle.Stop(); Heartbeat(); } }
public void SetResult(byte[] result) { _result = Optional <byte[]> .OfNullable(result); if (State == TaskState.Running) { State = TaskState.Done; } else if (State == TaskState.SuspendRequested) { State = TaskState.Suspended; } else if (State == TaskState.CloseRequested) { State = TaskState.Done; } _taskLifeCycle.Stop(); Heartbeat(); }
public void SetException(Exception e) { lock (_heartBeatManager) { try { if (!_lastException.IsPresent()) { _lastException = Optional <Exception> .Of(e); } State = TaskState.Failed; _taskLifeCycle.Stop(); } finally { Heartbeat(); } } }
public void SetResult(byte[] result) { lock (_heartBeatManager) { _result = Optional <byte[]> .OfNullable(result); // This can throw an Exception. _taskLifeCycle.Stop(); switch (State) { case TaskState.SuspendRequested: State = TaskState.Suspended; break; case TaskState.Running: case TaskState.CloseRequested: State = TaskState.Done; break; } Heartbeat(); } }
/// <summary> /// Runs the Task Stop Handlers /// </summary> /// <exception cref="TaskStopHandlerException">If any of the Task Stop Handlers throws an exception</exception> public void RunTaskStopHandlers() { _taskLifeCycle.Stop(); }