示例#1
0
        public PSWorkflowJobManager GetJobManager()
        {
            PSWorkflowJobManager pSWorkflowJobManager;

            if (this._jobManager == null)
            {
                lock (this._syncObject)
                {
                    if (this._jobManager == null)
                    {
                        this._jobManager = PSWorkflowRuntime.Instance.JobManager;
                        return(this._jobManager);
                    }
                    else
                    {
                        pSWorkflowJobManager = this._jobManager;
                    }
                }
                return(pSWorkflowJobManager);
            }
            else
            {
                return(this._jobManager);
            }
        }
示例#2
0
 internal void SetWorkflowJobManager(PSWorkflowJobManager wfJobManager)
 {
     lock (syncLock)
     {
         jobManager = wfJobManager;
     }
 }
示例#3
0
 internal void SetWorkflowJobManager(PSWorkflowJobManager wfJobManager)
 {
     lock (PSWorkflowRuntime.syncLock)
     {
         this.jobManager = wfJobManager;
     }
 }
示例#4
0
        /// <summary>
        /// Disope implementation.
        /// </summary>
        /// <param name="disposing"></param>
        private void Dispose(bool disposing)
        {
            if (_isDisposed || !disposing)
            {
                return;
            }

            lock (_syncObject)
            {
                if (_isDisposed)
                {
                    return;
                }

                // Suspend all running jobs then dispose all runspace providers
                if (jobManager != null)
                {
                    jobManager.Dispose();
                }
                jobManager = null;

                var remoteRunspaceProvider = _runspaceProvider as ConnectionManager;
                if (remoteRunspaceProvider != null)
                {
                    remoteRunspaceProvider.Dispose();
                }
                _runspaceProvider = null;

                var localRunspaceProvider = _localRunspaceProvider as LocalRunspaceProvider;
                if (localRunspaceProvider != null)
                {
                    localRunspaceProvider.Dispose();
                }
                _localRunspaceProvider = null;

                var unboundedLocalRunspaceProvider = _localRunspaceProvider as LocalRunspaceProvider;
                if (unboundedLocalRunspaceProvider != null)
                {
                    unboundedLocalRunspaceProvider.Dispose();
                }
                _unboundedLocalRunspaceProvider = null;

                activityHostController = null;

                _isDisposed = true;
            }
        }
        /// <summary>
        /// GetJobManager
        /// </summary>
        /// <returns></returns>
        public PSWorkflowJobManager GetJobManager()
        {
            if (_jobManager != null)
            {
                return(_jobManager);
            }

            lock (_syncObject)
            {
                if (_jobManager != null)
                {
                    return(_jobManager);
                }

                _jobManager = PSWorkflowRuntime.Instance.JobManager;
            }
            return(_jobManager);
        }