// The TAP async version of OnNotifyUnhandledException() above. protected async Task OnNotifyUnhandledExceptionAsync(Exception exception, Activity source, string sourceInstanceId) { UnhandledExceptionAction unhandledExceptionAction = Parameters.UnhandledExceptionAction; if (await NotifyHostOnUnhandledExceptionAsync(exception, source) != null) { // If the host can't handle it, the instance will abort, independently from the configuration. unhandledExceptionAction = UnhandledExceptionAction.Abort; } // TODO Do we really need to protect againts exceptions below? Theoretically Controller won't throw now. await ExecuteWithExceptionTrackingAsync(() => { switch (unhandledExceptionAction) { default: case UnhandledExceptionAction.Abort: return(AbortAsync(exception)); case UnhandledExceptionAction.Cancel: return(ScheduleCancelAsync()); case UnhandledExceptionAction.Terminate: return(TerminateAsync(exception)); } }); // Continue with the final processing. await OnNotifyPausedAsync(); }
/// <summary> /// See <see cref="Orleans.Activities.Configuration.IParameters"/> for parameter descriptions. /// </summary> public Parameters( // Yes, these are intentionally nullable, this way the default values are centralised and not scattered (and fixed) through the code during compile time. TimeSpan?defaultTimeoutDelay = null, TimeSpan?defaultRetryDelayStartValue = null, Single?defaultRetryDelayDelayMultiplicator = null, TimeSpan?defaultRetryDelayMaxValue = null, TimeSpan?resumeOperationTimeout = null, TimeSpan?resumeInfrastructureTimeout = null, TimeSpan?trackingTimeout = null, TimeSpan?reactivationReminderPeriod = null, IdlePersistenceMode?idlePersistenceMode = null, bool?persistWriteOnlyValues = null, TimeSpan?extensionsPersistenceTimeout = null, UnhandledExceptionAction?unhandledExceptionAction = null) { DefaultTimeoutDelay = defaultTimeoutDelay ?? TimeSpan.FromMinutes(5); DefaultRetryDelayStartValue = defaultRetryDelayStartValue ?? TimeSpan.FromMinutes(1); DefaultRetryDelayDelayMultiplicator = defaultRetryDelayDelayMultiplicator ?? 2.0f; DefaultRetryDelayMaxValue = defaultRetryDelayMaxValue ?? TimeSpan.FromMinutes(60); ResumeOperationTimeout = resumeOperationTimeout ?? TimeSpan.FromSeconds(30); ResumeInfrastructureTimeout = resumeInfrastructureTimeout ?? TimeSpan.FromSeconds(30); TrackingTimeout = trackingTimeout ?? TimeSpan.FromSeconds(30); ReactivationReminderPeriod = reactivationReminderPeriod ?? TimeSpan.FromMinutes(2); IdlePersistenceMode = idlePersistenceMode ?? IdlePersistenceMode.OnPersistableIdle | IdlePersistenceMode.OnCompleted; PersistWriteOnlyValues = persistWriteOnlyValues ?? false; ExtensionsPersistenceTimeout = extensionsPersistenceTimeout ?? TimeSpan.FromSeconds(30); UnhandledExceptionAction = unhandledExceptionAction ?? UnhandledExceptionAction.Abort; }
/// <summary> /// See <see cref="Orleans.Activities.Configuration.IParameters"/> for parameter descriptions. /// </summary> public Parameters( // Yes, these are intentionally nullable, this way the default values are centralised and not scattered (and fixed) through the code during compile time. TimeSpan? defaultTimeoutDelay = null, TimeSpan? defaultRetryDelayStartValue = null, Single? defaultRetryDelayDelayMultiplicator = null, TimeSpan? defaultRetryDelayMaxValue = null, TimeSpan? resumeOperationTimeout = null, TimeSpan? resumeInfrastructureTimeout = null, TimeSpan? trackingTimeout = null, TimeSpan? reactivationReminderPeriod = null, IdlePersistenceMode? idlePersistenceMode = null, bool? persistWriteOnlyValues = null, TimeSpan? extensionsPersistenceTimeout = null, UnhandledExceptionAction? unhandledExceptionAction = null) { DefaultTimeoutDelay = defaultTimeoutDelay ?? TimeSpan.FromMinutes(5); DefaultRetryDelayStartValue = defaultRetryDelayStartValue ?? TimeSpan.FromMinutes(1); DefaultRetryDelayDelayMultiplicator = defaultRetryDelayDelayMultiplicator ?? 2.0f; DefaultRetryDelayMaxValue = defaultRetryDelayMaxValue ?? TimeSpan.FromMinutes(60); ResumeOperationTimeout = resumeOperationTimeout ?? TimeSpan.FromSeconds(30); ResumeInfrastructureTimeout = resumeInfrastructureTimeout ?? TimeSpan.FromSeconds(30); TrackingTimeout = trackingTimeout ?? TimeSpan.FromSeconds(30); ReactivationReminderPeriod = reactivationReminderPeriod ?? TimeSpan.FromMinutes(2); IdlePersistenceMode = idlePersistenceMode ?? IdlePersistenceMode.OnPersistableIdle | IdlePersistenceMode.OnCompleted; PersistWriteOnlyValues = persistWriteOnlyValues ?? false; ExtensionsPersistenceTimeout = extensionsPersistenceTimeout ?? TimeSpan.FromSeconds(30); UnhandledExceptionAction = unhandledExceptionAction ?? UnhandledExceptionAction.Abort; }