コード例 #1
0
ファイル: ShredController.cs プロジェクト: UIKit0/ClearCanvas
        public bool Start()
        {
            lock (_lockRunningState)
            {
                if (RunningState.Running == _runningState || RunningState.Transition == _runningState)
                    return (RunningState.Running == _runningState);

                _runningState = RunningState.Transition;
            }

            // create the AppDomain that the shred object will be instantiated in
            _domain = AppDomain.CreateDomain(_startupInfo.ShredTypeName);
            _shredObject = (IShred)_domain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);
            
            // cache the shred's details so that even if the shred is stopped and unloaded
            // we still have it's display name 
            _shredCacheObject = new ShredCacheObject(_shredObject.GetDisplayName(), _shredObject.GetDescription());
            
            // create the thread and start it
            _thread = new Thread(new ParameterizedThreadStart(StartupShred));
            _thread.Name = String.Format("{0}", _shredCacheObject.GetDisplayName());
            _thread.Start(this);

            lock (_lockRunningState)
            {
                _runningState = RunningState.Running;
            }

            return (RunningState.Running == _runningState);
        }
コード例 #2
0
ファイル: ShredController.cs プロジェクト: 1059444127/XA
        public bool Start()
        {
            lock (_lockRunningState)
            {
                if (RunningState.Running == _runningState || RunningState.Transition == _runningState)
                {
                    return(RunningState.Running == _runningState);
                }

                _runningState = RunningState.Transition;
            }

            // cache the shred's details so that even if the shred is stopped and unloaded
            // we still have it's display name
            _shredCacheObject = new ShredCacheObject(_shredObject.GetDisplayName(), _shredObject.GetDescription());

            // create the thread and start it
            _thread = new Thread(StartupShred)
            {
                Name = string.Format("{0}", _shredCacheObject.GetDisplayName())
            };

            _thread.Start(this);

            lock (_lockRunningState)
            {
                _runningState = RunningState.Running;
            }

            return(RunningState.Running == _runningState);
        }
コード例 #3
0
        public bool Start()
        {
            lock (_lockRunningState)
            {
                if (RunningState.Running == _runningState || RunningState.Transition == _runningState)
                {
                    return(RunningState.Running == _runningState);
                }

                _runningState = RunningState.Transition;
            }

            // create the AppDomain that the shred object will be instantiated in
            _domain      = AppDomain.CreateDomain(_startupInfo.ShredTypeName);
            _shredObject = (IShred)_domain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);

            // cache the shred's details so that even if the shred is stopped and unloaded
            // we still have it's display name
            _shredCacheObject = new ShredCacheObject(_shredObject.GetDisplayName(), _shredObject.GetDescription());

            // create the thread and start it
            _thread      = new Thread(new ParameterizedThreadStart(StartupShred));
            _thread.Name = String.Format("{0}", _shredCacheObject.GetDisplayName());
            _thread.Start(this);

            lock (_lockRunningState)
            {
                _runningState = RunningState.Running;
            }

            return(RunningState.Running == _runningState);
        }
コード例 #4
0
ファイル: ShredController.cs プロジェクト: bangush/server-1
        public bool Start()
        {
            lock (_lockRunningState)
            {
                if (RunningState.Running == _runningState || RunningState.Transition == _runningState)
                {
                    return(RunningState.Running == _runningState);
                }

                _runningState = RunningState.Transition;
            }

            if (_startupInfo.IsolationLevel == ShredIsolationLevel.OwnAppDomain)
            {
                _domain      = AppDomain.CreateDomain(_startupInfo.ShredTypeName);
                _shredObject = (IShred)_domain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);
            }
            else
            {
                _shredObject = (IShred)AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);
            }

            // cache the shred's details so that even if the shred is stopped and unloaded
            // we still have it's display name
            _shredCacheObject = new ShredCacheObject(_shredObject.GetDisplayName(), _shredObject.GetDescription());

            // create the thread and start it
            _thread = new Thread(StartupShred)
            {
                Name = String.Format("{0}", _shredCacheObject.GetDisplayName())
            };

            _thread.Start(this);

            lock (_lockRunningState)
            {
                _runningState = RunningState.Running;
            }

            return(RunningState.Running == _runningState);
        }
コード例 #5
0
		public bool Start()
		{
			lock (_lockRunningState)
			{
				if (RunningState.Running == _runningState || RunningState.Transition == _runningState)
					return (RunningState.Running == _runningState);

				_runningState = RunningState.Transition;
			}

			if (_startupInfo.IsolationLevel == ShredIsolationLevel.OwnAppDomain)
			{
				_domain = AppDomain.CreateDomain(_startupInfo.ShredTypeName);
				_shredObject = (IShred) _domain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);
			}
			else
			{
				_shredObject = (IShred) AppDomain.CurrentDomain.CreateInstanceFromAndUnwrap(_startupInfo.AssemblyPath.LocalPath, _startupInfo.ShredTypeName);
			}

			// cache the shred's details so that even if the shred is stopped and unloaded
			// we still have it's display name 
			_shredCacheObject = new ShredCacheObject(_shredObject.GetDisplayName(), _shredObject.GetDescription());

			// create the thread and start it
			_thread = new Thread(StartupShred)
			          	{
			          		Name = String.Format("{0}", _shredCacheObject.GetDisplayName())
			          	};

			_thread.Start(this);

			lock (_lockRunningState)
			{
				_runningState = RunningState.Running;
			}

			return (RunningState.Running == _runningState);
		}