Java System Properties
Quick Reference Guide


http.maxConnections Java System Property

The http.maxConnections java system property determines how many keep alive connections are kept.

Default Value

5

Overview of http.maxConnections

When the http.keepAlive system property is true the http.maxConnections property determines how many connections are kept alive.

This applies to HTTP or HTTPS connections is made via an api provided by the Java SDK (for example HttpsURLConnection or URL.openStream()).

Related System Properties

Here are some other networking Java system properties:

Supported Since

Java has supported the http.maxConnections system property since at least version 1.6, support may go back to even older versions of java.

Setting http.maxConnections on Startup

You can set the http.maxConnections java system property during startup of the java runtime using the -D command line argument:

java -Dhttp.maxConnections=10 MyAppMain

You may also be able to specify http.maxConnections via the JAVA_TOOL_OPTIONS environment variable:

JAVA_TOOL_OPTIONS=-Dhttp.maxConnections=10

Setting / Reading http.maxConnections at Runtime

You can set http.maxConnections at runtime with the following Java code:

System.setProperty("http.maxConnections", "10");

WARNING: Depending on the property and JVM version using setProperty may or may not work if the JDK Java class that uses this variable has already been loaded. The value of the http.maxConnections system property may be cached within an internal private static variable of the implementing class.

To read the value of http.maxConnections at runtime, you can use this Java code:

String propertyValue = System.getProperty("http.maxConnections");
if (propertyValue != null) {
    System.out.println("http.maxConnections = " + propertyValue);
} else {
    System.out.println("http.maxConnections was null");
}