summaryrefslogtreecommitdiff
path: root/java
diff options
context:
space:
mode:
Diffstat (limited to 'java')
-rw-r--r--java/src/Ice/PluginManagerI.java10
-rw-r--r--java/src/Ice/ThreadHookPlugin.java62
-rw-r--r--java/src/IceInternal/Instance.java79
-rw-r--r--java/src/IceInternal/PropertyNames.java7
4 files changed, 119 insertions, 39 deletions
diff --git a/java/src/Ice/PluginManagerI.java b/java/src/Ice/PluginManagerI.java
index 4d5bbdb9b0a..8da4b4636ee 100644
--- a/java/src/Ice/PluginManagerI.java
+++ b/java/src/Ice/PluginManagerI.java
@@ -254,16 +254,6 @@ public final class PluginManagerI implements PluginManager
loadPlugin(name, value, cmdArgs);
}
}
-
- //
- // An application can set Ice.InitPlugins=0 if it wants to postpone
- // initialization until after it has interacted directly with the
- // plug-ins.
- //
- if(properties.getPropertyAsIntWithDefault("Ice.InitPlugins", 1) > 0)
- {
- initializePlugins();
- }
}
private void
diff --git a/java/src/Ice/ThreadHookPlugin.java b/java/src/Ice/ThreadHookPlugin.java
new file mode 100644
index 00000000000..93b0916e027
--- /dev/null
+++ b/java/src/Ice/ThreadHookPlugin.java
@@ -0,0 +1,62 @@
+// **********************************************************************
+//
+// Copyright (c) 2003-2009 ZeroC, Inc. All rights reserved.
+//
+// This copy of Ice is licensed to you under the terms described in the
+// ICE_LICENSE file included in this distribution.
+//
+// **********************************************************************
+
+package Ice;
+
+/**
+ * Class to support thread notification hooks. Applications using thread
+ * notifications hooks instantiate a <code>ThreadHookPlugin</code> with
+ * a thread notification hook and return the instance from their
+ * {@link PluginFactory} implementation.
+ *
+ * @see PluginFactory
+ * @see Plugin
+ **/
+public class ThreadHookPlugin implements Ice.Plugin
+{
+ /**
+ * Installs a thread notification hook for a communicator.
+ *
+ * @param communicator The communicator using the thread notification hook.
+ * @param threadHook The thread notification hook for the communicator.
+ **/
+ public
+ ThreadHookPlugin(Communicator communicator, ThreadNotification threadHook)
+ {
+ if(communicator == null)
+ {
+ PluginInitializationException ex = new PluginInitializationException();
+ ex.reason = "Communicator cannot be null";
+ throw ex;
+ }
+
+ IceInternal.Instance instance = IceInternal.Util.getInstance(communicator);
+ instance.setThreadHook(threadHook);
+ }
+
+ /**
+ * Called by the Ice run time during communicator initialization. The derived class
+ * can override this method to perform any initialization that might be required
+ * by a custom thread notification hook.
+ **/
+ public void
+ initialize()
+ {
+ }
+
+ /**
+ * Called by the Ice run time when the communicator is destroyed. The derived class
+ * can override this method to perform any finalization that might be required
+ * by a custom thread notification hook.
+ **/
+ public void
+ destroy()
+ {
+ }
+}
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).
diff --git a/java/src/IceInternal/PropertyNames.java b/java/src/IceInternal/PropertyNames.java
index f1883c96644..ad0f895e073 100644
--- a/java/src/IceInternal/PropertyNames.java
+++ b/java/src/IceInternal/PropertyNames.java
@@ -8,7 +8,7 @@
// **********************************************************************
//
-// Generated by makeprops.py from file ../config/PropertyNames.xml, Wed Sep 23 15:26:41 2009
+// Generated by makeprops.py from file ../config/PropertyNames.xml, Mon Sep 28 09:54:13 2009
// IMPORTANT: Do not edit this file -- any edits made here will be lost!
@@ -369,6 +369,11 @@ public final class PropertyNames
new Property("IceGrid\\.Registry\\.Trace\\.Topic", false, null),
new Property("IceGrid\\.Registry\\.Trace\\.TopicManager", false, null),
new Property("IceGrid\\.Registry\\.UserAccounts", false, null),
+ new Property("IceGrid\\.SQL\\.DatabaseType", false, null),
+ new Property("IceGrid\\.SQL\\.HostName", false, null),
+ new Property("IceGrid\\.SQL\\.DatabaseName", false, null),
+ new Property("IceGrid\\.SQL\\.UserName", false, null),
+ new Property("IceGrid\\.SQL\\.Password", false, null),
null
};