diff options
Diffstat (limited to 'java/src/IceInternal/Instance.java')
-rw-r--r-- | java/src/IceInternal/Instance.java | 79 |
1 files changed, 51 insertions, 28 deletions
diff --git a/java/src/IceInternal/Instance.java b/java/src/IceInternal/Instance.java index d97a5beef08..dc21c30cf2e 100644 --- a/java/src/IceInternal/Instance.java +++ b/java/src/IceInternal/Instance.java @@ -531,6 +531,15 @@ public final class Instance _initData.logger = logger; } + public void + setThreadHook(Ice.ThreadNotification threadHook) + { + // + // No locking, as it can only be called during plug-in loading + // + _initData.threadHook = threadHook; + } + public Class<?> findClass(String className) { @@ -712,34 +721,6 @@ public final class Instance _retryQueue = new RetryQueue(this); - try - { - _endpointHostResolver = new EndpointHostResolver(this); - } - catch(RuntimeException ex) - { - String s = "cannot create thread for endpoint host resolver:\n" + Ex.toString(ex); - _initData.logger.error(s); - throw ex; - } - - try - { - _timer = new Timer(this); - if(initializationData().properties.getProperty("Ice.ThreadPriority").length() > 0) - { - _timer.setPriority(Util.getThreadPriorityProperty(initializationData().properties, "Ice")); - } - } - catch(RuntimeException ex) - { - String s = "cannot create thread for timer:\n" + Ex.toString(ex); - _initData.logger.error(s); - throw ex; - } - - _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0); - // // Add Process and Properties facets // @@ -790,10 +771,42 @@ public final class Instance // // Load plug-ins. // + assert(_serverThreadPool == null); Ice.PluginManagerI pluginManagerImpl = (Ice.PluginManagerI)_pluginManager; pluginManagerImpl.loadPlugins(args); // + // Create threads. + // + try + { + _timer = new Timer(this); + if(initializationData().properties.getProperty("Ice.ThreadPriority").length() > 0) + { + _timer.setPriority(Util.getThreadPriorityProperty(initializationData().properties, "Ice")); + } + } + catch(RuntimeException ex) + { + String s = "cannot create thread for timer:\n" + Ex.toString(ex); + _initData.logger.error(s); + throw ex; + } + + try + { + _endpointHostResolver = new EndpointHostResolver(this); + } + catch(RuntimeException ex) + { + String s = "cannot create thread for endpoint host resolver:\n" + Ex.toString(ex); + _initData.logger.error(s); + throw ex; + } + + _clientThreadPool = new ThreadPool(this, "Ice.ThreadPool.Client", 0); + + // // 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. @@ -850,6 +863,16 @@ public final class Instance // // + // An application can set Ice.InitPlugins=0 if it wants to postpone + // initialization until after it has interacted directly with the + // plug-ins. + // + if(_initData.properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0) + { + pluginManagerImpl.initializePlugins(); + } + + // // 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 // remote clients to invoke on Ice.Admin facets as soon as it's registered). |