Hi,
Committed. The spec says that implCloseChannel should cancel all keys
associated with the channel.
Regards,
Jeroen
2006-09-24 Jeroen Frijters <[EMAIL PROTECTED]>
* java/nio/channels/spi/AbstractSelectableChannel.java
(implCloseChannel): Cancel all keys after closing the channel.
Index: java/nio/channels/spi/AbstractSelectableChannel.java
===================================================================
RCS file:
/cvsroot/classpath/classpath/java/nio/channels/spi/AbstractSelectableChannel.java,v
retrieving revision 1.19
diff -u -r1.19 AbstractSelectableChannel.java
--- java/nio/channels/spi/AbstractSelectableChannel.java 29 Oct 2005
17:05:44 -0000 1.19
+++ java/nio/channels/spi/AbstractSelectableChannel.java 24 Sep 2006
11:26:39 -0000
@@ -44,6 +44,7 @@
import java.nio.channels.SelectionKey;
import java.nio.channels.Selector;
import java.nio.channels.IllegalBlockingModeException;
+import java.util.Iterator;
import java.util.LinkedList;
import java.util.ListIterator;
@@ -106,7 +107,15 @@
*/
protected final void implCloseChannel() throws IOException
{
- implCloseSelectableChannel();
+ try
+ {
+ implCloseSelectableChannel();
+ }
+ finally
+ {
+ for (Iterator it = keys.iterator(); it.hasNext(); )
+ ((SelectionKey) it.next()).cancel();
+ }
}
/**