diff options
-rw-r--r-- | cs/config/Make.rules | 20 | ||||
-rwxr-xr-x | cs/src/Ice/Connection.cs | 12 | ||||
-rwxr-xr-x | cs/src/Ice/Instance.cs | 1192 | ||||
-rw-r--r-- | cs/src/Ice/ObjectPrxHelperBase.cs | 3 | ||||
-rw-r--r-- | cs/test/Ice/exceptions/.depend | 1 | ||||
-rw-r--r-- | cs/test/Ice/exceptions/Makefile | 10 | ||||
-rw-r--r-- | cs/test/Ice/operations/.depend | 1 | ||||
-rw-r--r-- | cs/test/Ice/operations/Makefile | 14 | ||||
-rw-r--r-- | cs/test/Ice/slicing/exceptions/.depend | 4 | ||||
-rw-r--r-- | cs/test/Ice/slicing/exceptions/Makefile | 12 | ||||
-rw-r--r-- | cs/test/Ice/slicing/objects/.depend | 7 | ||||
-rw-r--r-- | cs/test/Ice/slicing/objects/Makefile | 12 |
12 files changed, 657 insertions, 631 deletions
diff --git a/cs/config/Make.rules b/cs/config/Make.rules index 3de02ccf65a..61bb19cc263 100644 --- a/cs/config/Make.rules +++ b/cs/config/Make.rules @@ -103,6 +103,8 @@ SLICE2CS = slice2cs GEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_SRCS)))) CGEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_C_SRCS)))) SGEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_S_SRCS)))) +GEN_AMD_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_AMD_SRCS)))) +SAMD_GEN_SRCS = $(subst .ice,.cs,$(addprefix $(GDIR)/,$(notdir $(SLICE_SAMD_SRCS)))) EVERYTHING = all depend clean install @@ -117,7 +119,7 @@ $(GDIR)/%.cs: $(SDIR)/%.ice all:: $(TARGETS) -depend:: $(SLICE_SRCS) $(SLICE_C_SRCS) $(SLICE_S_SRCS) +depend:: $(SLICE_SRCS) $(SLICE_C_SRCS) $(SLICE_S_SRCS) $(SLICE_AMD_SRCS) $(SLICE_SAMD_SRCS) echo "slicedir: $(slicedir)" -rm -f .depend if test -n "$(SLICE_SRCS)" ; then \ @@ -132,6 +134,14 @@ depend:: $(SLICE_SRCS) $(SLICE_C_SRCS) $(SLICE_S_SRCS) $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_S_SRCS) | \ $(top_srcdir)/config/makedepend.py >> .depend; \ fi + if test -n "$(SLICE_AMD_SRCS)" ; then \ + $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_AMD_SRCS) | \ + $(top_srcdir)/config/makedepend.py >> .depend; \ + fi + if test -n "$(SLICE_SAMD_SRCS)" ; then \ + $(SLICE2CS) --depend $(SLICE2CSFLAGS) $(SLICE_SAMD_SRCS) | \ + $(top_srcdir)/config/makedepend.py >> .depend; \ + fi clean:: -rm -f $(TARGETS) *.bak @@ -148,5 +158,13 @@ ifneq ($(SLICE_S_SRCS),) clean:: -rm -f $(SGEN_SRCS) endif +ifneq ($(SLICE_AMD_SRCS),) +clean:: + -rm -f $(GEN_AMD_SRCS) +endif +ifneq ($(SLICE_SAMD_SRCS),) +clean:: + -rm -f $(SAMD_GEN_SRCS) +endif install:: diff --git a/cs/src/Ice/Connection.cs b/cs/src/Ice/Connection.cs index 546f17399fd..388d9a4a3c1 100755 --- a/cs/src/Ice/Connection.cs +++ b/cs/src/Ice/Connection.cs @@ -1617,26 +1617,14 @@ namespace IceInternal _dispatchCount == 0; } -#if __MonoCS__ - private /* volatile */ Transceiver _transceiver; // Mono Beta 1 bug: mcs can't handle volatile interfaces. -#else private volatile Transceiver _transceiver; -#endif private volatile string _desc; -#if __MonoCS__ - private /* volatile */ Endpoint _endpoint; // Mono Beta 1 bug: mcs can't handle volatile interfaces. -#else private volatile Endpoint _endpoint; -#endif private Ice.ObjectAdapter _adapter; private ServantManager _servantManager; -#if __MonoCS__ - private /* volatile */ Ice.Logger _logger; // Mono Beta 1 bug: mcs can't handle volatile interfaces. -#else private volatile Ice.Logger _logger; -#endif private volatile TraceLevels _traceLevels; private bool _registeredWithPool; diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs index 4cc767b7f6b..595a570b9e0 100755 --- a/cs/src/Ice/Instance.cs +++ b/cs/src/Ice/Instance.cs @@ -7,601 +7,597 @@ // // ********************************************************************** -
-namespace IceInternal
-{
-
- using System.Diagnostics;
-
- public class Instance
- {
- public virtual Ice.Properties properties()
- {
- // No mutex lock, immutable.
- return _properties;
- }
-
- public virtual Ice.Logger logger()
- {
- lock(this)
- {
- //
- // Don't throw CommunicatorDestroyedException if destroyed. We
- // need the logger also after destructions.
- //
- return _logger;
- }
- }
-
- public virtual void logger(Ice.Logger logger)
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- _logger = logger;
- }
- }
-
- public virtual Ice.Stats stats()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _stats;
- }
- }
-
- public virtual void stats(Ice.Stats stats)
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- _stats = stats;
- }
- }
-
- public virtual TraceLevels traceLevels()
- {
- // No mutex lock, immutable.
- return _traceLevels;
- }
-
- public virtual DefaultsAndOverrides defaultsAndOverrides()
- {
- // No mutex lock, immutable.
- return _defaultsAndOverrides;
- }
-
- public virtual RouterManager routerManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _routerManager;
- }
- }
-
- public virtual LocatorManager locatorManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _locatorManager;
- }
- }
-
- public virtual ReferenceFactory referenceFactory()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _referenceFactory;
- }
- }
-
- public virtual ProxyFactory proxyFactory()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _proxyFactory;
- }
- }
-
- public virtual OutgoingConnectionFactory outgoingConnectionFactory()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _outgoingConnectionFactory;
- }
- }
-
- public virtual ConnectionMonitor connectionMonitor()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _connectionMonitor;
- }
- }
-
- public virtual ObjectFactoryManager servantFactoryManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _servantFactoryManager;
- }
- }
-
- public virtual UserExceptionFactoryManager userExceptionFactoryManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _userExceptionFactoryManager;
- }
- }
-
- public virtual ObjectAdapterFactory objectAdapterFactory()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _objectAdapterFactory;
- }
- }
-
- public virtual ThreadPool clientThreadPool()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- if(_clientThreadPool == null) // Lazy initialization.
- {
- _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0);
- }
-
- return _clientThreadPool;
- }
- }
-
- public virtual ThreadPool serverThreadPool()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- if(_serverThreadPool == null)
- // Lazy initialization.
- {
- int timeout = _properties.getPropertyAsInt("Ice.ServerIdleTime");
- _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout);
- }
-
- return _serverThreadPool;
- }
- }
-
- public virtual EndpointFactoryManager endpointFactoryManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _endpointFactoryManager;
- }
- }
-
- public virtual Ice.PluginManager pluginManager()
- {
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- return _pluginManager;
- }
- }
-
- public virtual int messageSizeMax()
- {
- // No mutex lock, immutable.
- return _messageSizeMax;
- }
-
- public int connectionIdleTime()
- {
- // No mutex lock, immutable.
- return _connectionIdleTime;
- }
-
- public virtual void flushBatchRequests()
- {
- OutgoingConnectionFactory connectionFactory;
- ObjectAdapterFactory adapterFactory;
-
- lock(this)
- {
- if(_destroyed)
- {
- throw new Ice.CommunicatorDestroyedException();
- }
-
- connectionFactory = _outgoingConnectionFactory;
- adapterFactory = _objectAdapterFactory;
- }
-
- connectionFactory.flushBatchRequests();
- adapterFactory.flushBatchRequests();
- }
-
- public virtual BufferManager bufferManager()
- {
- // No mutex lock, immutable.
- return _bufferManager;
- }
-
- //
- // Only for use by Ice.CommunicatorI
- //
- public Instance(Ice.Communicator communicator, Ice.Properties properties)
- {
- _destroyed = false;
- _properties = properties;
-
- try
- {
- if(_properties.getPropertyAsInt("Ice.UseSyslog") > 0)
- {
- _logger = new Ice.SysLoggerI(_properties.getProperty("Ice.ProgramName"));
- }
- else
- {
- _logger = new Ice.LoggerI(_properties.getProperty("Ice.ProgramName"),
- _properties.getPropertyAsInt("Ice.Logger.Timestamp") > 0);
- }
-
- _stats = null; // There is no default statistics callback object.
-
- _traceLevels = new TraceLevels(_properties);
-
- _defaultsAndOverrides = new DefaultsAndOverrides(_properties);
-
- {
- const int defaultMessageSizeMax = 1024;
- int num = _properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax);
- if(num < 1)
- {
- _messageSizeMax = defaultMessageSizeMax * 1024; // Ignore stupid values.
- }
- else if(num > 0x7fffffff / 1024)
- {
- _messageSizeMax = 0x7fffffff;
- }
- else
- {
- _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes
- }
- }
-
- {
- int num = _properties.getPropertyAsIntWithDefault("Ice.ConnectionIdleTime", 60);
- if(num < 0)
- {
- _connectionIdleTime = 0;
- }
- else
- {
- _connectionIdleTime = num;
- }
- }
-
- _routerManager = new RouterManager();
-
- _locatorManager = new LocatorManager();
-
- _referenceFactory = new ReferenceFactory(this);
-
- _proxyFactory = new ProxyFactory(this);
-
- _endpointFactoryManager = new EndpointFactoryManager(this);
- EndpointFactory tcpEndpointFactory = new TcpEndpointFactory(this);
- _endpointFactoryManager.add(tcpEndpointFactory);
- EndpointFactory udpEndpointFactory = new UdpEndpointFactory(this);
- _endpointFactoryManager.add(udpEndpointFactory);
-
- _pluginManager = new Ice.PluginManagerI(communicator);
-
- _outgoingConnectionFactory = new OutgoingConnectionFactory(this);
-
- _servantFactoryManager = new ObjectFactoryManager();
-
- _userExceptionFactoryManager = new UserExceptionFactoryManager();
-
- _objectAdapterFactory = new ObjectAdapterFactory(this, communicator);
-
- _bufferManager = new BufferManager(); // Must be created before the ThreadPool
- }
- catch(Ice.LocalException ex)
- {
- destroy();
- throw ex;
- }
- }
-
- ~Instance()
- {
- Debug.Assert(_destroyed);
- Debug.Assert(_referenceFactory == null);
- Debug.Assert(_proxyFactory == null);
- Debug.Assert(_outgoingConnectionFactory == null);
- Debug.Assert(_connectionMonitor == null);
- Debug.Assert(_servantFactoryManager == null);
- Debug.Assert(_userExceptionFactoryManager == null);
- Debug.Assert(_objectAdapterFactory == null);
- Debug.Assert(_clientThreadPool == null);
- Debug.Assert(_serverThreadPool == null);
- Debug.Assert(_routerManager == null);
- Debug.Assert(_locatorManager == null);
- Debug.Assert(_endpointFactoryManager == null);
- Debug.Assert(_pluginManager == null);
- }
-
- public virtual void finishSetup(ref string[] args)
- {
- //
- // Load plug-ins.
- //
- Ice.PluginManagerI pluginManagerImpl = (Ice.PluginManagerI)_pluginManager;
- pluginManagerImpl.loadPlugins(ref args);
-
- //
- // Get default router and locator proxies. Don't move this
- // initialization before the plug-in initialization!!! The proxies
- // might depend on endpoint factories to be installed by plug-ins.
- //
- if(_defaultsAndOverrides.defaultRouter.Length > 0)
- {
- _referenceFactory.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast(
- _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultRouter)));
- }
-
- if(_defaultsAndOverrides.defaultLocator.Length > 0)
- {
- _referenceFactory.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast(
- _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultLocator)));
- }
-
- //
- // Show process id if requested.
- //
- if(_properties.getPropertyAsInt("Ice.PrintProcessId") > 0)
- {
- System.Console.WriteLine(Process.GetCurrentProcess().Id);
- }
-
- //
- // Start connection monitor if necessary.
- //
- int interval = _properties.getPropertyAsIntWithDefault("Ice.MonitorConnections", _connectionIdleTime);
- if(interval > 0)
- {
- _connectionMonitor = new ConnectionMonitor(this, interval);
- }
-
- //
- // Thread pool initialization is now lazy initialization in
- // clientThreadPool() and serverThreadPool().
- //
- }
-
- //
- // Only for use by Ice.CommunicatorI
- //
- public virtual void destroy()
- {
- Debug.Assert(!_destroyed);
-
- if(_objectAdapterFactory != null)
- {
- _objectAdapterFactory.shutdown();
- }
-
- if(_outgoingConnectionFactory != null)
- {
- _outgoingConnectionFactory.destroy();
- }
-
- if(_objectAdapterFactory != null)
- {
- _objectAdapterFactory.waitForShutdown();
- }
-
- if(_outgoingConnectionFactory != null)
- {
- _outgoingConnectionFactory.waitUntilFinished();
- }
-
- ThreadPool serverThreadPool = null;
- ThreadPool clientThreadPool = null;
-
- lock(this)
- {
- _objectAdapterFactory = null;
-
- _outgoingConnectionFactory = 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(_servantFactoryManager != null)
- {
- _servantFactoryManager.destroy();
- _servantFactoryManager = null;
- }
-
- if(_userExceptionFactoryManager != null)
- {
- _userExceptionFactoryManager.destroy();
- _userExceptionFactoryManager = 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;
- }
-
- _destroyed = true;
- }
-
- //
- // Join with the thread pool threads outside the
- // synchronization.
- //
- if(clientThreadPool != null)
- {
- clientThreadPool.joinWithAllThreads();
- }
- if(serverThreadPool != null)
- {
- serverThreadPool.joinWithAllThreads();
- }
- }
-
- private bool _destroyed;
-#if __MonoCS__
- private /* volatile */ Ice.Properties _properties; // Mono Beta 1 bug: mcs can't handle volatile interfaces.
-#else
- private volatile Ice.Properties _properties; // Immutable, not reset by destroy().
-#endif
- private Ice.Logger _logger; // Not reset by destroy().
- private Ice.Stats _stats; // Not reset by destroy().
- private volatile TraceLevels _traceLevels; // Immutable, not reset by destroy().
- private volatile DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy().
- private volatile int _messageSizeMax; // Immutable, not reset by destroy().
- private volatile int _connectionIdleTime; // Immutable, not reset by destroy().
- private RouterManager _routerManager;
- private LocatorManager _locatorManager;
- private ReferenceFactory _referenceFactory;
- private ProxyFactory _proxyFactory;
- private OutgoingConnectionFactory _outgoingConnectionFactory;
- private ConnectionMonitor _connectionMonitor;
- private ObjectFactoryManager _servantFactoryManager;
- private UserExceptionFactoryManager _userExceptionFactoryManager;
- private ObjectAdapterFactory _objectAdapterFactory;
- private ThreadPool _clientThreadPool;
- private ThreadPool _serverThreadPool;
- private EndpointFactoryManager _endpointFactoryManager;
- private Ice.PluginManager _pluginManager;
- private volatile BufferManager _bufferManager; // Immutable, not reset by destroy().
- }
-
-}
+ +namespace IceInternal +{ + + using System.Diagnostics; + + public class Instance + { + public virtual Ice.Properties properties() + { + // No mutex lock, immutable. + return _properties; + } + + public virtual Ice.Logger logger() + { + lock(this) + { + // + // Don't throw CommunicatorDestroyedException if destroyed. We + // need the logger also after destructions. + // + return _logger; + } + } + + public virtual void logger(Ice.Logger logger) + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + _logger = logger; + } + } + + public virtual Ice.Stats stats() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _stats; + } + } + + public virtual void stats(Ice.Stats stats) + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + _stats = stats; + } + } + + public virtual TraceLevels traceLevels() + { + // No mutex lock, immutable. + return _traceLevels; + } + + public virtual DefaultsAndOverrides defaultsAndOverrides() + { + // No mutex lock, immutable. + return _defaultsAndOverrides; + } + + public virtual RouterManager routerManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _routerManager; + } + } + + public virtual LocatorManager locatorManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _locatorManager; + } + } + + public virtual ReferenceFactory referenceFactory() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _referenceFactory; + } + } + + public virtual ProxyFactory proxyFactory() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _proxyFactory; + } + } + + public virtual OutgoingConnectionFactory outgoingConnectionFactory() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _outgoingConnectionFactory; + } + } + + public virtual ConnectionMonitor connectionMonitor() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _connectionMonitor; + } + } + + public virtual ObjectFactoryManager servantFactoryManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _servantFactoryManager; + } + } + + public virtual UserExceptionFactoryManager userExceptionFactoryManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _userExceptionFactoryManager; + } + } + + public virtual ObjectAdapterFactory objectAdapterFactory() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _objectAdapterFactory; + } + } + + public virtual ThreadPool clientThreadPool() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + if(_clientThreadPool == null) // Lazy initialization. + { + _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0); + } + + return _clientThreadPool; + } + } + + public virtual ThreadPool serverThreadPool() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + if(_serverThreadPool == null) + // Lazy initialization. + { + int timeout = _properties.getPropertyAsInt("Ice.ServerIdleTime"); + _serverThreadPool = new ThreadPool(this, "Ice.ThreadPool.Server", timeout); + } + + return _serverThreadPool; + } + } + + public virtual EndpointFactoryManager endpointFactoryManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _endpointFactoryManager; + } + } + + public virtual Ice.PluginManager pluginManager() + { + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + return _pluginManager; + } + } + + public virtual int messageSizeMax() + { + // No mutex lock, immutable. + return _messageSizeMax; + } + + public int connectionIdleTime() + { + // No mutex lock, immutable. + return _connectionIdleTime; + } + + public virtual void flushBatchRequests() + { + OutgoingConnectionFactory connectionFactory; + ObjectAdapterFactory adapterFactory; + + lock(this) + { + if(_destroyed) + { + throw new Ice.CommunicatorDestroyedException(); + } + + connectionFactory = _outgoingConnectionFactory; + adapterFactory = _objectAdapterFactory; + } + + connectionFactory.flushBatchRequests(); + adapterFactory.flushBatchRequests(); + } + + public virtual BufferManager bufferManager() + { + // No mutex lock, immutable. + return _bufferManager; + } + + // + // Only for use by Ice.CommunicatorI + // + public Instance(Ice.Communicator communicator, Ice.Properties properties) + { + _destroyed = false; + _properties = properties; + + try + { + if(_properties.getPropertyAsInt("Ice.UseSyslog") > 0) + { + _logger = new Ice.SysLoggerI(_properties.getProperty("Ice.ProgramName")); + } + else + { + _logger = new Ice.LoggerI(_properties.getProperty("Ice.ProgramName"), + _properties.getPropertyAsInt("Ice.Logger.Timestamp") > 0); + } + + _stats = null; // There is no default statistics callback object. + + _traceLevels = new TraceLevels(_properties); + + _defaultsAndOverrides = new DefaultsAndOverrides(_properties); + + { + const int defaultMessageSizeMax = 1024; + int num = _properties.getPropertyAsIntWithDefault("Ice.MessageSizeMax", defaultMessageSizeMax); + if(num < 1) + { + _messageSizeMax = defaultMessageSizeMax * 1024; // Ignore stupid values. + } + else if(num > 0x7fffffff / 1024) + { + _messageSizeMax = 0x7fffffff; + } + else + { + _messageSizeMax = num * 1024; // Property is in kilobytes, _messageSizeMax in bytes + } + } + + { + int num = _properties.getPropertyAsIntWithDefault("Ice.ConnectionIdleTime", 60); + if(num < 0) + { + _connectionIdleTime = 0; + } + else + { + _connectionIdleTime = num; + } + } + + _routerManager = new RouterManager(); + + _locatorManager = new LocatorManager(); + + _referenceFactory = new ReferenceFactory(this); + + _proxyFactory = new ProxyFactory(this); + + _endpointFactoryManager = new EndpointFactoryManager(this); + EndpointFactory tcpEndpointFactory = new TcpEndpointFactory(this); + _endpointFactoryManager.add(tcpEndpointFactory); + EndpointFactory udpEndpointFactory = new UdpEndpointFactory(this); + _endpointFactoryManager.add(udpEndpointFactory); + + _pluginManager = new Ice.PluginManagerI(communicator); + + _outgoingConnectionFactory = new OutgoingConnectionFactory(this); + + _servantFactoryManager = new ObjectFactoryManager(); + + _userExceptionFactoryManager = new UserExceptionFactoryManager(); + + _objectAdapterFactory = new ObjectAdapterFactory(this, communicator); + + _bufferManager = new BufferManager(); // Must be created before the ThreadPool + } + catch(Ice.LocalException ex) + { + destroy(); + throw ex; + } + } + + ~Instance() + { + Debug.Assert(_destroyed); + Debug.Assert(_referenceFactory == null); + Debug.Assert(_proxyFactory == null); + Debug.Assert(_outgoingConnectionFactory == null); + Debug.Assert(_connectionMonitor == null); + Debug.Assert(_servantFactoryManager == null); + Debug.Assert(_userExceptionFactoryManager == null); + Debug.Assert(_objectAdapterFactory == null); + Debug.Assert(_clientThreadPool == null); + Debug.Assert(_serverThreadPool == null); + Debug.Assert(_routerManager == null); + Debug.Assert(_locatorManager == null); + Debug.Assert(_endpointFactoryManager == null); + Debug.Assert(_pluginManager == null); + } + + public virtual void finishSetup(ref string[] args) + { + // + // Load plug-ins. + // + Ice.PluginManagerI pluginManagerImpl = (Ice.PluginManagerI)_pluginManager; + pluginManagerImpl.loadPlugins(ref args); + + // + // Get default router and locator proxies. Don't move this + // initialization before the plug-in initialization!!! The proxies + // might depend on endpoint factories to be installed by plug-ins. + // + if(_defaultsAndOverrides.defaultRouter.Length > 0) + { + _referenceFactory.setDefaultRouter(Ice.RouterPrxHelper.uncheckedCast( + _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultRouter))); + } + + if(_defaultsAndOverrides.defaultLocator.Length > 0) + { + _referenceFactory.setDefaultLocator(Ice.LocatorPrxHelper.uncheckedCast( + _proxyFactory.stringToProxy(_defaultsAndOverrides.defaultLocator))); + } + + // + // Show process id if requested. + // + if(_properties.getPropertyAsInt("Ice.PrintProcessId") > 0) + { + System.Console.WriteLine(Process.GetCurrentProcess().Id); + } + + // + // Start connection monitor if necessary. + // + int interval = _properties.getPropertyAsIntWithDefault("Ice.MonitorConnections", _connectionIdleTime); + if(interval > 0) + { + _connectionMonitor = new ConnectionMonitor(this, interval); + } + + // + // Thread pool initialization is now lazy initialization in + // clientThreadPool() and serverThreadPool(). + // + } + + // + // Only for use by Ice.CommunicatorI + // + public virtual void destroy() + { + Debug.Assert(!_destroyed); + + if(_objectAdapterFactory != null) + { + _objectAdapterFactory.shutdown(); + } + + if(_outgoingConnectionFactory != null) + { + _outgoingConnectionFactory.destroy(); + } + + if(_objectAdapterFactory != null) + { + _objectAdapterFactory.waitForShutdown(); + } + + if(_outgoingConnectionFactory != null) + { + _outgoingConnectionFactory.waitUntilFinished(); + } + + ThreadPool serverThreadPool = null; + ThreadPool clientThreadPool = null; + + lock(this) + { + _objectAdapterFactory = null; + + _outgoingConnectionFactory = 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(_servantFactoryManager != null) + { + _servantFactoryManager.destroy(); + _servantFactoryManager = null; + } + + if(_userExceptionFactoryManager != null) + { + _userExceptionFactoryManager.destroy(); + _userExceptionFactoryManager = 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; + } + + _destroyed = true; + } + + // + // Join with the thread pool threads outside the + // synchronization. + // + if(clientThreadPool != null) + { + clientThreadPool.joinWithAllThreads(); + } + if(serverThreadPool != null) + { + serverThreadPool.joinWithAllThreads(); + } + } + + private bool _destroyed; + private volatile Ice.Properties _properties; // Immutable, not reset by destroy(). + private Ice.Logger _logger; // Not reset by destroy(). + private Ice.Stats _stats; // Not reset by destroy(). + private volatile TraceLevels _traceLevels; // Immutable, not reset by destroy(). + private volatile DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy(). + private volatile int _messageSizeMax; // Immutable, not reset by destroy(). + private volatile int _connectionIdleTime; // Immutable, not reset by destroy(). + private RouterManager _routerManager; + private LocatorManager _locatorManager; + private ReferenceFactory _referenceFactory; + private ProxyFactory _proxyFactory; + private OutgoingConnectionFactory _outgoingConnectionFactory; + private ConnectionMonitor _connectionMonitor; + private ObjectFactoryManager _servantFactoryManager; + private UserExceptionFactoryManager _userExceptionFactoryManager; + private ObjectAdapterFactory _objectAdapterFactory; + private ThreadPool _clientThreadPool; + private ThreadPool _serverThreadPool; + private EndpointFactoryManager _endpointFactoryManager; + private Ice.PluginManager _pluginManager; + private volatile BufferManager _bufferManager; // Immutable, not reset by destroy(). + } + +} diff --git a/cs/src/Ice/ObjectPrxHelperBase.cs b/cs/src/Ice/ObjectPrxHelperBase.cs index 3ab42286e7c..c3c28a295b4 100644 --- a/cs/src/Ice/ObjectPrxHelperBase.cs +++ b/cs/src/Ice/ObjectPrxHelperBase.cs @@ -141,9 +141,6 @@ namespace Ice public bool ice_invoke(string operation, OperationMode mode, byte[] inParams, out byte[] outParams, Context context) { -#if __MonoCS__ - outParams = null; // MCS COMPILERBUG -#endif int __cnt = 0; while(true) { diff --git a/cs/test/Ice/exceptions/.depend b/cs/test/Ice/exceptions/.depend index e9de87da7f8..582d0d10a8d 100644 --- a/cs/test/Ice/exceptions/.depend +++ b/cs/test/Ice/exceptions/.depend @@ -1 +1,2 @@ generated/Test.cs: ./Test.ice +generated/TestAMD.cs: ./TestAMD.ice diff --git a/cs/test/Ice/exceptions/Makefile b/cs/test/Ice/exceptions/Makefile index ab82c92d70c..5314b00c4f4 100644 --- a/cs/test/Ice/exceptions/Makefile +++ b/cs/test/Ice/exceptions/Makefile @@ -9,14 +9,15 @@ top_srcdir = ../../.. -TARGETS = client.exe server.exe collocated.exe +TARGETS = client.exe server.exe collocated.exe serveramd.exe C_SRCS = AllTests.cs Client.cs EmptyI.cs ObjectFactoryI.cs ServantLocatorI.cs S_SRCS = EmptyI.cs ObjectFactoryI.cs ServantLocatorI.cs Server.cs ThrowerI.cs COL_SRCS = AllTests.cs Collocated.cs EmptyI.cs ObjectFactoryI.cs ServantLocatorI.cs ThrowerI.cs +SAMD_SRCS = EmptyI.cs ObjectFactoryI.cs ServantLocatorI.cs Server.cs ThrowerAMDI.cs -SLICE_SRCS = $(SDIR)/Test.ice \ - $(SDIR)/TestAMD.ice +SLICE_SRCS = $(SDIR)/Test.ice +SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice SDIR = . @@ -37,6 +38,9 @@ server.exe: $(S_SRCS) $(GEN_SRCS) collocated.exe: $(COL_SRCS) $(GEN_SRCS) $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ +serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ + install:: all $(INSTALL) $(libdir)/$(LIBNAME) $(install_libdir) diff --git a/cs/test/Ice/operations/.depend b/cs/test/Ice/operations/.depend index b3564835d0c..3c391cd1960 100644 --- a/cs/test/Ice/operations/.depend +++ b/cs/test/Ice/operations/.depend @@ -1 +1,2 @@ generated/Test.cs: ./Test.ice ../../../../ice/slice/Ice/Current.ice ../../../../ice/slice/Ice/ObjectAdapterF.ice ../../../../ice/slice/Ice/Identity.ice +generated/TestAMD.cs: ./TestAMD.ice ../../../../ice/slice/Ice/Current.ice ../../../../ice/slice/Ice/ObjectAdapterF.ice ../../../../ice/slice/Ice/Identity.ice diff --git a/cs/test/Ice/operations/Makefile b/cs/test/Ice/operations/Makefile index 77f33df0a2d..7d1549c3924 100644 --- a/cs/test/Ice/operations/Makefile +++ b/cs/test/Ice/operations/Makefile @@ -9,14 +9,15 @@ top_srcdir = ../../.. -TARGETS = client.exe server.exe collocated.exe +TARGETS = client.exe server.exe collocated.exe serveramd.exe -C_SRCS = AllTests.cs Client.cs Twoways.cs # TwowaysAMI.cs +C_SRCS = AllTests.cs Client.cs Twoways.cs TwowaysAMI.cs S_SRCS = MyDerivedClassI.cs Server.cs -COL_SRCS = AllTests.cs Collocated.cs MyDerivedClassI.cs Twoways.cs # TwowaysAMI.cs +COL_SRCS = AllTests.cs Collocated.cs MyDerivedClassI.cs Twoways.cs TwowaysAMI.cs +SAMD_SRCS = MyDerivedClassAMDI.cs Server.cs -SLICE_SRCS = $(SDIR)/Test.ice \ - $(SDIR)/TestAMD.ice +SLICE_SRCS = $(SDIR)/Test.ice +SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice SDIR = . @@ -37,6 +38,9 @@ server.exe: $(S_SRCS) $(GEN_SRCS) collocated.exe: $(COL_SRCS) $(GEN_SRCS) $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ +serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ + install:: all $(INSTALL) $(libdir)/$(LIBNAME) $(install_libdir) diff --git a/cs/test/Ice/slicing/exceptions/.depend b/cs/test/Ice/slicing/exceptions/.depend index 96e31ebf25d..0e0e756fbe0 100644 --- a/cs/test/Ice/slicing/exceptions/.depend +++ b/cs/test/Ice/slicing/exceptions/.depend @@ -1,2 +1,4 @@ generated/Test.cs: ./Test.ice -generated/ServerPrivate.cs: ServerPrivate.ice Test.ice +generated/ServerPrivate.cs: ./ServerPrivate.ice Test.ice +generated/TestAMD.cs: ./TestAMD.ice +generated/ServerPrivateAMD.cs: ./ServerPrivateAMD.ice TestAMD.ice diff --git a/cs/test/Ice/slicing/exceptions/Makefile b/cs/test/Ice/slicing/exceptions/Makefile index ec88e602a53..e3ee7d373bb 100644 --- a/cs/test/Ice/slicing/exceptions/Makefile +++ b/cs/test/Ice/slicing/exceptions/Makefile @@ -9,13 +9,16 @@ top_srcdir = ../../../.. -TARGETS = client.exe server.exe +TARGETS = client.exe server.exe serveramd.exe C_SRCS = AllTests.cs Client.cs S_SRCS = Server.cs TestI.cs +SAMD_SRCS = Server.cs TestAMDI.cs -SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/TestAMD.ice -SLICE_S_SRCS = ServerPrivate.ice +SLICE_SRCS = $(SDIR)/Test.ice +SLICE_S_SRCS = $(SDIR)/ServerPrivate.ice +SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice +SLICE_SAMD_SRCS = $(SDIR)/ServerPrivateAMD.ice SDIR = . @@ -33,6 +36,9 @@ client.exe: $(C_SRCS) $(GEN_SRCS) server.exe: $(S_SRCS) $(GEN_SRCS) $(SGEN_SRCS) $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ +serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS) $(SAMD_GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ + install:: all $(INSTALL) $(libdir)/$(LIBNAME) $(install_libdir) diff --git a/cs/test/Ice/slicing/objects/.depend b/cs/test/Ice/slicing/objects/.depend index 6219fed91fd..3e6209a7742 100644 --- a/cs/test/Ice/slicing/objects/.depend +++ b/cs/test/Ice/slicing/objects/.depend @@ -1,4 +1,7 @@ generated/Test.cs: ./Test.ice generated/Forward.cs: ./Forward.ice -generated/ClientPrivate.cs: ClientPrivate.ice Test.ice -generated/ServerPrivate.cs: ServerPrivate.ice Test.ice +generated/ClientPrivate.cs: ./ClientPrivate.ice Test.ice +generated/ServerPrivate.cs: ./ServerPrivate.ice Test.ice +generated/TestAMD.cs: ./TestAMD.ice +generated/Forward.cs: ./Forward.ice +generated/ServerPrivateAMD.cs: ./ServerPrivateAMD.ice TestAMD.ice diff --git a/cs/test/Ice/slicing/objects/Makefile b/cs/test/Ice/slicing/objects/Makefile index f598748c2f7..2e29ada4eb6 100644 --- a/cs/test/Ice/slicing/objects/Makefile +++ b/cs/test/Ice/slicing/objects/Makefile @@ -9,14 +9,17 @@ top_srcdir = ../../../.. -TARGETS = client.exe server.exe +TARGETS = client.exe server.exe serveramd.exe C_SRCS = AllTests.cs Client.cs S_SRCS = Server.cs TestI.cs +SAMD_SRCS = Server.cs TestAMDI.cs SLICE_SRCS = $(SDIR)/Test.ice $(SDIR)/Forward.ice -SLICE_C_SRCS = ClientPrivate.ice -SLICE_S_SRCS = ServerPrivate.ice +SLICE_C_SRCS = $(SDIR)/ClientPrivate.ice +SLICE_S_SRCS = $(SDIR)/ServerPrivate.ice +SLICE_AMD_SRCS = $(SDIR)/TestAMD.ice $(SDIR)/Forward.ice +SLICE_SAMD_SRCS = $(SDIR)/ServerPrivateAMD.ice SDIR = . @@ -34,6 +37,9 @@ client.exe: $(C_SRCS) $(GEN_SRCS) $(CGEN_SRCS) server.exe: $(S_SRCS) $(GEN_SRCS) $(SGEN_SRCS) $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ +serveramd.exe: $(SAMD_SRCS) $(GEN_AMD_SRCS) $(SAMD_GEN_SRCS) + $(MCS) $(MCSFLAGS) -out:$@ -r:$(LIBS) $^ + install:: all $(INSTALL) $(libdir)/$(LIBNAME) $(install_libdir) |