summaryrefslogtreecommitdiff
path: root/java/src
diff options
context:
space:
mode:
authorBenoit Foucher <benoit@zeroc.com>2008-03-17 16:15:33 +0100
committerBenoit Foucher <benoit@zeroc.com>2008-03-17 16:15:33 +0100
commit1c7e966da1efd1312cd6e143402eb241a32c88e7 (patch)
treed6a9bbb1489719532ed40233bdcba11418389db7 /java/src
parentAdded multicast projects to solution (diff)
downloadice-1c7e966da1efd1312cd6e143402eb241a32c88e7.tar.bz2
ice-1c7e966da1efd1312cd6e143402eb241a32c88e7.tar.xz
ice-1c7e966da1efd1312cd6e143402eb241a32c88e7.zip
Fixed bug 2801
Diffstat (limited to 'java/src')
-rw-r--r--java/src/IceInternal/SelectorThread.java17
1 files changed, 13 insertions, 4 deletions
diff --git a/java/src/IceInternal/SelectorThread.java b/java/src/IceInternal/SelectorThread.java
index 4717ea99dfc..e34cc480ddc 100644
--- a/java/src/IceInternal/SelectorThread.java
+++ b/java/src/IceInternal/SelectorThread.java
@@ -25,6 +25,7 @@ public class SelectorThread
protected int _timeout;
protected SocketStatus _status;
+ protected SocketStatus _previousStatus;
}
SelectorThread(Instance instance)
@@ -75,6 +76,7 @@ public class SelectorThread
{
// Note: unregister should only be called from the socketReady() call-back.
assert(!_destroyed); // The selector thread is destroyed after the incoming/outgoing connection factories.
+ assert(cb._status != SocketStatus.Finished);
_selector.remove(cb);
cb._status = SocketStatus.Finished;
@@ -84,8 +86,10 @@ public class SelectorThread
finish(SocketReadyCallback cb)
{
assert(!_destroyed); // The selector thread is destroyed after the incoming/outgoing connection factories.
+ assert(cb._status != SocketStatus.Finished);
_selector.remove(cb);
+ cb._status = SocketStatus.Finished;
_finished.add(cb);
_selector.setInterrupt();
@@ -161,7 +165,7 @@ public class SelectorThread
do
{
SocketReadyCallback cb = _finished.removeFirst();
- cb._status = SocketStatus.Finished;
+ cb._previousStatus = SocketStatus.Finished;
readyList.add(cb);
}
while(_selector.clearInterrupt()); // As long as there are interrupts
@@ -172,6 +176,7 @@ public class SelectorThread
SocketReadyCallback cb;
while((cb = (SocketReadyCallback)_selector.getNextSelected()) != null)
{
+ cb._previousStatus = cb._status;
readyList.add(cb);
}
}
@@ -217,12 +222,16 @@ public class SelectorThread
_selector.hasMoreData(cb);
}
- if(status != cb._status)
+ if(status != cb._previousStatus)
{
synchronized(this)
{
- _selector.update(cb, status);
- cb._status = status;
+ // The callback might have been finished concurrently.
+ if(cb._status != SocketStatus.Finished)
+ {
+ _selector.update(cb, status);
+ cb._status = status;
+ }
}
}