/* * ~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); } } }
public void addServantLocator(Ice.ServantLocator locator, string category) { lock (this) { Debug.Assert(_communicator != null); // Must not be called after destruction. if (_locatorMap.ContainsKey(category)) { throw new System.ArgumentException($"A servant locator for category {category} is already registered", nameof(category)); } _locatorMap[category] = locator; } }
override public void activateServantLocator(bool activate, Ice.Current current) { if (activate) { current.adapter.addServantLocator(new ServantLocatorI(""), ""); current.adapter.addServantLocator(new ServantLocatorI("category"), "category"); } else { Ice.ServantLocator locator = current.adapter.removeServantLocator(""); locator.deactivate(""); locator = current.adapter.removeServantLocator("category"); locator.deactivate("category"); } }
public void addServantLocator(Ice.ServantLocator locator, string category) { lock (this) { Debug.Assert(_instance != null); // Must not be called after destruction. Ice.ServantLocator l; _locatorMap.TryGetValue(category, out l); if (l != null) { Ice.AlreadyRegisteredException ex = new Ice.AlreadyRegisteredException(); ex.id = IceUtilInternal.StringUtil.escapeString(category, "", _instance.toStringMode()); ex.kindOfObject = "servant locator"; throw ex; } _locatorMap[category] = locator; } }
/* * ~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); } } }
internal void adopt(IncomingBase inc) { instance_ = inc.instance_; //inc.instance_ = null; // Don't reset instance_. observer_ = inc.observer_; inc.observer_ = null; servant_ = inc.servant_; inc.servant_ = null; locator_ = inc.locator_; inc.locator_ = null; cookie_ = inc.cookie_; inc.cookie_ = null; response_ = inc.response_; inc.response_ = false; compress_ = inc.compress_; inc.compress_ = 0; // // Adopt the stream - it creates less garbage. // os_ = inc.os_; inc.os_ = null; responseHandler_ = inc.responseHandler_; inc.responseHandler_ = null; }
public virtual void reclaim() { servant_ = null; locator_ = null; cookie_ = null; observer_ = null; if(os_ != null) { os_.reset(); } interceptorAsyncCallbackList_ = null; }
public Direct(Ice.Current current, RunDelegate run) { _current = current; _run = run; Ice.ObjectAdapterI adapter = (Ice.ObjectAdapterI)_current.adapter; Debug.Assert(adapter != null); // // Must call incDirectCount() first, because it checks for // adapter deactivation, and prevents deactivation completion // until decDirectCount() is called. This is important, // because getServantManager() may not be called afer // deactivation completion. // adapter.incDirectCount(); ServantManager servantManager = adapter.getServantManager(); Debug.Assert(servantManager != null); _servant = servantManager.findServant(_current.id, _current.facet); if(_servant == null) { _locator = servantManager.findServantLocator(_current.id.category); if(_locator == null && _current.id.category.Length > 0) { _locator = servantManager.findServantLocator(""); } if(_locator != null) { try { _servant = _locator.locate(_current, out _cookie); } catch(System.Exception) { adapter.decDirectCount(); throw; } } } if(_servant == null) { adapter.decDirectCount(); if(servantManager != null && servantManager.hasServant(_current.id)) { Ice.FacetNotExistException ex = new Ice.FacetNotExistException(); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } else { Ice.ObjectNotExistException ex = new Ice.ObjectNotExistException(); ex.id = _current.id; ex.facet = _current.facet; ex.operation = _current.operation; throw ex; } } }