public PswsTimer(ElapsedEventHandler elapsedEventHandler, int timeout, bool continuous, bool startAtCreation) { this.timeout = new BoundedInteger(timeout, 1, 0x7fffffff); this.elapsedEventHandler = elapsedEventHandler; this.continuous = continuous; this.timer = PswsTimer.CreateTimer(elapsedEventHandler, this.timeout.Value, this.continuous, startAtCreation); this.disposed = false; }
protected virtual void Dispose(bool disposeManagedResources) { if (!this.disposed && disposeManagedResources && this.timer != null) { this.timer.Dispose(); this.timer = null; } this.disposed = true; }
public PSCommand(Envelope<PSRunspace, UserContext> runspace, ResourceType entityType, PSCmdletInfo cmdletInfo, CommandType commandType = (CommandType)1) { this.syncObject = new object(); this.runspace = runspace; this.cmdletInfo = cmdletInfo; this.entityType = entityType; this.parameters = new Dictionary<string, object>(); this.powerShell = null; this.timer = new PswsTimer(new ElapsedEventHandler(this.TimerCallback), DataServiceController.Current.Configuration.PowerShell.Quotas.MaxExecutionTime, false, false); this.commandType = commandType; }
public CacheController(int timeout) { this.syncObject = new object(); this.timer = new PswsTimer(new ElapsedEventHandler(this.OnElapsedEvent), timeout); this.caches = new HashSet<Cache>(); }
protected virtual void Dispose(bool disposeManagedResources) { if (!this.disposed && disposeManagedResources) { if (this.runspace != null) { this.runspace.Store.Return(this.runspace); this.runspace = null; } if (this.timer != null) { this.timer.Dispose(); this.timer = null; } } this.disposed = true; }
protected virtual void Dispose(bool disposeManagedResources) { if (!this.disposed && disposeManagedResources) { if (this.runspace != null) { this.runspace.Store.Return(this.runspace); } if (this.executionToken != null) { this.executionToken.Release(); this.executionToken = null; } if (this.timer != null) { this.timer.Dispose(); this.timer = null; } if (this.userCacheLocked) { DataServiceController.Current.UserDataCache.TryUnlockKey(this.runspace.Borrower); this.userCacheLocked = false; } } this.disposed = true; }
public PipelineInvocation(Envelope<PSRunspace, UserContext> runspace, ResourceType entityType) { UserData userDatum = null; this.runspace = runspace; this.entityType = entityType; this.ID = Guid.NewGuid(); this.Status = PipelineState.Executing; this.WaitMsec = 0; this.OutputFormat = null; this.ExpirationTime = DateTimeHelper.UtcNow; this.outputQuotaExceeded = false; this.outputObjects = new PSDataCollection<PSObject>(); this.Errors = new Collection<ErrorRecord>(); this.finished = new ManualResetEvent(false); this.TestHookCompletionCallback = new AsyncCallback(this.AsyncCallback); if (runspace != null) { this.executionToken = DataServiceController.Current.GetAuthorizedUserIdentity(runspace.Borrower); this.executionToken.AddRef(); DataServiceController.Current.UserDataCache.TryLockKey(runspace.Borrower, out userDatum); this.userCacheLocked = true; } this.timer = new PswsTimer(new ElapsedEventHandler(this.TimerCallback), DataServiceController.Current.Configuration.PowerShell.Quotas.MaxExecutionTime, false, false); }
public CacheController(int timeout) { this.syncObject = new object(); this.timer = new PswsTimer(new ElapsedEventHandler(this.OnElapsedEvent), timeout); this.caches = new HashSet <Cache>(); }