internal void ReloadProfiles(WorkflowExecutor exec)
 {
     using (new ServiceEnvironment(exec.RootActivity))
     {
         using (exec.ExecutorLock.Enter())
         {
             if (!exec.IsInstanceValid)
             {
                 throw new InvalidOperationException(ExecutionStringManager.WorkflowNotValid);
             }
             bool flag = exec.Suspend(ExecutionStringManager.TrackingProfileUpdate);
             try
             {
                 this.GetListenerFromWRCache(exec.InstanceId).ReloadProfiles(exec, exec.InstanceId);
             }
             finally
             {
                 if (flag)
                 {
                     exec.Resume();
                 }
             }
         }
     }
 }
예제 #2
0
 public void Suspend(string error)
 {
     using (new WorkflowTraceTransfer(this.InstanceId))
     {
         while (true)
         {
             WorkflowExecutor executor = _runtime.Load(this);
             if (executor.IsInstanceValid)
             {
                 if (executor.WorkflowStatus == WorkflowStatus.Created)
                 {
                     throw new InvalidOperationException(ExecutionStringManager.CannotSuspendBeforeStart);
                 }
                 try
                 {
                     executor.Suspend(error);
                     return;
                 }
                 catch (InvalidOperationException)
                 {
                     if (executor.IsInstanceValid)
                     {
                         throw;
                     }
                 }
                 catch (ExecutorLocksHeldException e)
                 {
                     try
                     {
                         e.Handle.WaitOne();
                     }
                     catch (ObjectDisposedException)
                     {
                         // If an ObjectDisposedException is thrown because
                         // the WaitHandle has already closed, nothing to worry
                         // about. Move on.
                     }
                 }
             }
         }
     }
 }