8344855: Remove calls to SecurityManager and doPrivileged in HTTP related implementation classes in the sun.net and sun.net.www.http packages after JEP 486 integration

Reviewed-by: jpai
This commit is contained in:
Daniel Fuchs 2024-11-25 09:56:07 +00:00
parent da4b7a8c56
commit d112f35d92
7 changed files with 52 additions and 166 deletions

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2004, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2004, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -27,8 +27,6 @@ package sun.net;
import jdk.internal.util.StaticProperty; import jdk.internal.util.StaticProperty;
import java.io.*; import java.io.*;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.Properties; import java.util.Properties;
/* /*
@ -39,18 +37,8 @@ import java.util.Properties;
* @author Jean-Christophe Collet * @author Jean-Christophe Collet
* *
*/ */
@SuppressWarnings("removal")
public class NetProperties { public class NetProperties {
private static Properties props = new Properties(); private static final Properties props = loadDefaultProperties(new Properties());
static {
AccessController.doPrivileged(
new PrivilegedAction<Void>() {
public Void run() {
loadDefaultProperties();
return null;
}});
}
private NetProperties() { }; private NetProperties() { };
@ -59,7 +47,7 @@ public class NetProperties {
* Loads the default networking system properties * Loads the default networking system properties
* the file is in jre/lib/net.properties * the file is in jre/lib/net.properties
*/ */
private static void loadDefaultProperties() { private static Properties loadDefaultProperties(Properties props) {
String fname = StaticProperty.javaHome(); String fname = StaticProperty.javaHome();
if (fname == null) { if (fname == null) {
throw new Error("Can't find java.home ??"); throw new Error("Can't find java.home ??");
@ -75,6 +63,7 @@ public class NetProperties {
// Do nothing. We couldn't find or access the file // Do nothing. We couldn't find or access the file
// so we won't have default properties... // so we won't have default properties...
} }
return props;
} }
/** /**
@ -82,9 +71,6 @@ public class NetProperties {
* returns the default value, if it exists, otherwise returns * returns the default value, if it exists, otherwise returns
* <code>null</code>. * <code>null</code>.
* @param key the property name. * @param key the property name.
* @throws SecurityException if a security manager exists and its
* <code>checkPropertiesAccess</code> method doesn't allow access
* to the system properties.
* @return the <code>String</code> value for the property, * @return the <code>String</code> value for the property,
* or <code>null</code> * or <code>null</code>
*/ */
@ -103,9 +89,6 @@ public class NetProperties {
* <code>null</code>. * <code>null</code>.
* @param key the property name. * @param key the property name.
* @param defval the default value to use if the property is not found * @param defval the default value to use if the property is not found
* @throws SecurityException if a security manager exists and its
* <code>checkPropertiesAccess</code> method doesn't allow access
* to the system properties.
* @return the <code>Integer</code> value for the property, * @return the <code>Integer</code> value for the property,
* or <code>null</code> * or <code>null</code>
*/ */
@ -131,9 +114,6 @@ public class NetProperties {
* defined returns the default value, if it exists, otherwise returns * defined returns the default value, if it exists, otherwise returns
* <code>null</code>. * <code>null</code>.
* @param key the property name. * @param key the property name.
* @throws SecurityException if a security manager exists and its
* <code>checkPropertiesAccess</code> method doesn't allow access
* to the system properties.
* @return the <code>Boolean</code> value for the property, * @return the <code>Boolean</code> value for the property,
* or <code>null</code> * or <code>null</code>
*/ */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1994, 2021, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,18 +28,14 @@ import java.io.*;
import java.net.Socket; import java.net.Socket;
import java.net.InetAddress; import java.net.InetAddress;
import java.net.InetSocketAddress; import java.net.InetSocketAddress;
import java.net.UnknownHostException;
import java.net.Proxy; import java.net.Proxy;
import java.util.Arrays; import java.util.Arrays;
import java.security.AccessController;
import java.security.PrivilegedAction;
/** /**
* This is the base class for network clients. * This is the base class for network clients.
* *
* @author Jonathan Payne * @author Jonathan Payne
*/ */
@SuppressWarnings("removal")
public class NetworkClient { public class NetworkClient {
/* Default value of read timeout, if not specified (infinity) */ /* Default value of read timeout, if not specified (infinity) */
public static final int DEFAULT_READ_TIMEOUT = -1; public static final int DEFAULT_READ_TIMEOUT = -1;
@ -66,26 +62,17 @@ public class NetworkClient {
protected static String encoding; protected static String encoding;
static { static {
final int vals[] = {0, 0}; int soTimeout = Integer.getInteger("sun.net.client.defaultReadTimeout", 0);
final String encs[] = { null }; if (soTimeout != 0) {
defaultSoTimeout = soTimeout;
AccessController.doPrivileged(
new PrivilegedAction<>() {
public Void run() {
vals[0] = Integer.getInteger("sun.net.client.defaultReadTimeout", 0).intValue();
vals[1] = Integer.getInteger("sun.net.client.defaultConnectTimeout", 0).intValue();
encs[0] = System.getProperty("file.encoding", "ISO8859_1");
return null;
}
});
if (vals[0] != 0) {
defaultSoTimeout = vals[0];
}
if (vals[1] != 0) {
defaultConnectTimeout = vals[1];
} }
encoding = encs[0]; int connTimeout = Integer.getInteger("sun.net.client.defaultConnectTimeout", 0);
if (connTimeout != 0) {
defaultConnectTimeout = connTimeout;
}
encoding = System.getProperty("file.encoding", "ISO8859_1");
try { try {
if (!isASCIISuperset (encoding)) { if (!isASCIISuperset (encoding)) {
encoding = "ISO8859_1"; encoding = "ISO8859_1";
@ -131,7 +118,7 @@ public class NetworkClient {
/** Open a connection to the server. */ /** Open a connection to the server. */
public void openServer(String server, int port) public void openServer(String server, int port)
throws IOException, UnknownHostException { throws IOException {
if (serverSocket != null) if (serverSocket != null)
closeServer(); closeServer();
serverSocket = doConnect (server, port); serverSocket = doConnect (server, port);
@ -150,15 +137,11 @@ public class NetworkClient {
* appropriate options pre-established * appropriate options pre-established
*/ */
protected Socket doConnect (String server, int port) protected Socket doConnect (String server, int port)
throws IOException, UnknownHostException { throws IOException {
Socket s; Socket s;
if (proxy != null) { if (proxy != null) {
if (proxy.type() == Proxy.Type.SOCKS) { if (proxy.type() == Proxy.Type.SOCKS) {
s = AccessController.doPrivileged( s = new Socket(proxy);
new PrivilegedAction<>() {
public Socket run() {
return new Socket(proxy);
}});
} else if (proxy.type() == Proxy.Type.DIRECT) { } else if (proxy.type() == Proxy.Type.DIRECT) {
s = createSocket(); s = createSocket();
} else { } else {
@ -203,13 +186,7 @@ public class NetworkClient {
protected InetAddress getLocalAddress() throws IOException { protected InetAddress getLocalAddress() throws IOException {
if (serverSocket == null) if (serverSocket == null)
throw new IOException("not connected"); throw new IOException("not connected");
return AccessController.doPrivileged( return serverSocket.getLocalAddress();
new PrivilegedAction<>() {
public InetAddress run() {
return serverSocket.getLocalAddress();
}
});
} }
/** Close an open connection to the server. */ /** Close an open connection to the server. */

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2009, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2009, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -65,13 +65,8 @@ public class HttpCapture {
private static synchronized void init() { private static synchronized void init() {
initialized = true; initialized = true;
@SuppressWarnings("removal")
String rulesFile = java.security.AccessController.doPrivileged( String rulesFile = NetProperties.get("sun.net.http.captureRules");
new java.security.PrivilegedAction<>() {
public String run() {
return NetProperties.get("sun.net.http.captureRules");
}
});
if (rulesFile != null && !rulesFile.isEmpty()) { if (rulesFile != null && !rulesFile.isEmpty()) {
BufferedReader in; BufferedReader in;
try { try {

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1994, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1994, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -42,7 +42,6 @@ import sun.net.www.protocol.http.AuthCacheImpl;
import sun.net.www.protocol.http.HttpURLConnection; import sun.net.www.protocol.http.HttpURLConnection;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*; import static sun.net.www.protocol.http.HttpURLConnection.TunnelState.*;
import sun.security.action.GetPropertyAction;
/** /**
* @author Herb Jellinek * @author Herb Jellinek
@ -70,10 +69,10 @@ public class HttpClient extends NetworkClient {
/** Response code for CONTINUE */ /** Response code for CONTINUE */
private boolean ignoreContinue = true; private boolean ignoreContinue = true;
private static final int HTTP_CONTINUE = 100; private static final int HTTP_CONTINUE = 100;
/** Default port number for http daemons. REMIND: make these private */ /** Default port number for http daemons. REMIND: make these private */
static final int httpPortNumber = 80; static final int httpPortNumber = 80;
/** return default port number (subclasses may override) */ /** return default port number (subclasses may override) */
protected int getDefaultPort () { return httpPortNumber; } protected int getDefaultPort () { return httpPortNumber; }
@ -194,7 +193,7 @@ public class HttpClient extends NetworkClient {
} }
static { static {
Properties props = GetPropertyAction.privilegedGetProperties(); Properties props = System.getProperties();
String keepAlive = props.getProperty("http.keepAlive"); String keepAlive = props.getProperty("http.keepAlive");
String retryPost = props.getProperty("sun.net.http.retryPost"); String retryPost = props.getProperty("sun.net.http.retryPost");
String cacheNTLM = props.getProperty("jdk.ntlm.cache"); String cacheNTLM = props.getProperty("jdk.ntlm.cache");
@ -243,11 +242,6 @@ public class HttpClient extends NetworkClient {
protected HttpClient() { protected HttpClient() {
} }
private HttpClient(URL url)
throws IOException {
this(url, (String)null, -1, false);
}
protected HttpClient(URL url, protected HttpClient(URL url,
boolean proxyDisabled) throws IOException { boolean proxyDisabled) throws IOException {
this(url, null, -1, proxyDisabled); this(url, null, -1, proxyDisabled);
@ -388,15 +382,6 @@ public class HttpClient extends NetworkClient {
ret.authcache = httpuc.getAuthCache(); ret.authcache = httpuc.getAuthCache();
} }
} else { } else {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
if (security != null) {
if (ret.proxy == Proxy.NO_PROXY || ret.proxy == null) {
security.checkConnect(InetAddress.getByName(url.getHost()).getHostAddress(), url.getPort());
} else {
security.checkConnect(url.getHost(), url.getPort());
}
}
ret.url = url; ret.url = url;
} }
return ret; return ret;
@ -571,29 +556,18 @@ public class HttpClient extends NetworkClient {
* be done; for proxy tunneling, the socket needs to be converted * be done; for proxy tunneling, the socket needs to be converted
* into an SSL socket before ssl handshake can take place. * into an SSL socket before ssl handshake can take place.
*/ */
public void afterConnect() throws IOException, UnknownHostException { public void afterConnect() throws IOException {
// NO-OP. Needs to be overwritten by HttpsClient // NO-OP. Needs to be overwritten by HttpsClient
} }
/* /*
* call openServer in a privileged block * call openServer
*/ */
@SuppressWarnings("removal") private void openServer(final InetSocketAddress server)
private void privilegedOpenServer(final InetSocketAddress server)
throws IOException throws IOException
{ {
assert clientLock.isHeldByCurrentThread(); assert clientLock.isHeldByCurrentThread();
try { openServer(server.getHostString(), server.getPort());
java.security.AccessController.doPrivileged(
new java.security.PrivilegedExceptionAction<>() {
public Void run() throws IOException {
openServer(server.getHostString(), server.getPort());
return null;
}
});
} catch (java.security.PrivilegedActionException pae) {
throw (IOException) pae.getException();
}
} }
/* /*
@ -601,7 +575,7 @@ public class HttpClient extends NetworkClient {
*/ */
private void superOpenServer(final String proxyHost, private void superOpenServer(final String proxyHost,
final int proxyPort) final int proxyPort)
throws IOException, UnknownHostException throws IOException
{ {
super.openServer(proxyHost, proxyPort); super.openServer(proxyHost, proxyPort);
} }
@ -610,14 +584,8 @@ public class HttpClient extends NetworkClient {
*/ */
protected void openServer() throws IOException { protected void openServer() throws IOException {
@SuppressWarnings("removal")
SecurityManager security = System.getSecurityManager();
lock(); lock();
try { try {
if (security != null) {
security.checkConnect(host, port);
}
if (keepingAlive) { // already opened if (keepingAlive) { // already opened
return; return;
@ -628,7 +596,7 @@ public class HttpClient extends NetworkClient {
if ((proxy != null) && (proxy.type() == Proxy.Type.HTTP)) { if ((proxy != null) && (proxy.type() == Proxy.Type.HTTP)) {
sun.net.www.URLConnection.setProxiedHost(host); sun.net.www.URLConnection.setProxiedHost(host);
privilegedOpenServer((InetSocketAddress) proxy.address()); openServer((InetSocketAddress) proxy.address());
usingProxy = true; usingProxy = true;
return; return;
} else { } else {
@ -644,7 +612,7 @@ public class HttpClient extends NetworkClient {
*/ */
if ((proxy != null) && (proxy.type() == Proxy.Type.HTTP)) { if ((proxy != null) && (proxy.type() == Proxy.Type.HTTP)) {
sun.net.www.URLConnection.setProxiedHost(host); sun.net.www.URLConnection.setProxiedHost(host);
privilegedOpenServer((InetSocketAddress) proxy.address()); openServer((InetSocketAddress) proxy.address());
usingProxy = true; usingProxy = true;
return; return;
} else { } else {
@ -663,7 +631,7 @@ public class HttpClient extends NetworkClient {
String fileName; String fileName;
/** /*
* proxyDisabled is set by subclass HttpsClient! * proxyDisabled is set by subclass HttpsClient!
*/ */
if (usingProxy && !proxyDisabled) { if (usingProxy && !proxyDisabled) {
@ -817,7 +785,7 @@ public class HttpClient extends NetworkClient {
keepAliveConnections = -1; keepAliveConnections = -1;
keepAliveTimeout = 0; keepAliveTimeout = 0;
boolean ret = false; boolean ret;
byte[] b = new byte[8]; byte[] b = new byte[8];
try { try {

View file

@ -30,8 +30,6 @@ import java.io.NotSerializableException;
import java.io.ObjectInputStream; import java.io.ObjectInputStream;
import java.io.ObjectOutputStream; import java.io.ObjectOutputStream;
import java.net.URL; import java.net.URL;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.ArrayDeque; import java.util.ArrayDeque;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -39,7 +37,6 @@ import java.util.List;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
import jdk.internal.misc.InnocuousThread; import jdk.internal.misc.InnocuousThread;
import sun.security.action.GetIntegerAction;
import sun.net.www.protocol.http.HttpURLConnection; import sun.net.www.protocol.http.HttpURLConnection;
import sun.util.logging.PlatformLogger; import sun.util.logging.PlatformLogger;
@ -69,10 +66,8 @@ public class KeepAliveCache
static final PlatformLogger logger = HttpURLConnection.getHttpLogger(); static final PlatformLogger logger = HttpURLConnection.getHttpLogger();
@SuppressWarnings("removal")
static int getUserKeepAliveSeconds(String type) { static int getUserKeepAliveSeconds(String type) {
int v = AccessController.doPrivileged( int v = Integer.getInteger(keepAliveProp+type, -1);
new GetIntegerAction(keepAliveProp+type, -1)).intValue();
return v < -1 ? -1 : v; return v < -1 ? -1 : v;
} }
@ -89,12 +84,9 @@ public class KeepAliveCache
*/ */
static final int MAX_CONNECTIONS = 5; static final int MAX_CONNECTIONS = 5;
static int result = -1; static int result = -1;
@SuppressWarnings("removal")
static int getMaxConnections() { static int getMaxConnections() {
if (result == -1) { if (result == -1) {
result = AccessController.doPrivileged( result = Integer.getInteger("http.maxConnections", MAX_CONNECTIONS);
new GetIntegerAction("http.maxConnections", MAX_CONNECTIONS))
.intValue();
if (result <= 0) { if (result <= 0) {
result = MAX_CONNECTIONS; result = MAX_CONNECTIONS;
} }
@ -119,7 +111,6 @@ public class KeepAliveCache
* @param url The URL contains info about the host and port * @param url The URL contains info about the host and port
* @param http The HttpClient to be cached * @param http The HttpClient to be cached
*/ */
@SuppressWarnings("removal")
public void put(final URL url, Object obj, HttpClient http) { public void put(final URL url, Object obj, HttpClient http) {
// this method may need to close an HttpClient, either because // this method may need to close an HttpClient, either because
// it is not cacheable, or because the cache is at its capacity. // it is not cacheable, or because the cache is at its capacity.
@ -144,15 +135,10 @@ public class KeepAliveCache
* The robustness to get around this is in HttpClient.parseHTTP() * The robustness to get around this is in HttpClient.parseHTTP()
*/ */
final KeepAliveCache cache = this; final KeepAliveCache cache = this;
AccessController.doPrivileged(new PrivilegedAction<>() { keepAliveTimer = InnocuousThread.newSystemThread("Keep-Alive-Timer", cache);
public Void run() { keepAliveTimer.setDaemon(true);
keepAliveTimer = InnocuousThread.newSystemThread("Keep-Alive-Timer", cache); keepAliveTimer.setPriority(Thread.MAX_PRIORITY - 2);
keepAliveTimer.setDaemon(true); keepAliveTimer.start();
keepAliveTimer.setPriority(Thread.MAX_PRIORITY - 2);
keepAliveTimer.start();
return null;
}
});
} }
KeepAliveKey key = new KeepAliveKey(url, obj); KeepAliveKey key = new KeepAliveKey(url, obj);

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 1996, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -176,16 +176,10 @@ class KeepAliveStream extends MeteredStream implements Hurryable {
} }
if (startCleanupThread) { if (startCleanupThread) {
java.security.AccessController.doPrivileged( cleanerThread = InnocuousThread.newSystemThread("Keep-Alive-SocketCleaner", queue);
new java.security.PrivilegedAction<Void>() { cleanerThread.setDaemon(true);
public Void run() { cleanerThread.setPriority(Thread.MAX_PRIORITY - 2);
cleanerThread = InnocuousThread.newSystemThread("Keep-Alive-SocketCleaner", queue); cleanerThread.start();
cleanerThread.setDaemon(true);
cleanerThread.setPriority(Thread.MAX_PRIORITY - 2);
cleanerThread.start();
return null;
}
});
} }
} finally { } finally {
queue.unlock(); queue.unlock();

View file

@ -1,5 +1,5 @@
/* /*
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved. * Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
* *
* This code is free software; you can redistribute it and/or modify it * This code is free software; you can redistribute it and/or modify it
@ -28,18 +28,16 @@ package sun.net.www.http;
import java.io.IOException; import java.io.IOException;
import java.util.LinkedList; import java.util.LinkedList;
import sun.net.NetProperties; import sun.net.NetProperties;
import java.security.AccessController;
import java.security.PrivilegedAction;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition; import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.ReentrantLock; import java.util.concurrent.locks.ReentrantLock;
/** /**
* This class is used to cleanup any remaining data that may be on a KeepAliveStream * This class is used to clean up any remaining data that may be on a KeepAliveStream
* so that the connection can be cached in the KeepAliveCache. * so that the connection can be cached in the KeepAliveCache.
* Instances of this class can be used as a FIFO queue for KeepAliveCleanerEntry objects. * Instances of this class can be used as a FIFO queue for KeepAliveCleanerEntry objects.
* Executing this Runnable removes each KeepAliveCleanerEntry from the Queue, reads * Executing this Runnable removes each KeepAliveCleanerEntry from the Queue, reads
* the reamining bytes on its KeepAliveStream, and if successful puts the connection in * the remaining bytes on its KeepAliveStream, and if successful puts the connection in
* the KeepAliveCache. * the KeepAliveCache.
* *
* @author Chris Hegarty * @author Chris Hegarty
@ -50,8 +48,8 @@ class KeepAliveStreamCleaner
extends LinkedList<KeepAliveCleanerEntry> extends LinkedList<KeepAliveCleanerEntry>
implements Runnable implements Runnable
{ {
// maximum amount of remaining data that we will try to cleanup // maximum amount of remaining data that we will try to clean up
protected static final int MAX_DATA_REMAINING; protected static final long MAX_DATA_REMAINING;
// maximum amount of KeepAliveStreams to be queued // maximum amount of KeepAliveStreams to be queued
protected static final int MAX_CAPACITY; protected static final int MAX_CAPACITY;
@ -64,22 +62,10 @@ class KeepAliveStreamCleaner
static { static {
final String maxDataKey = "http.KeepAlive.remainingData"; final String maxDataKey = "http.KeepAlive.remainingData";
@SuppressWarnings("removal") MAX_DATA_REMAINING = NetProperties.getInteger(maxDataKey, 512) * 1024L;
int maxData = AccessController.doPrivileged(
new PrivilegedAction<Integer>() {
public Integer run() {
return NetProperties.getInteger(maxDataKey, 512);
}}).intValue() * 1024;
MAX_DATA_REMAINING = maxData;
final String maxCapacityKey = "http.KeepAlive.queuedConnections"; final String maxCapacityKey = "http.KeepAlive.queuedConnections";
@SuppressWarnings("removal") MAX_CAPACITY = NetProperties.getInteger(maxCapacityKey, 10);
int maxCapacity = AccessController.doPrivileged(
new PrivilegedAction<Integer>() {
public Integer run() {
return NetProperties.getInteger(maxCapacityKey, 10);
}}).intValue();
MAX_CAPACITY = maxCapacity;
} }