harmony-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Ellison (JIRA)" <j...@apache.org>
Subject [jira] Commented: (HARMONY-6338) [classlib][nio] Selector should be also interested in OP_CONNET when connected.
Date Wed, 16 Sep 2009 08:57:59 GMT

    [ https://issues.apache.org/jira/browse/HARMONY-6338?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12755945#action_12755945
] 

Tim Ellison commented on HARMONY-6338:
--------------------------------------

while the patch might look reasonable, but the testcase is unacceptable because it uses

Support_PortManager.getNextPort()  -- which is deprecated

and it uses a delay to ensure the server is set up correctly, which is poor practice.
p.s. there is also a typo in "Connet"

There is no need to have multiple threads etc.  Here's my attempt to re-write the testcase
-- but you should check it is testing the code the way yours was:

    public void testSelector() throws Exception {

        ServerSocketChannel server = ServerSocketChannel.open();
        server.socket().bind(null);

        SocketChannel client = SocketChannel.open();
        client.configureBlocking(false);

        Selector selector = Selector.open();
        client.register(selector, SelectionKey.OP_CONNECT);

        client.connect(server.socket().getLocalSocketAddress());
        SocketChannel worker = server.accept();

        selector.select();

        assertEquals(1, selector.selectedKeys().size());

        selector.selectedKeys().clear();
        selector.select();
        assertEquals(1, selector.selectedKeys().size());

        client.finishConnect();

        worker.close();
        client.close();
        server.close();
    }


> [classlib][nio] Selector should be also interested in OP_CONNET when connected.
> -------------------------------------------------------------------------------
>
>                 Key: HARMONY-6338
>                 URL: https://issues.apache.org/jira/browse/HARMONY-6338
>             Project: Harmony
>          Issue Type: Bug
>            Reporter: Li Jing Qin
>         Attachments: HARMONY-6338.diff, HARMONY-6338.diff.v2
>
>
> A selector is interested in OP_CONNECT. When the it is connected, selector.selectedKeys().size()
should return 1 not 0.

-- 
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