[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Bug inetlib/32861] New: SelectableChannel.configureBlocking fails to th
From: |
debian-gcc at lists dot debian dot org |
Subject: |
[Bug inetlib/32861] New: SelectableChannel.configureBlocking fails to throw IllegalBlockingModeException |
Date: |
23 Jul 2007 07:22:55 -0000 |
[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
address@hidden:~/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
address@hidden:~/java/listen$ java test2
address@hidden:~/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();
}
}
}
===
--
Summary: SelectableChannel.configureBlocking fails to throw
IllegalBlockingModeException
Product: classpath
Version: 0.95
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: inetlib
AssignedTo: dog at gnu dot org
ReportedBy: debian-gcc at lists dot debian dot org
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32861
- [Bug inetlib/32861] New: SelectableChannel.configureBlocking fails to throw IllegalBlockingModeException,
debian-gcc at lists dot debian dot org <=