summaryrefslogtreecommitdiff
path: root/java/src/IceInternal/ThreadPool.java
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-02-14 18:08:59 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-02-14 18:08:59 +0100
commita95ccc73ef5572109532f3e94498d31df106195d (patch)
tree0062b9c56c133da43a9c7ff5536e9d5b5dbaae89 /java/src/IceInternal/ThreadPool.java
parentMerge branch 'master' of ssh://cvs.zeroc.com/home/git/ice (diff)
downloadice-a95ccc73ef5572109532f3e94498d31df106195d.tar.bz2
ice-a95ccc73ef5572109532f3e94498d31df106195d.tar.xz
ice-a95ccc73ef5572109532f3e94498d31df106195d.zip
- Fixed bug 2688
- Fixed bug 2674 - Changed connection validation to always use non-blocking IO (bug 1981) - Added distribution/src/common/RELEASE_NOTES.txt - Moved distribution/src/windows/README.DEMOS to distribution/src/common
Diffstat (limited to 'java/src/IceInternal/ThreadPool.java')
-rw-r--r--java/src/IceInternal/ThreadPool.java33
1 files changed, 24 insertions, 9 deletions
diff --git a/java/src/IceInternal/ThreadPool.java b/java/src/IceInternal/ThreadPool.java
index 8c7a74cdc1d..f38ea735b6f 100644
--- a/java/src/IceInternal/ThreadPool.java
+++ b/java/src/IceInternal/ThreadPool.java
@@ -589,10 +589,7 @@ public final class ThreadPool
}
catch(java.nio.channels.ClosedChannelException ex)
{
- //
- // This is expected if the transceiver finishConnect() call failed
- // and the connection is a background connection.
- //
+ assert(false);
}
_handlerMap.put(change.fd, new HandlerKeyPair(change.handler, key));
@@ -619,10 +616,7 @@ public final class ThreadPool
assert(pair != null);
handler = pair.handler;
finished = true;
- if(pair.key != null)
- {
- pair.key.cancel();
- }
+ pair.key.cancel();
if(TRACE_REGISTRATION)
{
@@ -1155,7 +1149,7 @@ public final class ThreadPool
select()
{
int ret = 0;
-
+ int spuriousWakeUp = 0;
while(true)
{
try
@@ -1204,6 +1198,27 @@ public final class ThreadPool
trace("select() returned " + ret + ", _keys.size() = " + _keys.size());
}
+ if(ret == 0 && _timeout <= 0)
+ {
+ //
+ // This is necessary to prevent a busy loop in case of a spurious wake-up which
+ // sometime occurs in the client thread pool when the communicator is destroyed.
+ // If there are too many successive spurious wake-ups, we log an error.
+ //
+ try
+ {
+ Thread.currentThread().sleep(1);
+ }
+ catch(java.lang.InterruptedException ex)
+ {
+ }
+
+ if(++spuriousWakeUp > 100)
+ {
+ _instance.initializationData().logger.error("spurious selector wake up in `" + _prefix + "'");
+ }
+ }
+
break;
}
}