diff -r a5ed9456c9be -r 0676e37a0b9c jdk/src/java.base/share/classes/sun/nio/ch/Net.java --- a/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Tue Feb 23 09:49:04 2016 +0100 +++ b/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Tue Feb 23 17:41:00 2016 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -56,6 +56,8 @@ private static volatile boolean checkedIPv6; private static volatile boolean isIPv6Available; + private static volatile boolean checkedReusePort; + private static volatile boolean isReusePortAvailable; /** * Tells whether dual-IPv4/IPv6 sockets should be used. @@ -69,6 +71,17 @@ } /** + * Tells whether SO_REUSEPORT is supported. + */ + static boolean isReusePortAvailable() { + if (!checkedReusePort) { + isReusePortAvailable = isReusePortAvailable0(); + checkedReusePort = true; + } + return isReusePortAvailable; + } + + /** * Returns true if exclusive binding is on */ static boolean useExclusiveBind() { @@ -389,6 +402,8 @@ private static native boolean isIPv6Available0(); + private static native boolean isReusePortAvailable0(); + /* * Returns 1 for Windows and -1 for Solaris/Linux/Mac OS */