public OpenInstanceStoreAsyncResult(DurableInstanceManager instanceManager, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { this.instanceManager = instanceManager; this.timeoutHelper = new TimeoutHelper(timeout); lock (this.instanceManager.thisLock) { DurableInstanceManager.ThrowIfDisposedOrImmutable(this.instanceManager.state); this.instanceManager.state = States.Opened; } this.instanceManager.InitializeDefinitionProvider(); instanceManager.CheckPersistenceProviderBehavior(); this.instanceManager.SetDefaultOwnerMetadata(); this.OnCompleting = OpenInstanceStoreAsyncResult.onFinally; bool completeSelf; Exception completionException = null; try { if (instanceManager.InstanceStore == null) { completeSelf = CreateDirectory(); } else { this.handle = this.instanceManager.InstanceStore.CreateInstanceHandle(null); IAsyncResult executeResult = this.instanceManager.InstanceStore.BeginExecute(this.handle, this.instanceManager.GetCreateOwnerCommand(), this.timeoutHelper.RemainingTime(), this.PrepareAsyncCompletion(OpenInstanceStoreAsyncResult.handleEndExecute), this); completeSelf = SyncContinue(executeResult); } } catch (Exception exception) { if (Fx.IsFatal(exception)) { throw; } completionException = exception; completeSelf = true; } if (completeSelf) { Complete(true, completionException); } }
public OpenInstanceStoreAsyncResult(DurableInstanceManager instanceManager, TimeSpan timeout, AsyncCallback callback, object state) : base(callback, state) { bool flag; this.instanceManager = instanceManager; this.timeoutHelper = new TimeoutHelper(timeout); lock (this.instanceManager.thisLock) { DurableInstanceManager.ThrowIfDisposedOrImmutable(this.instanceManager.state); this.instanceManager.state = 1; } instanceManager.CheckPersistenceProviderBehavior(); this.instanceManager.SetDefaultOwnerMetadata(); base.OnCompleting = onFinally; Exception exception = null; try { if (instanceManager.InstanceStore == null) { flag = this.CreateDirectory(); } else { this.handle = this.instanceManager.InstanceStore.CreateInstanceHandle((InstanceOwner) null); IAsyncResult result = this.instanceManager.InstanceStore.BeginExecute(this.handle, this.instanceManager.createOwnerCommand, this.timeoutHelper.RemainingTime(), base.PrepareAsyncCompletion(handleEndExecute), this); flag = base.SyncContinue(result); } } catch (Exception exception2) { if (Fx.IsFatal(exception2)) { throw; } exception = exception2; flag = true; } if (flag) { base.Complete(true, exception); } }