You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by "Sergey Dmitriev (JIRA)" <ji...@apache.org> on 2007/05/17 12:26:16 UTC

[jira] Created: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

[classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
-------------------------------------------------------------------------------------------

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


java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
if keys is empty. Actually specification says nothing about such an
optimization as "if keys.empty() return immediately regardless of
timeout value".


] boy@sun ~
] cat selector.java
import java.nio.channels.*;
 
public class selector {
    public static void main(String args[]) throws Exception {
        Selector selector = Selector.open();
        System.out.println("=" + selector);
        selector.select(10000);
        System.out.println("=" + selector);
    }
}


] boy@sun ~
] time ~/harmony-m1/bin/java -showversion selector
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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
http://incubator.apache.org/harmony
=org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
=org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
 
real    0m1.280s
user    0m1.125s
sys     0m0.075s


] boy@sun ~
] time java -showversion selector
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, )
 
=sun.nio.ch.PollSelectorImpl@10e72dc
=sun.nio.ch.PollSelectorImpl@10e72dc
 
real    0m12.166s
user    0m0.536s
sys     0m0.146s


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


Re: [jira] Created: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Jimmy,Jing Lv" <fi...@gmail.com>.
I've not sure, but does it make sense if no key is registered,
Selector.select() still waits until time expired? (Though RI
performance like this?)
Or shall we mark it as a non-bug difference?

2007/5/17, Sergey Dmitriev (JIRA) <ji...@apache.org>:
> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                  Key: HARMONY-3888
>                  URL: https://issues.apache.org/jira/browse/HARMONY-3888
>              Project: Harmony
>           Issue Type: Bug
>           Components: Classlib
>             Reporter: Sergey Dmitriev
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
>
>
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
>
>
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
>
>
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s
>
>
> --
> This message is automatically generated by JIRA.
> -
> You can reply to this email to add a comment to the issue online.
>
>


-- 

Best Regards!

Jimmy, Jing Lv
China Software Development Lab, IBM

[jira] Updated: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Dmitriev updated HARMONY-3888:
-------------------------------------

    Attachment: 3888_test.patch

> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>         Assigned To: Mark Hindess
>         Attachments: 3888.patch, 3888_test.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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


[jira] Resolved: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess resolved HARMONY-3888.
-----------------------------------

    Resolution: Fixed

Applied in r542627.


> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>            Assignee: Mark Hindess
>         Attachments: 3888.patch, 3888_test.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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


[jira] Updated: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Sergey Dmitriev updated HARMONY-3888:
-------------------------------------

    Attachment: 3888.patch

In process of fixing this bug another issue has been. After fixing this issue suddenly SelectorTest.test_wakeup() started to fail. See JIRA#3915.

So I believe the code-fix and test-fix for JIRA#3915 and code-fix for
this one should be committed together since all this stuff intertwined. 


> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>         Attachments: 3888.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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


[jira] Assigned: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess reassigned HARMONY-3888:
-------------------------------------

    Assignee: Mark Hindess

> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>         Assigned To: Mark Hindess
>         Attachments: 3888.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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


[jira] Commented: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Sergey Dmitriev (JIRA)" <ji...@apache.org>.
    [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#action_12499547 ] 

Sergey Dmitriev commented on HARMONY-3888:
------------------------------------------

Hi Mark

Any update on this and HARMONY-3915?

While HARMONY-3915 is not very clear this issue looks pretty straightforward. Probably this issue can be fixed without waiting for HARMONY-3915?


> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>            Assignee: Mark Hindess
>         Attachments: 3888.patch, 3888_test.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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


[jira] Closed: (HARMONY-3888) [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys

Posted by "Mark Hindess (JIRA)" <ji...@apache.org>.
     [ https://issues.apache.org/jira/browse/HARMONY-3888?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mark Hindess closed HARMONY-3888.
---------------------------------


Works for me now.  Closing.


> [classlib][nio] java.nio.channels.Selector.select(long timeout) does not wait on empty keys
> -------------------------------------------------------------------------------------------
>
>                 Key: HARMONY-3888
>                 URL: https://issues.apache.org/jira/browse/HARMONY-3888
>             Project: Harmony
>          Issue Type: Bug
>          Components: Classlib
>            Reporter: Sergey Dmitriev
>            Assignee: Mark Hindess
>         Attachments: 3888.patch, 3888_test.patch
>
>
> java.nio.channels.Selector.select(long timeout) doesn't fall to sleep
> if keys is empty. Actually specification says nothing about such an
> optimization as "if keys.empty() return immediately regardless of
> timeout value".
> ] boy@sun ~
> ] cat selector.java
> import java.nio.channels.*;
>  
> public class selector {
>     public static void main(String args[]) throws Exception {
>         Selector selector = Selector.open();
>         System.out.println("=" + selector);
>         selector.select(10000);
>         System.out.println("=" + selector);
>     }
> }
> ] boy@sun ~
> ] time ~/harmony-m1/bin/java -showversion selector
> 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 = r533500, (Apr 30 2007), Linux/ia32/gcc 3.3.3, release build
> http://incubator.apache.org/harmony
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
> =org.apache.harmony.nio.internal.SelectorImpl@425ba2a8
>  
> real    0m1.280s
> user    0m1.125s
> sys     0m0.075s
> ] boy@sun ~
> ] time java -showversion selector
> 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, )
>  
> =sun.nio.ch.PollSelectorImpl@10e72dc
> =sun.nio.ch.PollSelectorImpl@10e72dc
>  
> real    0m12.166s
> user    0m0.536s
> sys     0m0.146s

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