Exemplo n.º 1
0
        public void destroy()
        {
            _m.Lock();
            try
            {
                //
                // Another thread is in the process of destroying the object
                // adapter. Wait for it to finish.
                //
                while(_destroying)
                {
                    _m.Wait();
                }

                //
                // Object adpater is already destroyed.
                //
                if(_destroyed)
                {
                    return;
                }

                _destroying = true;
            }
            finally
            {
                _m.Unlock();
            }

            //
            // Deactivate and wait for completion.
            //
            deactivate();
            waitForDeactivate();

            //
            // Now it's also time to clean up our servants and servant
            // locators.
            //
            _servantManager.destroy();

            //
            // Destroy the thread pool.
            //
            if(_threadPool != null)
            {
                _threadPool.destroy();
                _threadPool.joinWithAllThreads();
            }

            IceInternal.ObjectAdapterFactory objectAdapterFactory;

            _m.Lock();
            try
            {
                //
                // Signal that destroying is complete.
                //
                _destroying = false;
                _destroyed = true;
                _m.NotifyAll();

                //
                // We're done, now we can throw away all incoming connection
                // factories.
                //
                _incomingConnectionFactories.Clear();

                //
                // Remove object references (some of them cyclic).
                //
                instance_ = null;
                _threadPool = null;
                _routerEndpoints = null;
                _routerInfo = null;
                _publishedEndpoints = null;
                _locatorInfo = null;
                _reference = null;

                objectAdapterFactory = _objectAdapterFactory;
                _objectAdapterFactory = null;
            }
            finally
            {
                _m.Unlock();
            }

            if(objectAdapterFactory != null)
            {
                objectAdapterFactory.removeObjectAdapter(this);
            }
        }
Exemplo n.º 2
0
        public void setLocator(LocatorPrx locator)
        {
            _m.Lock();
            try
            {
                checkForDeactivation();

                _locatorInfo = instance_.locatorManager().get(locator);
            }
            finally
            {
                _m.Unlock();
            }
        }