Exemplo n.º 1
0
        /*
         * ~ServantManager()
         * {
         *  //
         *  // Don't check whether destroy() has been called. It might have
         *  // not been called if the associated object adapter was not
         *  // properly deactivated.
         *  //
         *  //lock(this)
         *  //{
         *      //IceUtil.Assert.FinalizerAssert(instance_ == null);
         *  //}
         * }
         */

        //
        // Only for use by Ice.ObjectAdapterI.
        //
        public void destroy()
        {
            Dictionary <string, Ice.ServantLocator> locatorMap = null;

            Ice.Logger logger = null;
            lock (this)
            {
                Debug.Assert(instance_ != null); // Must not be called after destruction.
                logger = instance_.initializationData().logger;
                _servantMapMap.Clear();

                locatorMap = new Dictionary <string, Ice.ServantLocator>(_locatorMap);
                _locatorMap.Clear();
                instance_ = null;
            }

            foreach (KeyValuePair <string, Ice.ServantLocator> p in locatorMap)
            {
                Ice.ServantLocator locator = p.Value;
                try
                {
                    locator.deactivate(p.Key);
                }
                catch (System.Exception ex)
                {
                    string s = "exception during locator deactivation:\n" + "object adapter: `"
                               + _adapterName + "'\n" + "locator category: `" + p.Key + "'\n" + ex;
                    logger.error(s);
                }
            }
        }
Exemplo n.º 2
0
        /*
         * ~ServantManager()
         * {
         *  //
         *  // Don't check whether destroy() has been called. It might have
         *  // not been called if the associated object adapter was not
         *  // properly deactivated.
         *  //
         *  //lock(this)
         *  //{
         *      //IceUtil.Assert.FinalizerAssert(_instance == null);
         *  //}
         * }
         */

        //
        // Only for use by Ice.ObjectAdapterI.
        //
        public void destroy()
        {
            Dictionary <string, Ice.ServantLocator> locatorMap = null;

            Ice.Logger logger = null;
            lock (this)
            {
                //
                // If the ServantManager has already been destroyed, we're done.
                //
                if (_instance == null)
                {
                    return;
                }

                logger = _instance.initializationData().logger;

                _servantMapMap.Clear();

                _defaultServantMap.Clear();

                locatorMap = new Dictionary <string, Ice.ServantLocator>(_locatorMap);
                _locatorMap.Clear();

                _instance = null;
            }

            foreach (KeyValuePair <string, Ice.ServantLocator> p in locatorMap)
            {
                Ice.ServantLocator locator = p.Value;
                try
                {
                    locator.deactivate(p.Key);
                }
                catch (System.Exception ex)
                {
                    string s = "exception during locator deactivation:\n" + "object adapter: `"
                               + _adapterName + "'\n" + "locator category: `" + p.Key + "'\n" + ex;
                    logger.error(s);
                }
            }
        }