< prev index next >

src/java.base/share/classes/sun/nio/ch/Net.java

Print this page
rev 52979 : 8215281: Use String.isEmpty() when applicable in java.base
Reviewed-by: TBD


 386         if (type != Integer.class && type != Boolean.class)
 387             throw new AssertionError("Should not reach here");
 388 
 389         // map option name to platform level/name
 390         OptionKey key = SocketOptionRegistry.findOption(name, family);
 391         if (key == null)
 392             throw new AssertionError("Option not found");
 393 
 394         boolean mayNeedConversion = (family == UNSPEC);
 395         int value = getIntOption0(fd, mayNeedConversion, key.level(), key.name());
 396 
 397         if (type == Integer.class) {
 398             return Integer.valueOf(value);
 399         } else {
 400             return (value == 0) ? Boolean.FALSE : Boolean.TRUE;
 401         }
 402     }
 403 
 404     public static boolean isFastTcpLoopbackRequested() {
 405         String loopbackProp = GetPropertyAction
 406                 .privilegedGetProperty("jdk.net.useFastTcpLoopback");
 407         boolean enable;
 408         if ("".equals(loopbackProp)) {
 409             enable = true;
 410         } else {
 411             enable = Boolean.parseBoolean(loopbackProp);
 412         }
 413         return enable;
 414     }
 415 
 416     // -- Socket operations --
 417 
 418     private static native boolean isIPv6Available0();
 419 
 420     private static native boolean isReusePortAvailable0();
 421 
 422     /*
 423      * Returns 1 for Windows and -1 for Solaris/Linux/Mac OS
 424      */
 425     private static native int isExclusiveBindAvailable();
 426 
 427     private static native boolean canIPv6SocketJoinIPv4Group0();
 428 
 429     private static native boolean canJoin6WithIPv4Group0();
 430 
 431     static FileDescriptor socket(boolean stream) throws IOException {
 432         return socket(UNSPEC, stream);
 433     }




 386         if (type != Integer.class && type != Boolean.class)
 387             throw new AssertionError("Should not reach here");
 388 
 389         // map option name to platform level/name
 390         OptionKey key = SocketOptionRegistry.findOption(name, family);
 391         if (key == null)
 392             throw new AssertionError("Option not found");
 393 
 394         boolean mayNeedConversion = (family == UNSPEC);
 395         int value = getIntOption0(fd, mayNeedConversion, key.level(), key.name());
 396 
 397         if (type == Integer.class) {
 398             return Integer.valueOf(value);
 399         } else {
 400             return (value == 0) ? Boolean.FALSE : Boolean.TRUE;
 401         }
 402     }
 403 
 404     public static boolean isFastTcpLoopbackRequested() {
 405         String loopbackProp = GetPropertyAction
 406                 .privilegedGetProperty("jdk.net.useFastTcpLoopback", "false");
 407         return loopbackProp.isEmpty() ? true : Boolean.parseBoolean(loopbackProp);






 408     }
 409 
 410     // -- Socket operations --
 411 
 412     private static native boolean isIPv6Available0();
 413 
 414     private static native boolean isReusePortAvailable0();
 415 
 416     /*
 417      * Returns 1 for Windows and -1 for Solaris/Linux/Mac OS
 418      */
 419     private static native int isExclusiveBindAvailable();
 420 
 421     private static native boolean canIPv6SocketJoinIPv4Group0();
 422 
 423     private static native boolean canJoin6WithIPv4Group0();
 424 
 425     static FileDescriptor socket(boolean stream) throws IOException {
 426         return socket(UNSPEC, stream);
 427     }


< prev index next >