Spring boot release 2.2.4
when I write a controller:
@RestController
public class Hello {
@GetMapping("list")
public List<String> list() {
List list = new ArrayList();
list.add("lxm");
return list;
}
@GetMapping("hello")
public String hello() {
return "lxm";
}
}
get "localhost:8080/list" twice in a clinet which set keepalive=true, the socket is closed, and I get the log:
2020-08-11 11:11:12.966 DEBUG 7136 --- [nio-8080-exec-7] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@1356d886:org.apache.tomcat.util.net.NioChannel@7765be10:java.nio.channels.SocketChannel[connected local=/10.6.227.126:8080 remote=/10.6.136.48:7768]], Status in: [OPEN_READ], State out: [CLOSED]
2020-08-11 11:11:12.966 DEBUG 7136 --- [nio-8080-exec-7] o.apache.tomcat.util.threads.LimitLatch : Counting down[http-nio-8080-exec-7] latch=1
however when get "localhost:8080/hello" twice in a clinet which set keepalive=true, the socket is keep open, and the log:
2020-08-11 11:16:44.752 DEBUG 7136 --- [nio-8080-exec-2] m.m.a.RequestResponseBodyMethodProcessor : Writing ["lxm"]
2020-08-11 11:16:44.753 DEBUG 7136 --- [nio-8080-exec-2] o.s.web.servlet.DispatcherServlet : Completed 200 OK
2020-08-11 11:16:44.753 DEBUG 7136 --- [nio-8080-exec-2] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@a74259:org.apache.tomcat.util.net.NioChannel@7765be10:java.nio.channels.SocketChannel[connected local=/10.6.227.126:8080 remote=/10.6.136.48:10024]], Read from buffer: [0]
2020-08-11 11:16:44.754 DEBUG 7136 --- [nio-8080-exec-2] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@a74259:org.apache.tomcat.util.net.NioChannel@7765be10:java.nio.channels.SocketChannel[connected local=/10.6.227.126:8080 remote=/10.6.136.48:10024]], Read direct from socket: [0]
2020-08-11 11:16:44.754 DEBUG 7136 --- [nio-8080-exec-2] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@a74259:org.apache.tomcat.util.net.NioChannel@7765be10:java.nio.channels.SocketChannel[connected local=/10.6.227.126:8080 remote=/10.6.136.48:10024]], Status in: [OPEN_READ], State out: [OPEN]
that is strange.