[forwarded from http://bugs.debian.org/415109] seen with GCC trunk, 20070730 (cp-0.95): The java API for SelectableChannel requires that attempts to toggle blocking mode with configureBlocking fail when a channel is registered. This test program demonstrates that gcj fails to throw the expected exception... === # first use sun jvm msimons@blitz:~/java/listen$ ~/java/jdk1.5.0_10/bin/java test2 java.nio.channels.IllegalBlockingModeException at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:257) at test2.main(test2.java:19) # now gcj msimons@blitz:~/java/listen$ java test2 msimons@blitz:~/java/listen$ reportbug -o blocking.bug `which java` === http://java.sun.com/j2se/1.4.2/docs/api/java/nio/channels/SelectableChannel.html === Blocking mode A selectable channel is either in blocking mode or in non-blocking mode. In blocking mode, every I/O operation invoked upon the channel will block until it completes. In non-blocking mode an I/O operation will never block and may transfer fewer bytes than were requested or possibly no bytes at all. The blocking mode of a selectable channel may be determined by invoking its isBlocking method. Newly-created selectable channels are always in blocking mode. Non-blocking mode is most useful in conjunction with selector-based multiplexing. A channel must be placed into non-blocking mode before being registered with a selector, and may not be returned to blocking mode until it has been deregistered. === sample code: === import java.net.InetSocketAddress; import java.nio.channels.SelectionKey; import java.nio.channels.Selector; import java.nio.channels.ServerSocketChannel; import java.nio.channels.spi.SelectorProvider; public class test2 { public static void main(String[] args) { try { Selector sel = null; InetSocketAddress isa = new InetSocketAddress(2300); ServerSocketChannel ssc = ServerSocketChannel.open(); ssc.configureBlocking(false); ssc.socket().bind(isa); sel = SelectorProvider.provider().openSelector(); ssc.register(sel, SelectionKey.OP_ACCEPT); ssc.configureBlocking(true); } catch(Exception e) { e.printStackTrace(); } } } ===
Hi Mark, this shouldn't be in the inetlib component, please reassign to whoever is dealing with NIO.