harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Sergey Dmitriev (JIRA)" <j...@apache.org>
Subject [jira] Created: (HARMONY-4212) [classlib][nio] deregistered channel.configureBlocking(true) throws IllegalBlockingModeException
Date Mon, 18 Jun 2007 09:48:26 GMT
[classlib][nio] deregistered channel.configureBlocking(true) throws IllegalBlockingModeException
------------------------------------------------------------------------------------------------

                 Key: HARMONY-4212
                 URL: https://issues.apache.org/jira/browse/HARMONY-4212
             Project: Harmony
          Issue Type: Bug
          Components: Classlib
            Reporter: Sergey Dmitriev


In nio.channels: after deregistering and removing SocketChannel from selector calling channel.configureBlocking(true)
throws IllegalBlockingModeException. Actually this not how it is have to be. Please see the
mini test. (Please execute "telnet localhost 9999" in other shell after test launch).

] guy@box ~
] cat select7.java
import java.nio.channels.*;
import java.net.*;
import java.util.*;

public class select7 {

    public static void main(String[] args) throws Exception {

        Selector selector = Selector.open();
        ServerSocketChannel ssc = ServerSocketChannel.open();
        ssc.socket().bind(new InetSocketAddress(9999));


        // server listening

        System.out.println("Waiting on accept...");
        SocketChannel sc = ssc.accept();
        System.out.println("Done.");


        // register & select

        sc.configureBlocking(false);
        sc.register(selector, SelectionKey.OP_READ);
        System.out.println("Waiting on select()...");
        int res = selector.select();
        System.out.println("Done. " + res + " key(s) up.");


        // run through the selected keys

        Iterator readyKeys = selector.selectedKeys().iterator();
        while (readyKeys.hasNext()) {
            SelectionKey key = (SelectionKey)readyKeys.next();
            System.out.println("Selected key = " + key);
            key.cancel();
            readyKeys.remove();
            SelectableChannel ch = key.channel();
            ch.configureBlocking(true);
        }
    }
}



] guy@box ~
] ~/jre2/bin/java -showversion select7
Apache Harmony Launcher : (c) Copyright 1991, 2006 The Apache Software Foundation or its licensors,
as applicable.
java version "1.5.0"
pre-alpha : not complete or compatible
svn = r540000, (May 21 2007), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
Waiting on accept...
Done.
Waiting on select()...
Done. 1 key(s) up.
Selected key = org.apache.harmony.nio.internal.SelectionKeyImpl@4507d7e0
Uncaught exception in main:
java.nio.channels.IllegalBlockingModeException
        at java.nio.channels.spi.AbstractSelectableChannel.configureBlocking(AbstractSelectableChannel.java:206)
        at select7.main(select7.java:39)



] guy@box ~
] java -showversion select7
java version "1.5.0_06"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
BEA JRockit(R) (build R26.3.0-32-58710-1.5.0_06-20060308-2022-linux-ia32, )

Waiting on accept...
Done.
Waiting on select()...
Done. 1 key(s) up.
Selected key = sun.nio.ch.SelectionKeyImpl@10e847b


-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message