summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ThreadPool.java
diff options
context:
space:
mode:
authorMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
committerMark Spruiell <mes@zeroc.com>2002-01-29 06:49:10 +0000
commit0001dc614d21380fb22a22566a44e6d2eae88542 (patch)
treec2a50cf5bd26da7ce3844146473989ebac902515 /java/src/IceInternal/ThreadPool.java
parentadding server (diff)
downloadice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.bz2
ice-0001dc614d21380fb22a22566a44e6d2eae88542.tar.xz
ice-0001dc614d21380fb22a22566a44e6d2eae88542.zip
align with stable_31
Diffstat (limited to 'java/src/IceInternal/ThreadPool.java')
-rw-r--r--java/src/IceInternal/ThreadPool.java97
1 files changed, 47 insertions, 50 deletions
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java
index e73e01b84b4..de9d99138b8 100644
--- a/java/src/IceInternal/ThreadPool.java
+++ b/java/src/IceInternal/ThreadPool.java
@@ -179,26 +179,26 @@ public final class ThreadPool
}
}
- try
+ _threadNum = 10;
+ value = _instance.properties().getProperty("Ice.ThreadPool.Size");
+ if (value != null)
{
- _threadNum = 10;
- value = _instance.properties().getProperty("Ice.ThreadPool.Size");
- if (value != null)
+ try
{
- try
- {
- _threadNum = Integer.parseInt(value);
- if (_threadNum < 1)
- {
- _threadNum = 1;
- }
- }
- catch (NumberFormatException ex)
+ _threadNum = Integer.parseInt(value);
+ if (_threadNum < 1)
{
- // TODO: Error?
+ _threadNum = 1;
}
}
+ catch (NumberFormatException ex)
+ {
+ // TODO: Error?
+ }
+ }
+ try
+ {
_threads = new EventHandlerThread[_threadNum];
for (int i = 0; i < _threadNum; i++)
{
@@ -474,53 +474,50 @@ public final class ThreadPool
{
BasicStream stream = handler._stream;
- if (stream.size() < Protocol.headerSize) // Read header?
+ if (stream.size() == 0)
{
- if (stream.size() == 0)
- {
- stream.resize(Protocol.headerSize, true);
- stream.pos(0);
- }
+ stream.resize(Protocol.headerSize, true);
+ stream.pos(0);
+ }
+ if (stream.pos() != stream.size())
+ {
handler.read(stream);
- if (stream.pos() != stream.size())
- {
- return;
- }
+ assert(stream.pos() != stream.size());
}
- if (stream.size() >= Protocol.headerSize) // Interpret header?
+ int pos = stream.pos();
+ stream.pos(0);
+ byte protVer = stream.readByte();
+ if (protVer != Protocol.protocolVersion)
+ {
+ throw new Ice.UnsupportedProtocolException();
+ }
+ byte encVer = stream.readByte();
+ if (encVer != Protocol.encodingVersion)
+ {
+ throw new Ice.UnsupportedEncodingException();
+ }
+ byte messageType = stream.readByte();
+ int size = stream.readInt();
+ if (size < Protocol.headerSize)
+ {
+ throw new Ice.IllegalMessageSizeException();
+ }
+ if (size > 1024 * 1024) // TODO: Configurable
+ {
+ throw new Ice.MemoryLimitException();
+ }
+ if (size > stream.size())
{
- int pos = stream.pos();
- stream.pos(0);
- byte protVer = stream.readByte();
- if (protVer != Protocol.protocolVersion)
- {
- throw new Ice.UnsupportedProtocolException();
- }
- byte encVer = stream.readByte();
- if (encVer != Protocol.encodingVersion)
- {
- throw new Ice.UnsupportedEncodingException();
- }
- byte messageType = stream.readByte();
- int size = stream.readInt();
- if (size < Protocol.headerSize)
- {
- throw new Ice.IllegalMessageSizeException();
- }
- if (size > 1024 * 1024) // TODO: Configurable
- {
- throw new Ice.MemoryLimitException();
- }
stream.resize(size, true);
- stream.pos(pos);
}
+ stream.pos(pos);
- if (stream.size() > Protocol.headerSize &&
- stream.pos() != stream.size())
+ if (stream.pos() != stream.size())
{
handler.read(stream);
+ assert(stream.pos() != stream.size());
}
}