Question

How can I modify the read timeout for embedded tomcat?
From Apache Tomcat Configuration Reference:

socket.soTimeout
Value in milliseconds for the sockets read timeout (SO_TIMEOUT). Default value is 5000 milliseconds.

I've tried the following

    httpConnector.setAttribute("channelNioSocket.soTimeout", 1);
    httpConnector.setAttribute("soTimeout", 1);
    httpConnector.setAttribute("SO_TIMEOUT", 1);

I expected to get SocketTimeoutException as I changed the value to 1 millisecond, but didn't, so I assume it's not working.

Was it helpful?

Solution

Found it!

org.apache.catalina.connector.Connector#setProperty

For example:

httpConnector.setProperty("soTimeout", "50000");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top