2

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.

danieln
  • 4,795
  • 10
  • 42
  • 64
  • possible duplicate of [java.net.SocketTimeoutException on embedded tomcat with jersey](http://stackoverflow.com/questions/21550369/java-net-sockettimeoutexception-on-embedded-tomcat-with-jersey) – user207421 Feb 05 '14 at 08:55

1 Answers1

2

Found it!

org.apache.catalina.connector.Connector#setProperty

For example:

httpConnector.setProperty("soTimeout", "50000");
danieln
  • 4,795
  • 10
  • 42
  • 64