Esempio n. 1
0
 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;
 }
Esempio n. 2
0
		protected virtual void Dispose(bool disposeManagedResources)
		{
			if (!this.disposed && disposeManagedResources && this.timer != null)
			{
				this.timer.Dispose();
				this.timer = null;
			}
			this.disposed = true;
		}
Esempio n. 3
0
 protected virtual void Dispose(bool disposeManagedResources)
 {
     if (!this.disposed && disposeManagedResources && this.timer != null)
     {
         this.timer.Dispose();
         this.timer = null;
     }
     this.disposed = true;
 }
Esempio n. 4
0
		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;
		}
Esempio n. 5
0
		public CacheController(int timeout)
		{
			this.syncObject = new object();
			this.timer = new PswsTimer(new ElapsedEventHandler(this.OnElapsedEvent), timeout);
			this.caches = new HashSet<Cache>();
		}
Esempio n. 6
0
		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;
		}
Esempio n. 7
0
		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;
		}
Esempio n. 8
0
		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);
		}
Esempio n. 9
0
 public CacheController(int timeout)
 {
     this.syncObject = new object();
     this.timer      = new PswsTimer(new ElapsedEventHandler(this.OnElapsedEvent), timeout);
     this.caches     = new HashSet <Cache>();
 }