internal static TestRetryStepState FromBytes(BinaryReader br) { TestRetryStepState state = new TestRetryStepState(); // Note: the type of command (an Enum serialized as Int32) was already read by caller state.Read(br); return(state); }
public static TestRetryStepState Convert(ActionStateBase actionState) { TestRetryStepState testRetryStepState = actionState as TestRetryStepState; if (testRetryStepState == null) { throw new InvalidCastException("State object could not be converted"); } return(testRetryStepState); }
public override async Task <ActionStateBase> RunAsync(CancellationToken cancellationToken, ServiceInternalFaultInfo serviceInternalFaultInfo) { TestabilityTrace.TraceSource.WriteInfo(StepBase.TraceType, "{0} - Inside TestRetryStepStepTwo - this should retry w/o rollback when exception is thrown", this.State.OperationId); TestRetryStepState castedState = Convert(this.State); // Simulate work await Task.Delay(TimeSpan.FromMilliseconds(500)).ConfigureAwait(false); TestabilityTrace.TraceSource.WriteInfo(StepBase.TraceType, "{0} - Inside TestRetryStepStepTwo - before PerformInternalServiceFaultIfRequested", this.State.OperationId); ActionTest.PerformInternalServiceFaultIfRequested(this.State.OperationId, serviceInternalFaultInfo, this.State, cancellationToken, true); TestabilityTrace.TraceSource.WriteInfo(StepBase.TraceType, "{0} - Inside TestRetryStepStepTwo - after PerformInternalServiceFaultIfRequested", this.State.OperationId); this.State.StateProgress.Push(StepStateNames.CompletedSuccessfully); return(this.State); }
public TestRetryStepAction(IReliableStateManager stateManager, IStatefulServicePartition partition, TestRetryStepState state, TimeSpan requestTimeout, TimeSpan operationTimeout) : base(stateManager, partition, state, requestTimeout, operationTimeout) { }