summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ThreadPool.java
diff options
context:
space:
mode:
authorMarc Laukien <marc@zeroc.com>2003-03-06 23:16:32 +0000
committerMarc Laukien <marc@zeroc.com>2003-03-06 23:16:32 +0000
commit22a1dff9132fef952d43c8f08f86113b3fb3a783 (patch)
treee155d116a4b43a4f3005d1672601cb43fc60b35f /java/src/IceInternal/ThreadPool.java
parentadd --Ice.Config to usage (diff)
downloadice-22a1dff9132fef952d43c8f08f86113b3fb3a783.tar.bz2
ice-22a1dff9132fef952d43c8f08f86113b3fb3a783.tar.xz
ice-22a1dff9132fef952d43c8f08f86113b3fb3a783.zip
internal thread pool changes
Diffstat (limited to 'java/src/IceInternal/ThreadPool.java')
-rw-r--r--java/src/IceInternal/ThreadPool.java17
1 files changed, 10 insertions, 7 deletions
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java
index 666d607e417..01dfd2f7094 100644
--- a/java/src/IceInternal/ThreadPool.java
+++ b/java/src/IceInternal/ThreadPool.java
@@ -25,14 +25,14 @@ public final class ThreadPool
private final static boolean TRACE_STACK_TRACE = false;
public
- ThreadPool(Instance instance, int threadNum, int timeout, String name)
+ ThreadPool(Instance instance, String prefix, int timeout)
{
_instance = instance;
_destroyed = false;
_timeout = timeout;
_multipleThreads = false;
_promote = true;
- _name = name;
+ _prefix = prefix;
Network.SocketPair pair = Network.createPipe();
_fdIntrRead = (java.nio.channels.ReadableByteChannel)pair.source;
@@ -57,9 +57,12 @@ public final class ThreadPool
//
_keys = _selector.selectedKeys();
+ int threadNum = _instance.properties().getPropertyAsInt(_prefix + ".Size");
+
if(threadNum < 1)
{
threadNum = 1;
+ _instance.properties().setProperty(_prefix + ".Size", "1");
}
if(threadNum > 1)
@@ -70,11 +73,11 @@ public final class ThreadPool
//
// Use Ice.ProgramName as the prefix for the thread names.
//
- String threadNamePrefix = "";
+ String programNamePrefix = "";
String programName = _instance.properties().getProperty("Ice.ProgramName");
if(programName.length() > 0)
{
- threadNamePrefix = programName + "-";
+ programNamePrefix = programName + "-";
}
try
@@ -82,7 +85,7 @@ public final class ThreadPool
_threads = new EventHandlerThread[threadNum];
for(int i = 0; i < threadNum; i++)
{
- _threads[i] = new EventHandlerThread(threadNamePrefix + _name + "-" + i);
+ _threads[i] = new EventHandlerThread(programNamePrefix + _prefix + "-" + i);
_threads[i].start();
}
}
@@ -830,7 +833,7 @@ public final class ThreadPool
private void
trace(String msg)
{
- System.err.println(_name + ": " + msg);
+ System.err.println(_prefix + ": " + msg);
}
private String
@@ -894,7 +897,7 @@ public final class ThreadPool
private boolean _promote;
private java.lang.Object _promoteMonitor = new java.lang.Object();
private boolean _multipleThreads;
- private String _name;
+ private String _prefix;
private final class EventHandlerThread extends Thread
{