Some more info.
I have investigated the pb on Mac & Linux. Its behavior is different.
What's happening is that when the session is disconnected in the test :
public void testSuspendResumeServer() throws Exception {
// connect should work as expected
client.connect("localhost", port);
client.disconnect();
the IoProcessor thread (MINA) does something different on Linux and on Mac :
private class Processor implements Runnable {
public void run() {
int nSessions = 0;
lastIdleCheckTime = System.currentTimeMillis();
for (;;) {
try {
...
nSessions -= remove();
notifyIdleSessions(currentTime);
if (nSessions == 0) {
synchronized (lock) {
if (newSessions.isEmpty() &&
isSelectorEmpty()) { <---- This is here.
processor = null;
break;
On linux, the selector is never empty. On mac, in this case, the session
number is empty _and_ the selector keys is empty too, so we get out of
the IoProcessor, and there is nothing left to deal with the client
reconection.
In other words, the server is *dead*.
Sounds like a bad bug in the Mac JVM, as the isSelectorEmpty() method :
protected boolean isSelectorEmpty() {
return selector.keys().isEmpty();
}
calls the selector.keys() method, which contract is :
"The key set is not directly modifiable. A key is removed only after it
has been cancelled and its channel has been deregistered. Any attempt to
modify the key set will cause an |UnsupportedOperationException|
<http://java.sun.com/j2se/1.5.0/docs/api/java/lang/UnsupportedOperationException.html>
to be thrown. "
As we are _still_ listening this channel ( remember that the server has
not _yet_ been stopped : I'm debugging the program, and I have not yet
step into the server.suspend() method), there is clearly something wrong
: the channel has not been deregistred.
Is someone connected with Apple and can see if a bug report can be send,
if I'm not totally off rails ?
--
--
cordialement, regards,
Emmanuel Lécharny
www.iktek.com
directory.apache.org