internal IAsyncResult BeginInvokePowerShell(System.Management.Automation.PowerShell command, PSDataCollection<PSObject> input, PSDataCollection<PSObject> output, PSActivityEnvironment policy, AsyncCallback callback, object state) { if (command != null) { ConnectionAsyncResult connectionAsyncResult = new ConnectionAsyncResult(state, callback, command.InstanceId); this._structuredTracer.OutOfProcessRunspaceStarted(command.ToString()); ActivityInvoker activityInvoker = new ActivityInvoker(); activityInvoker.Input = input; activityInvoker.Output = output; activityInvoker.Policy = policy; activityInvoker.PowerShell = command; activityInvoker.AsyncResult = connectionAsyncResult; ActivityInvoker activityInvoker1 = activityInvoker; connectionAsyncResult.Invoker = activityInvoker1; this._requests.Enqueue(activityInvoker1); PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 19, (long)1, true); PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 20, (long)1, true); this.CheckAndStartServicingThread(); return connectionAsyncResult; } else { throw new ArgumentNullException("command"); } }
/// <summary> /// Begin invocation of command specified in activity /// </summary> /// <param name="command">pipeline of command to execute</param> /// <param name="input">input collection</param> /// <param name="output">output collection</param> /// <param name="policy">policy to use for the activity</param> /// <param name="callback">optional callback</param> /// <param name="state">optional caller specified state</param> /// <returns>IAsyncResult</returns> internal IAsyncResult BeginInvokePowerShell(System.Management.Automation.PowerShell command, PSDataCollection <PSObject> input, PSDataCollection <PSObject> output, PSActivityEnvironment policy, AsyncCallback callback, object state) { if (command == null) { throw new ArgumentNullException("command"); } ConnectionAsyncResult result = new ConnectionAsyncResult(state, callback, command.InstanceId); _structuredTracer.OutOfProcessRunspaceStarted(command.ToString()); ActivityInvoker invoker = new ActivityInvoker { Input = input, Output = output, Policy = policy, PowerShell = command, AsyncResult = result }; result.Invoker = invoker; _requests.Enqueue(invoker); PerfCountersMgr.UpdateCounterByValue( PSWorkflowPerformanceCounterSetInfo.CounterSetId, PSWorkflowPerformanceCounterIds.ActivityHostMgrIncomingRequestsPerSec); PerfCountersMgr.UpdateCounterByValue( PSWorkflowPerformanceCounterSetInfo.CounterSetId, PSWorkflowPerformanceCounterIds.ActivityHostMgrPendingRequestsQueueLength); CheckAndStartServicingThread(); return(result); }
internal IAsyncResult BeginInvokePowerShell(System.Management.Automation.PowerShell command, PSDataCollection <PSObject> input, PSDataCollection <PSObject> output, PSActivityEnvironment policy, AsyncCallback callback, object state) { if (command != null) { ConnectionAsyncResult connectionAsyncResult = new ConnectionAsyncResult(state, callback, command.InstanceId); this._structuredTracer.OutOfProcessRunspaceStarted(command.ToString()); ActivityInvoker activityInvoker = new ActivityInvoker(); activityInvoker.Input = input; activityInvoker.Output = output; activityInvoker.Policy = policy; activityInvoker.PowerShell = command; activityInvoker.AsyncResult = connectionAsyncResult; ActivityInvoker activityInvoker1 = activityInvoker; connectionAsyncResult.Invoker = activityInvoker1; this._requests.Enqueue(activityInvoker1); PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 19, (long)1, true); PSOutOfProcessActivityController.PerfCountersMgr.UpdateCounterByValue(PSWorkflowPerformanceCounterSetInfo.CounterSetId, 20, (long)1, true); this.CheckAndStartServicingThread(); return(connectionAsyncResult); } else { throw new ArgumentNullException("command"); } }
/// <summary> /// Cancels an already started execution /// </summary> /// <param name="asyncResult">async result to cancel</param> internal void CancelInvokePowerShell(IAsyncResult asyncResult) { ConnectionAsyncResult result = asyncResult as ConnectionAsyncResult; if (result != null) { result.Invoker.StopPowerShell(); } }
/// <summary> /// Block until operation is complete on the current thread /// </summary> /// <param name="asyncResult">IAsyncResult to block on</param> internal void EndInvokePowerShell(IAsyncResult asyncResult) { ConnectionAsyncResult result = asyncResult as ConnectionAsyncResult; if (result == null) { throw new PSInvalidOperationException(Resources.AsyncResultNotValid); } result.EndInvoke(); }
internal void EndInvokePowerShell(IAsyncResult asyncResult) { ConnectionAsyncResult connectionAsyncResult = asyncResult as ConnectionAsyncResult; if (connectionAsyncResult != null) { connectionAsyncResult.EndInvoke(); return; } else { throw new PSInvalidOperationException(Resources.AsyncResultNotValid); } }
/// <summary> /// Begin invocation of command specified in activity /// </summary> /// <param name="command">pipeline of command to execute</param> /// <param name="input">input collection</param> /// <param name="output">output collection</param> /// <param name="policy">policy to use for the activity</param> /// <param name="callback">optional callback</param> /// <param name="state">optional caller specified state</param> /// <returns>IAsyncResult</returns> internal IAsyncResult BeginInvokePowerShell(System.Management.Automation.PowerShell command, PSDataCollection<PSObject> input, PSDataCollection<PSObject> output, PSActivityEnvironment policy, AsyncCallback callback, object state) { if (command == null) { throw new ArgumentNullException("command"); } ConnectionAsyncResult result = new ConnectionAsyncResult(state, callback, command.InstanceId); _structuredTracer.OutOfProcessRunspaceStarted(command.ToString()); ActivityInvoker invoker = new ActivityInvoker { Input = input, Output = output, Policy = policy, PowerShell = command, AsyncResult = result }; result.Invoker = invoker; _requests.Enqueue(invoker); PerfCountersMgr.UpdateCounterByValue( PSWorkflowPerformanceCounterSetInfo.CounterSetId, PSWorkflowPerformanceCounterIds.ActivityHostMgrIncomingRequestsPerSec); PerfCountersMgr.UpdateCounterByValue( PSWorkflowPerformanceCounterSetInfo.CounterSetId, PSWorkflowPerformanceCounterIds.ActivityHostMgrPendingRequestsQueueLength); CheckAndStartServicingThread(); return result; }
internal void RunPowerShellInActivityHost(System.Management.Automation.PowerShell powershell, PSDataCollection<PSObject> input, PSDataCollection<PSObject> output, PSActivityEnvironment policy, ConnectionAsyncResult asyncResult) { ActivityInvoker invoker = new ActivityInvoker { Input = input, Output = output, Policy = policy, PowerShell = powershell, AsyncResult = asyncResult }; _requests.Enqueue(invoker); CheckAndStartServicingThread(); }
internal void RunPowerShellInActivityHost(System.Management.Automation.PowerShell powershell, PSDataCollection <PSObject> input, PSDataCollection <PSObject> output, PSActivityEnvironment policy, ConnectionAsyncResult asyncResult) { ActivityInvoker invoker = new ActivityInvoker { Input = input, Output = output, Policy = policy, PowerShell = powershell, AsyncResult = asyncResult }; _requests.Enqueue(invoker); CheckAndStartServicingThread(); }
internal void RunPowerShellInActivityHost(System.Management.Automation.PowerShell powershell, PSDataCollection<PSObject> input, PSDataCollection<PSObject> output, PSActivityEnvironment policy, ConnectionAsyncResult asyncResult) { ActivityInvoker activityInvoker = new ActivityInvoker(); activityInvoker.Input = input; activityInvoker.Output = output; activityInvoker.Policy = policy; activityInvoker.PowerShell = powershell; activityInvoker.AsyncResult = asyncResult; ActivityInvoker activityInvoker1 = activityInvoker; this._requests.Enqueue(activityInvoker1); this.CheckAndStartServicingThread(); }
internal void RunPowerShellInActivityHost(System.Management.Automation.PowerShell powershell, PSDataCollection <PSObject> input, PSDataCollection <PSObject> output, PSActivityEnvironment policy, ConnectionAsyncResult asyncResult) { ActivityInvoker activityInvoker = new ActivityInvoker(); activityInvoker.Input = input; activityInvoker.Output = output; activityInvoker.Policy = policy; activityInvoker.PowerShell = powershell; activityInvoker.AsyncResult = asyncResult; ActivityInvoker activityInvoker1 = activityInvoker; this._requests.Enqueue(activityInvoker1); this.CheckAndStartServicingThread(); }