protected ActivatableXAppScopeInstanceBase(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { // _isAutoActivationEnabled = description.IsAutoActivationEnabled(); _hasDeactivatedBeforeInitialization = false; }
public ResetServant(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { // TODO_HIGH: Implement lock naming — $"{nameof(ResetServant<TDescription>)}.{nameof(_resetLock)}". // _resetLock = new SemaphoreSlim(initialCount: 1, maxCount: 1); _resetCounter = -1L; }
public FrequencyLimitTrigger(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { _signalFrequencyLimit = description.SignalFrequencyLimit; }
public XAppLocalPublisher(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { }
public PeriodTrigger(IXAppScopeInstance scope, TDescription description) : base(scope, description) { _period = description.Period; _periodVariance = description.PeriodVariance; }
public ActivationList(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { }
async Task P_DoActivateAsync(IRunControlAttemptState state, Func <IRunControlAttemptState, Task> continuation, bool componentDisability) { state.EnsureNotNull(nameof(state)); continuation.EnsureNotNull(nameof(continuation)); // if (componentDisability) { await continuation(arg : state).ConfigureAwait(false); } else { var resetTrigger = ReadIA(ref _resetTrigger, isNotRequired: true, locationName: nameof(_resetTrigger)); IXAppScopeInstance component = default; IDisposable resetTriggerSubscription = default; try { component = await P_ResetComponentAsync(breakCondition : breakCondition, doFailureResponse : false) .ConfigureAwait(false); await continuation(arg : state).ConfigureAwait(false); if (resetTrigger != null) { WriteDA( location: ref _resetTriggerSignalSubscription, value: resetTriggerSubscription = TriggerUtilities.SubscribeToSignal(trigger: resetTrigger, onSignal: P_ResetTrigger_OnSignal)); await resetTrigger.ActivateControl.StartAsync().ConfigureAwait(false); } } catch (Exception exception) { var caughtExceptions = new List <Exception>() { exception }; if (resetTriggerSubscription != null) { itrlck.SetNullBool(ref _resetTriggerSignalSubscription, resetTriggerSubscription); try { resetTriggerSubscription.Dispose(); } catch (Exception secondException) { caughtExceptions.Add(secondException); } } if (component != null) { try { await OnFreeComponentAsync(component : component).ConfigureAwait(false); itrlck.SetNullBool(ref _component, component); } catch (Exception secondException) { caughtExceptions.Add(secondException); } } if (caughtExceptions.Count > 1) { throw new AggregateException(innerExceptions: caughtExceptions); } else { throw; } } } // bool breakCondition(IContext locCtx) { locCtx.ThrowIfCancellationRequested(); return(state.RunControl.HasStopRequested || HasDeactivationRequested); } }
public static Task <IList <ITriggerXInstance> > CreateInitializeAsync(ArgumentUtilitiesHandle <IEnumerable <ITriggerDescription> > descriptions, IXAppScopeInstance scope, IContext ctx = default) => XInstanceFactoryUtilities.CreateInitializeAppScopeInstanceAsync <ITriggerXInstance>(scope: scope, ctx: ctx, descriptions: descriptions.AsBase <IEnumerable <ITriggerDescription>, IEnumerable <IDescription> >());
protected TriggerBase(IXAppScopeInstance scope, TDescription description) : base(scope: scope, description: description) { // _isDisabled = description.IsDisabled; }