Beispiel #1
0
        public void Destroy()
        {
            rwlock.EnterWriteLock();
            try
            {
                processManager.StopProcesses(); // NB: do this first to unlock files.

                if (port != null)
                {
                    port.Delete(user);
                }

                directory.Delete();

                user.Delete();

                this.state = ContainerState.Destroyed;
            }
            finally
            {
                rwlock.ExitWriteLock();
            }
        }
Beispiel #2
0
        /// <summary>
        /// Used for restore.
        /// </summary>
        private Container(string handle, ContainerState containerState)
        {
            if (handle.IsNullOrWhiteSpace())
            {
                throw new ArgumentNullException("handle");
            }
            this.handle = new ContainerHandle(handle);

            if (containerState == null)
            {
                throw new ArgumentNullException("containerState");
            }
            this.state = containerState;

            this.user      = new ContainerUser(handle);
            this.directory = new ContainerDirectory(this.handle, this.user);

            this.processManager = new ProcessManager(this.user);

            if (this.state == ContainerState.Active)
            {
                this.RestoreProcesses();
            }
        }
Beispiel #3
0
 public static Container Restore(string handle, ContainerState containerState)
 {
     return(new Container(handle, containerState));
 }