diff options
Diffstat (limited to 'cs/src/Ice/Instance.cs')
-rw-r--r-- | cs/src/Ice/Instance.cs | 63 |
1 files changed, 46 insertions, 17 deletions
diff --git a/cs/src/Ice/Instance.cs b/cs/src/Ice/Instance.cs index ad04c61b2c3..b9c77cb14d1 100644 --- a/cs/src/Ice/Instance.cs +++ b/cs/src/Ice/Instance.cs @@ -49,7 +49,7 @@ namespace IceInternal return _defaultsAndOverrides; } -#if COMPACT +#if COMPACT || SILVERLIGHT public string[] factoryAssemblies() { return _factoryAssemblies; @@ -233,6 +233,7 @@ namespace IceInternal } } +#if !SILVERLIGHT public EndpointHostResolver endpointHostResolver() { lock(this) @@ -246,7 +247,7 @@ namespace IceInternal return _endpointHostResolver; } } - +#endif public RetryQueue retryQueue() { @@ -601,7 +602,7 @@ namespace IceInternal { _initData.properties = Ice.Util.createProperties(); } - +#if !SILVERLIGHT lock(_staticLock) { if(!_oneOffDone) @@ -655,9 +656,11 @@ namespace IceInternal _oneOffDone = true; } } - +#endif + if(_initData.logger == null) { +#if !SILVERLIGHT string logfile = _initData.properties.getProperty("Ice.LogFile"); if(_initData.properties.getPropertyAsInt("Ice.UseSyslog") > 0) { @@ -676,9 +679,16 @@ namespace IceInternal bool console = _initData.properties.getPropertyAsIntWithDefault("Ice.ConsoleListener", logfile.Length == 0 ? 1 : 0) > 0; - _initData.logger = + _initData.logger = new Ice.TraceLoggerI(_initData.properties.getProperty("Ice.ProgramName"), logfile, console); } +#else + if(Ice.Util.getProcessLogger() is Ice.LoggerI) + { + _initData.logger = + new Ice.TraceLoggerI(_initData.properties.getProperty("Ice.ProgramName"), true); + } +#endif else { _initData.logger = Ice.Util.getProcessLogger(); @@ -689,11 +699,10 @@ namespace IceInternal _defaultsAndOverrides = new DefaultsAndOverrides(_initData.properties); -#if COMPACT +#if COMPACT || SILVERLIGHT char[] separators = { ' ', '\t', '\n', '\r' }; _factoryAssemblies = _initData.properties.getProperty("Ice.FactoryAssemblies").Split(separators); #endif - { const int defaultMessageSizeMax = 1024; int num = @@ -750,8 +759,10 @@ namespace IceInternal _endpointFactoryManager.add(tcpEndpointFactory); EndpointFactory udpEndpointFactory = new UdpEndpointFactory(this); _endpointFactoryManager.add(udpEndpointFactory); - + +#if !SILVERLIGHT _pluginManager = new Ice.PluginManagerI(communicator); +#endif _outgoingConnectionFactory = new OutgoingConnectionFactory(communicator, this); @@ -785,14 +796,17 @@ namespace IceInternal // Load plug-ins. // Debug.Assert(_serverThreadPool == null); +#if !SILVERLIGHT Ice.PluginManagerI pluginManagerImpl = (Ice.PluginManagerI)_pluginManager; pluginManagerImpl.loadPlugins(ref args); +#endif // // Create threads. // try { +#if !SILVERLIGHT if(initializationData().properties.getProperty("Ice.ThreadPriority").Length > 0) { ThreadPriority priority = IceInternal.Util.stringToThreadPriority( @@ -803,6 +817,9 @@ namespace IceInternal { _timer = new Timer(this); } +#else + _timer = new Timer(this); +#endif } catch(System.Exception ex) { @@ -811,6 +828,7 @@ namespace IceInternal throw; } +#if !SILVERLIGHT try { _endpointHostResolver = new EndpointHostResolver(this); @@ -821,7 +839,7 @@ namespace IceInternal _initData.logger.error(s); throw; } - +#endif _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0); // @@ -844,6 +862,7 @@ namespace IceInternal // // Show process id if requested (but only once). // +#if !SILVERLIGHT lock(this) { if(!_printProcessIdDone && _initData.properties.getPropertyAsInt("Ice.PrintProcessId") > 0) @@ -855,7 +874,7 @@ namespace IceInternal _printProcessIdDone = true; } } - +#endif // // Create the connection monitor and ensure the interval for // monitoring connections is appropriate for client & server @@ -875,11 +894,12 @@ namespace IceInternal // initialization until after it has interacted directly with the // plug-ins. // +#if !SILVERLIGHT if(_initData.properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0) { pluginManagerImpl.initializePlugins(); } - +#endif // // This must be done last as this call creates the Ice.Admin object adapter // and eventually registers a process proxy with the Ice locator (allowing @@ -944,8 +964,10 @@ namespace IceInternal ThreadPool serverThreadPool = null; ThreadPool clientThreadPool = null; AsyncIOThread asyncIOThread = null; - EndpointHostResolver endpointHostResolver = null; +#if !SILVERLIGHT + EndpointHostResolver endpointHostResolver = null; +#endif lock(this) { _objectAdapterFactory = null; @@ -979,12 +1001,14 @@ namespace IceInternal _asyncIOThread = null; } +#if !SILVERLIGHT if(_endpointHostResolver != null) { _endpointHostResolver.destroy(); endpointHostResolver = _endpointHostResolver; _endpointHostResolver = null; } +#endif if(_timer != null) { @@ -1053,18 +1077,19 @@ namespace IceInternal { asyncIOThread.joinWithThread(); } +#if !SILVERLIGHT if(endpointHostResolver != null) { endpointHostResolver.joinWithThread(); } - +#endif if(_initData.properties.getPropertyAsInt("Ice.Warn.UnusedProperties") > 0) { - ArrayList unusedProperties = ((Ice.PropertiesI)_initData.properties).getUnusedProperties(); - if(unusedProperties.Count != 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) + foreach (string s in unusedProperties) { message.Append("\n "); message.Append(s); @@ -1083,7 +1108,7 @@ namespace IceInternal private Ice.InitializationData _initData; // Immutable, not reset by destroy(). private TraceLevels _traceLevels; // Immutable, not reset by destroy(). private DefaultsAndOverrides _defaultsAndOverrides; // Immutable, not reset by destroy(). -#if COMPACT +#if COMPACT || SILVERLIGHT private string[] _factoryAssemblies; // Immutable, not reset by destroy(). #endif private int _messageSizeMax; // Immutable, not reset by destroy(). @@ -1102,7 +1127,9 @@ namespace IceInternal private ThreadPool _clientThreadPool; private ThreadPool _serverThreadPool; private AsyncIOThread _asyncIOThread; +#if !SILVERLIGHT private EndpointHostResolver _endpointHostResolver; +#endif private Timer _timer; private RetryQueue _retryQueue; private EndpointFactoryManager _endpointFactoryManager; @@ -1112,9 +1139,11 @@ namespace IceInternal private HashSet<string> _adminFacetFilter = new HashSet<string>(); private Ice.Identity _adminIdentity; +#if !SILVERLIGHT private static bool _printProcessIdDone = false; private static bool _oneOffDone = false; +#endif private static System.Object _staticLock = new System.Object(); } } |