コード例 #1
0
        private void InitializeJobObject()
        {
            if (this.jobObject != null)
            {
                return;
            }

            // Create the JobObject
            this.jobObject = new CloudFoundry.WindowsPrison.Utilities.WindowsJobObjects.JobObject("Global\\" + this.User.UserName);

            if (this.Configuration.CPUPercentageLimit > 0)
            {
                this.JobObject.CPUPercentageLimit = this.Configuration.CPUPercentageLimit;
            }

            if (this.Configuration.TotalPrivateMemoryLimitBytes > 0)
            {
                this.JobObject.JobMemoryLimitBytes = this.Configuration.TotalPrivateMemoryLimitBytes;
            }

            if (this.Configuration.ActiveProcessesLimit > 0)
            {
                this.JobObject.ActiveProcessesLimit = this.Configuration.ActiveProcessesLimit;
            }

            if (this.Configuration.PriorityClass.HasValue)
            {
                this.JobObject.PriorityClass = this.Configuration.PriorityClass.Value;
            }

            this.jobObject.KillProcessesOnJobClose = true;
        }
コード例 #2
0
        public void Destroy()
        {
            if (this.IsLocked)
            {
                Logger.Debug("Destroying prison {0}", this.Id);

                foreach (var cell in this.prisonCells)
                {
                    cell.Destroy(this);
                }

                this.jobObject.TerminateProcesses(-1);

                this.jobObject.Dispose();
                this.jobObject = null;

                // TODO: Should destroy delete the home directory???
                // Directory.CreateDirectory(prisonRules.PrisonHomePath);

                this.PrisonGuard.TryStopGuard();
                this.User.Profile.UnloadUserProfileUntilReleased();
                this.User.Profile.DeleteUserProfile();
                this.User.Delete();

                this.SystemRemoveQuota();
            }

            this.DeletePersistedPrison();

            this.IsLocked = false;
        }
コード例 #3
0
ファイル: Prison.cs プロジェクト: datatonic/cf-windows-prison
        private void InitializeJobObject()
        {
            if (this.jobObject != null)
            {
                return;
            }

            // Create the JobObject
            this.jobObject = new CloudFoundry.WindowsPrison.Utilities.WindowsJobObjects.JobObject("Global\\" + this.User.UserName);

            if (this.Configuration.CPUPercentageLimit > 0)
            {
                this.JobObject.CPUPercentageLimit = this.Configuration.CPUPercentageLimit;
            }

            if (this.Configuration.TotalPrivateMemoryLimitBytes > 0)
            {
                this.JobObject.JobMemoryLimitBytes = this.Configuration.TotalPrivateMemoryLimitBytes;
            }

            if (this.Configuration.ActiveProcessesLimit > 0)
            {
                this.JobObject.ActiveProcessesLimit = this.Configuration.ActiveProcessesLimit;
            }

            if (this.Configuration.PriorityClass.HasValue)
            {
                this.JobObject.PriorityClass = this.Configuration.PriorityClass.Value;
            }

            this.jobObject.KillProcessesOnJobClose = true;
        }
コード例 #4
0
ファイル: Prison.cs プロジェクト: datatonic/cf-windows-prison
        public void Destroy()
        {
            if (this.IsLocked)
            {
                Logger.Debug("Destroying prison {0}", this.Id);

                foreach (var cell in this.prisonCells)
                {
                    cell.Destroy(this);
                }

                this.jobObject.TerminateProcesses(-1);

                this.jobObject.Dispose();
                this.jobObject = null;

                // TODO: Should destroy delete the home directory???
                // Directory.CreateDirectory(prisonRules.PrisonHomePath);

                this.PrisonGuard.TryStopGuard();
                this.User.Profile.UnloadUserProfileUntilReleased();
                this.User.Profile.DeleteUserProfile();
                this.User.Delete();

                this.SystemRemoveQuota();
            }

            this.DeletePersistedPrison();

            this.IsLocked = false;
        }