test/jdk/java/nio/channels/Selector/CloseWhenKeyIdle.java
changeset 49290 07779973cbe2
parent 47216 71c04702a3d5
equal deleted inserted replaced
49289:148e29df1644 49290:07779973cbe2
     1 /*
     1 /*
     2  * Copyright (c) 2007, 2010, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2007, 2018, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.
     7  * published by the Free Software Foundation.
    59         }
    59         }
    60     }
    60     }
    61 
    61 
    62 
    62 
    63     public static void main(String[] args) throws Exception {
    63     public static void main(String[] args) throws Exception {
    64 
       
    65         // Skip test on pre-2.6 kernels until the poll SelectorProvider
       
    66         // is updated
       
    67         String osname = System.getProperty("os.name");
       
    68         if (osname.equals("Linux")) {
       
    69             String[] ver = System.getProperty("os.version").split("\\.", 0);
       
    70             if (ver.length >=2 ) {
       
    71                 int major = Integer.parseInt(ver[0]);
       
    72                 int minor = Integer.parseInt(ver[1]);
       
    73                 if (major < 2 || (major == 2 && minor < 6)) {
       
    74                     System.out.println("Test passing on pre-2.6 kernel");
       
    75                     return;
       
    76                 }
       
    77             }
       
    78         }
       
    79 
       
    80 
    64 
    81         // establish loopback connection
    65         // establish loopback connection
    82 
    66 
    83         ServerSocketChannel ssc = ServerSocketChannel.open();
    67         ServerSocketChannel ssc = ServerSocketChannel.open();
    84         ssc.socket().bind(new InetSocketAddress(0));
    68         ssc.socket().bind(new InetSocketAddress(0));