internal HelperThread(AsyncIOThread asyncIOThread) { _asyncIOThread = asyncIOThread; _name = _asyncIOThread._instance.initializationData().properties.getProperty("Ice.ProgramName"); if (_name.Length > 0) { _name += "-"; } _name += "Ice.AsyncIOThread"; }
internal HelperThread(AsyncIOThread asyncIOThread) { _asyncIOThread = asyncIOThread; _name = _asyncIOThread._communicator.GetProperty("Ice.ProgramName") ?? ""; if (_name.Length > 0) { _name += "-"; } _name += "Ice.AsyncIOThread"; }
asyncIOThread() { lock (this) { if (_state == StateDestroyed) { throw new Ice.CommunicatorDestroyedException(); } if (_asyncIOThread == null) // Lazy initialization. { _asyncIOThread = new AsyncIOThread(this); } return(_asyncIOThread); } }
asyncIOThread() { lock(this) { if(_state == StateDestroyed) { throw new Ice.CommunicatorDestroyedException(); } if(_asyncIOThread == null) // Lazy initialization. { _asyncIOThread = new AsyncIOThread(this); } return _asyncIOThread; } }
// // Only for use by Ice.CommunicatorI // public void destroy() { lock(this) { // // If destroy is in progress, wait for it to be done. This // is necessary in case destroy() is called concurrently // by multiple threads. // while(_state == StateDestroyInProgress) { Monitor.Wait(this); } if(_state == StateDestroyed) { return; } _state = StateDestroyInProgress; } // // Shutdown and destroy all the incoming and outgoing Ice // connections and wait for the connections to be finished. // if(_objectAdapterFactory != null) { _objectAdapterFactory.shutdown(); } if(_outgoingConnectionFactory != null) { _outgoingConnectionFactory.destroy(); } if(_objectAdapterFactory != null) { _objectAdapterFactory.destroy(); } if(_outgoingConnectionFactory != null) { _outgoingConnectionFactory.waitUntilFinished(); } if(_retryQueue != null) { _retryQueue.destroy(); // Must be called before destroying thread pools. } if(_initData.observer != null) { _initData.observer.setObserverUpdater(null); } LoggerAdminLogger logger = _initData.logger as LoggerAdminLogger; if(logger != null) { logger.destroy(); } // // Now, destroy the thread pools. This must be done *only* after // all the connections are finished (the connections destruction // can require invoking callbacks with the thread pools). // if(_serverThreadPool != null) { _serverThreadPool.destroy(); } if(_clientThreadPool != null) { _clientThreadPool.destroy(); } if(_asyncIOThread != null) { _asyncIOThread.destroy(); } if(_endpointHostResolver != null) { _endpointHostResolver.destroy(); } // // Wait for all the threads to be finished. // if(_timer != null) { _timer.destroy(); } if(_clientThreadPool != null) { _clientThreadPool.joinWithAllThreads(); } if(_serverThreadPool != null) { _serverThreadPool.joinWithAllThreads(); } if(_asyncIOThread != null) { _asyncIOThread.joinWithThread(); } if(_endpointHostResolver != null) { _endpointHostResolver.joinWithThread(); } foreach(Ice.ObjectFactory factory in _objectFactoryMap.Values) { // Disable Obsolete warning/error #pragma warning disable 612, 618 factory.destroy(); #pragma warning restore 612, 618 } _objectFactoryMap.Clear(); if(_routerManager != null) { _routerManager.destroy(); } if(_locatorManager != null) { _locatorManager.destroy(); } if(_endpointFactoryManager != null) { _endpointFactoryManager.destroy(); } if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { List<string> unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); if (unusedProperties.Count != 0) { StringBuilder message = new StringBuilder("The following properties were set but never read:"); foreach (string s in unusedProperties) { message.Append("\n "); message.Append(s); } _initData.logger.warning(message.ToString()); } } // // Destroy last so that a Logger plugin can receive all log/traces before its destruction. // if(_pluginManager != null) { _pluginManager.destroy(); } lock(this) { _objectAdapterFactory = null; _outgoingConnectionFactory = null; _retryQueue = null; _serverThreadPool = null; _clientThreadPool = null; _asyncIOThread = null; _endpointHostResolver = null; _timer = null; _referenceFactory = null; _requestHandlerFactory = null; _proxyFactory = null; _routerManager = null; _locatorManager = null; _endpointFactoryManager = null; _pluginManager = null; _adminAdapter = null; _adminFacets.Clear(); _state = StateDestroyed; Monitor.PulseAll(this); } }
internal HelperThread(AsyncIOThread asyncIOThread) { _asyncIOThread = asyncIOThread; _name = _asyncIOThread._instance.initializationData().properties.getProperty("Ice.ProgramName"); if(_name.Length > 0) { _name += "-"; } _name += "Ice.AsyncIOThread"; }
// // Only for use by Ice.CommunicatorI // public bool destroy() { lock(this) { // // If the _state is not StateActive then the instance is // either being destroyed, or has already been destroyed. // if(_state != StateActive) { return false; } // // We cannot set state to StateDestroyed otherwise instance // methods called during the destroy process (such as // outgoingConnectionFactory() from // ObjectAdapterI::deactivate() will cause an exception. // _state = StateDestroyInProgress; } if(_objectAdapterFactory != null) { _objectAdapterFactory.shutdown(); } if(_outgoingConnectionFactory != null) { _outgoingConnectionFactory.destroy(); } if(_objectAdapterFactory != null) { _objectAdapterFactory.destroy(); } if(_outgoingConnectionFactory != null) { _outgoingConnectionFactory.waitUntilFinished(); } if(_retryQueue != null) { _retryQueue.destroy(); } ThreadPool serverThreadPool = null; ThreadPool clientThreadPool = null; AsyncIOThread asyncIOThread = null; EndpointHostResolver endpointHostResolver = null; lock(this) { _objectAdapterFactory = null; _outgoingConnectionFactory = null; _retryQueue = null; if(_connectionMonitor != null) { _connectionMonitor.destroy(); _connectionMonitor = null; } if(_serverThreadPool != null) { _serverThreadPool.destroy(); serverThreadPool = _serverThreadPool; _serverThreadPool = null; } if(_clientThreadPool != null) { _clientThreadPool.destroy(); clientThreadPool = _clientThreadPool; _clientThreadPool = null; } if(_asyncIOThread != null) { _asyncIOThread.destroy(); asyncIOThread = _asyncIOThread; _asyncIOThread = null; } if(_endpointHostResolver != null) { _endpointHostResolver.destroy(); endpointHostResolver = _endpointHostResolver; _endpointHostResolver = null; } if(_timer != null) { _timer.destroy(); _timer = null; } if(_servantFactoryManager != null) { _servantFactoryManager.destroy(); _servantFactoryManager = null; } if(_referenceFactory != null) { _referenceFactory.destroy(); _referenceFactory = null; } // No destroy function defined. // _proxyFactory.destroy(); _proxyFactory = null; if(_routerManager != null) { _routerManager.destroy(); _routerManager = null; } if(_locatorManager != null) { _locatorManager.destroy(); _locatorManager = null; } if(_endpointFactoryManager != null) { _endpointFactoryManager.destroy(); _endpointFactoryManager = null; } if(_pluginManager != null) { _pluginManager.destroy(); _pluginManager = null; } _adminAdapter = null; _adminFacets.Clear(); _state = StateDestroyed; } // // Join with threads outside the synchronization. // if(clientThreadPool != null) { clientThreadPool.joinWithAllThreads(); } if(serverThreadPool != null) { serverThreadPool.joinWithAllThreads(); } if(asyncIOThread != null) { asyncIOThread.joinWithThread(); } if(endpointHostResolver != null) { endpointHostResolver.joinWithThread(); } if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { ArrayList unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); if(unusedProperties.Count != 0) { StringBuilder message = new StringBuilder("The following properties were set but never read:"); foreach(string s in unusedProperties) { message.Append("\n "); message.Append(s); } _initData.logger.warning(message.ToString()); } } return true; }