8154238: Drop code to support Windows XP in windows socket impl
Reviewed-by: chegar
This commit is contained in:
parent
786a03da86
commit
6ace4f6b74
@ -25,7 +25,9 @@
|
||||
package java.net;
|
||||
|
||||
import java.io.*;
|
||||
import java.security.AccessController;
|
||||
import java.security.PrivilegedAction;
|
||||
import sun.security.action.GetPropertyAction;
|
||||
|
||||
/*
|
||||
* This class PlainSocketImpl simply delegates to the appropriate real
|
||||
@ -45,55 +47,29 @@ class PlainSocketImpl extends AbstractPlainSocketImpl
|
||||
{
|
||||
private AbstractPlainSocketImpl impl;
|
||||
|
||||
/* the windows version. */
|
||||
private static float version;
|
||||
|
||||
/* java.net.preferIPv4Stack */
|
||||
private static boolean preferIPv4Stack = false;
|
||||
|
||||
/* If the version supports a dual stack TCP implementation */
|
||||
private static boolean useDualStackImpl = false;
|
||||
|
||||
/* sun.net.useExclusiveBind */
|
||||
private static String exclBindProp;
|
||||
private static final boolean preferIPv4Stack;
|
||||
|
||||
/* True if exclusive binding is on for Windows */
|
||||
private static boolean exclusiveBind = true;
|
||||
private static final boolean exclusiveBind;
|
||||
|
||||
static {
|
||||
java.security.AccessController.doPrivileged( new PrivilegedAction<Object>() {
|
||||
public Object run() {
|
||||
version = 0;
|
||||
try {
|
||||
version = Float.parseFloat(System.getProperties().getProperty("os.version"));
|
||||
preferIPv4Stack = Boolean.parseBoolean(
|
||||
System.getProperties().getProperty("java.net.preferIPv4Stack"));
|
||||
exclBindProp = System.getProperty("sun.net.useExclusiveBind");
|
||||
} catch (NumberFormatException e ) {
|
||||
assert false : e;
|
||||
}
|
||||
return null; // nothing to return
|
||||
} });
|
||||
preferIPv4Stack = Boolean.parseBoolean(
|
||||
AccessController.doPrivileged(
|
||||
new GetPropertyAction("java.net.preferIPv4Stack")));
|
||||
|
||||
// (version >= 6.0) implies Vista or greater.
|
||||
if (version >= 6.0 && !preferIPv4Stack) {
|
||||
useDualStackImpl = true;
|
||||
}
|
||||
|
||||
if (exclBindProp != null) {
|
||||
// sun.net.useExclusiveBind is true
|
||||
exclusiveBind = exclBindProp.length() == 0 ? true
|
||||
: Boolean.parseBoolean(exclBindProp);
|
||||
} else if (version < 6.0) {
|
||||
exclusiveBind = false;
|
||||
}
|
||||
String exclBindProp = AccessController.doPrivileged(
|
||||
new GetPropertyAction("sun.net.useExclusiveBind", ""));
|
||||
exclusiveBind = (exclBindProp.isEmpty())
|
||||
? true
|
||||
: Boolean.parseBoolean(exclBindProp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Constructs an empty instance.
|
||||
*/
|
||||
PlainSocketImpl() {
|
||||
if (useDualStackImpl) {
|
||||
if (!preferIPv4Stack) {
|
||||
impl = new DualStackPlainSocketImpl(exclusiveBind);
|
||||
} else {
|
||||
impl = new TwoStacksPlainSocketImpl(exclusiveBind);
|
||||
|
Loading…
Reference in New Issue
Block a user