-
Bug
-
Resolution: Done
-
Major
-
jboss-fuse-6.2.1
-
None
-
%
- We do not have any test cases or CXF systests so far that can demonstrate how AsyncHTTPConduitFactory.CONNECTION_TTL should work.
- We updated the CXF doc for this parameter, https://cwiki.apache.org/confluence/display/CXF20DOC/Asynchronous+Client+HTTP+Transport
Attached is the test case you will find.
This is how to do it:
- start your test
- on a console, use repeatedly the command "netstat | findstr 8123" (Windows ) or "netstat | grep 8123" (Linux) You will see that the connection is indeed dropped after 5 seconds.
This a capture of my console showing that the connection status switches from ESTABLISHED to TIME_WAIT (which means that the connection was closed)
Z:\java>echo %time%
10:09:57.59
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1815 bewx823:8123 ESTABLISHED
TCP 127.0.0.1:8123 bewx823:1815 ESTABLISHED
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1815 bewx823:8123 ESTABLISHED
TCP 127.0.0.1:8123 bewx823:1815 ESTABLISHED
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1815 bewx823:8123 ESTABLISHED
TCP 127.0.0.1:8123 bewx823:1815 ESTABLISHED
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1815 bewx823:8123 TIME_WAIT
Z:\java>echo %time%
10:10:05.66
Moreover, I did two additional tests:
1. I modified your test to execute two requests at an interval of 4 seconds:
service.sayHello("Viral");
Thread.sleep(4000);
service.sayHello("Viral");
Thread.sleep(120000);
You can then see that the connection is reused for both requests. The connection with the client port 1965 is maintained open for 9 seconds (5 seconds after the second request)
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1965 bewx823:8123 ESTABLISHED
TCP 127.0.0.1:8123 bewx823:1965 ESTABLISHED
2. I execute the two requests at an interval of 6 seconds:
service.sayHello("Viral");
Thread.sleep(6000);
service.sayHello("Viral");
Thread.sleep(120000);
You can then see that the connection is not reused. One connection is closed (with the client port 1921 ), and another one is being opened (with the client port 1922)
Z:\java> netstat | findstr 8123
TCP 127.0.0.1:1921 bewx823:8123 TIME_WAIT
TCP 127.0.0.1:1922 bewx823:8123 ESTABLISHED
TCP 127.0.0.1:8123 bewx823:1922 ESTABLISHED
It seems that ReceiveTimeout default value always takes preference for this. We don't have any idea how the CONNECTION_TTL works.