Exemple #1
0
        private void UnregisterRunningObjectInternal(IRegisteredObject obj)
        {
            bool shutdown = false;

            lock (this)
            {
                string fullName = obj.GetType().FullName;
                if (_wellKnownObjects.ContainsKey(fullName) && _wellKnownObjects[fullName] == obj)
                {
                    _wellKnownObjects.Remove(fullName);
                }
                if (_registeredObjects.ContainsKey(obj))
                {
                    _registeredObjects.Remove(obj);
                }
                if (_registeredObjects.Count == 0)
                {
                    shutdown = true;
                }
            }
            if (shutdown)
            {
                InitiateShutdownInternal();
            }
        }
Exemple #2
0
 public bool UnregisterObject(IRegisteredObject obj)
 {
     return(hash.Remove(obj.GetType()));
 }
Exemple #3
0
 public void RegisterObject(IRegisteredObject obj, bool auto_clean)
 {
     hash [obj.GetType()] = new RegisteredItem(obj, auto_clean);
 }
        // unregister protocol handler from hosting environment
        private void UnregisterRunningObjectInternal(IRegisteredObject obj) {
            bool lastOne = false;

            lock (this) {
                // if it is a well known object, remove it from that table as well
                String key = obj.GetType().FullName;
                if (_wellKnownObjects[key] == obj) {
                    _wellKnownObjects.Remove(key);
                }

                // remove from running objects list
                _registeredObjects.Remove(obj);

                ISuspendibleRegisteredObject suspendibleObject = obj as ISuspendibleRegisteredObject;
                if (suspendibleObject != null) {
                    _suspendManager.UnregisterObject(suspendibleObject);
                }

                if (_registeredObjects.Count == 0)
                    lastOne = true;
            }

            if (!lastOne)
                return;

            // shutdown app domain after last protocol handler is gone

            InitiateShutdownInternal();
        }
 private void UnregisterRunningObjectInternal(IRegisteredObject obj)
 {
     bool flag = false;
     lock (this)
     {
         string fullName = obj.GetType().FullName;
         if (this._wellKnownObjects[fullName] == obj)
         {
             this._wellKnownObjects.Remove(fullName);
         }
         this._registeredObjects.Remove(obj);
         if (this._registeredObjects.Count == 0)
         {
             flag = true;
         }
     }
     if (flag)
     {
         this.InitiateShutdownInternal();
     }
 }
 private void UnregisterRunningObjectInternal(IRegisteredObject obj)
 {
     bool shutdown = false;
     lock (this)
     {
         string fullName = obj.GetType().FullName;
         if (_wellKnownObjects.ContainsKey(fullName) && _wellKnownObjects[fullName] == obj)
             _wellKnownObjects.Remove(fullName);
         if (_registeredObjects.ContainsKey(obj))
             _registeredObjects.Remove(obj);
         if (_registeredObjects.Count == 0)
             shutdown = true;
     }
     if (shutdown)
         InitiateShutdownInternal();
 }
		public void RegisterObject (IRegisteredObject obj, bool auto_clean)
		{
			hash [obj.GetType ()] = new RegisteredItem (obj, auto_clean);
		}
		public bool UnregisterObject (IRegisteredObject obj)
		{
			return hash.Remove (obj.GetType ());
		}