?????? ?????? ?????? why only 2 requests for async request can raise from a end-point?

2015-06-30 Thread ????
sorry, it's a .net problem


.net - How can I programmatically remove the 2 connection limit in WebClient - 
Stack Overflow
http://stackoverflow.com/questions/866350/how-can-i-programmatically-remove-the-2-connection-limit-in-webclient



There is a limit in the number of simultaneous outgoing HTTP connections. I 
think you can control this by using the 
System.Net.ServicePointManager.DefaultConnectionLimit static property before 
creating the HttpWebRequest objects.




--  --
??: "";;
: 2015??7??1??(??) 11:42
??: "users"; 

????: ?? ?? ?????? why only 2 requests for async request can raise from 
a end-point?



Hi Christopher,


after your advise, i recheck all arround, and it's really raise from the c# 
test program.  :(


there is a bug in WebRequest, i dont know what happend in this class, since 
requesting to localhost is ok. and if pure Socket, or 
WebClient.DownloadStringAsync wont meet this bug. if not your firm advice, i 
will never doubt about this.




Best Regards


--  --
??: "Christopher Schultz";;
: 2015??7??1??(??) 2:00
??: "Tomcat Users List"; 

????: Re: ?????? ?? why only 2 requests for async request can raise from a 
end-point?



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

,

On 6/30/15 1:22 PM,  wrote:
> yes, i connect tomcat directly, port is 8080.
> 
> I wrote the test tool in pure non-block mode, so just one thread
> in c#, and i used webbrowser, wget, telnet to perform this test
> too.

So you have a single thread managing multiple WS connections to
Tomcat? What I'm trying to determine is how many connections you are
actually opening. How many connections is the CLR willing to open to a
single WS endpoint?

> It's very strange that it wont happen when the tomcat run in 
> localhost, this problem exist only between different machines. and
> I had write a simple echo server for compare, the echo server can 
> accept many connection as expected.
> 
> now i run tomcat in embed mode, hope i can find out what
> happened...

I wonder if this is something the CLR is doing to you. Can you
instrument the client as well as the server?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVktklAAoJEBzwKT+lPKRYs1cQAJ9xWApemBJHwhMoMHfuoQMQ
DMj6cQDrvrgo3Ahq4LKlhnhc/Sszjp4wpBcpBBD8ZfkTwArn3aE07ZPPjmY/3epF
EZS0aezKMPCsSngCBYj1qMEbSwTwMFdD7ofC9OW1E7z31wOfuZ2G8/XXjWdis19R
wtXyrMLZf1ZBTmdUvDR6wugbNqOqvVHkhvubgIdjK6uzbBhYrX3c+Dm6f3tIUMOq
oNMzBaeCQcILqibm9hkFK4gpIEDNI3R2EqippDu1bMcuJImNPi5vzlT0KbpzJIH4
sKubU322QIReqcG/4R+wCfNAIC0JM7fZKEj8rJonYLlvDd7KdhoPFD3xOs2uNZrw
zeksSFWJmTFuRYwGzP+X4vmXIekcRu3Wdls+lPUvy8sZKqnRJp7Wr9SN97V/7gHC
AatxKsDLsI5NvS8C1TeYqLc52Umby3ivJbzSR9T2WWy30UcoWFhYMwu1dftkgra5
rJNOgw2Ke95XQHCR1mlcZyD00l8ZzpIAU7jirTq1gSYj94t+GzGjTcN1a7GV/r2d
v8pwDNAgJbeEzMBtxFsHsZOFM4GJbX/Qx+i/j6/f6zvWCEwUmMd7mNl4/SZ/aHlm
XiaVSrXdVUDzMZqGQX9Lzsgf1SHurGCMy2J5uGijMiR3FpuzcjPoD1u5/DrGo02d
qRdyDzdNdCeygcOQbCDS
=Wmnl
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

?????? ?????? ?????? why only 2 requests for async request can raise from a end-point?

2015-06-30 Thread ????
Hi Christopher,


after your advise, i recheck all arround, and it's really raise from the c# 
test program.  :(


there is a bug in WebRequest, i dont know what happend in this class, since 
requesting to localhost is ok. and if pure Socket, or 
WebClient.DownloadStringAsync wont meet this bug. if not your firm advice, i 
will never doubt about this.




Best Regards


--  --
??: "Christopher Schultz";;
: 2015??7??1??(??) 2:00
??: "Tomcat Users List"; 

????: Re: ?? ?????? why only 2 requests for async request can raise from a 
end-point?



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

,

On 6/30/15 1:22 PM,  wrote:
> yes, i connect tomcat directly, port is 8080.
> 
> I wrote the test tool in pure non-block mode, so just one thread
> in c#, and i used webbrowser, wget, telnet to perform this test
> too.

So you have a single thread managing multiple WS connections to
Tomcat? What I'm trying to determine is how many connections you are
actually opening. How many connections is the CLR willing to open to a
single WS endpoint?

> It's very strange that it wont happen when the tomcat run in 
> localhost, this problem exist only between different machines. and
> I had write a simple echo server for compare, the echo server can 
> accept many connection as expected.
> 
> now i run tomcat in embed mode, hope i can find out what
> happened...

I wonder if this is something the CLR is doing to you. Can you
instrument the client as well as the server?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVktklAAoJEBzwKT+lPKRYs1cQAJ9xWApemBJHwhMoMHfuoQMQ
DMj6cQDrvrgo3Ahq4LKlhnhc/Sszjp4wpBcpBBD8ZfkTwArn3aE07ZPPjmY/3epF
EZS0aezKMPCsSngCBYj1qMEbSwTwMFdD7ofC9OW1E7z31wOfuZ2G8/XXjWdis19R
wtXyrMLZf1ZBTmdUvDR6wugbNqOqvVHkhvubgIdjK6uzbBhYrX3c+Dm6f3tIUMOq
oNMzBaeCQcILqibm9hkFK4gpIEDNI3R2EqippDu1bMcuJImNPi5vzlT0KbpzJIH4
sKubU322QIReqcG/4R+wCfNAIC0JM7fZKEj8rJonYLlvDd7KdhoPFD3xOs2uNZrw
zeksSFWJmTFuRYwGzP+X4vmXIekcRu3Wdls+lPUvy8sZKqnRJp7Wr9SN97V/7gHC
AatxKsDLsI5NvS8C1TeYqLc52Umby3ivJbzSR9T2WWy30UcoWFhYMwu1dftkgra5
rJNOgw2Ke95XQHCR1mlcZyD00l8ZzpIAU7jirTq1gSYj94t+GzGjTcN1a7GV/r2d
v8pwDNAgJbeEzMBtxFsHsZOFM4GJbX/Qx+i/j6/f6zvWCEwUmMd7mNl4/SZ/aHlm
XiaVSrXdVUDzMZqGQX9Lzsgf1SHurGCMy2J5uGijMiR3FpuzcjPoD1u5/DrGo02d
qRdyDzdNdCeygcOQbCDS
=Wmnl
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Re: 回复: 回复: why only 2 requests for async request can raise from a end-point?

2015-06-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

许明,

On 6/30/15 1:22 PM, 许明 wrote:
> yes, i connect tomcat directly, port is 8080.
> 
> I wrote the test tool in pure non-block mode, so just one thread
> in c#, and i used webbrowser, wget, telnet to perform this test
> too.

So you have a single thread managing multiple WS connections to
Tomcat? What I'm trying to determine is how many connections you are
actually opening. How many connections is the CLR willing to open to a
single WS endpoint?

> It's very strange that it wont happen when the tomcat run in 
> localhost, this problem exist only between different machines. and
> I had write a simple echo server for compare, the echo server can 
> accept many connection as expected.
> 
> now i run tomcat in embed mode, hope i can find out what
> happened...

I wonder if this is something the CLR is doing to you. Can you
instrument the client as well as the server?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVktklAAoJEBzwKT+lPKRYs1cQAJ9xWApemBJHwhMoMHfuoQMQ
DMj6cQDrvrgo3Ahq4LKlhnhc/Sszjp4wpBcpBBD8ZfkTwArn3aE07ZPPjmY/3epF
EZS0aezKMPCsSngCBYj1qMEbSwTwMFdD7ofC9OW1E7z31wOfuZ2G8/XXjWdis19R
wtXyrMLZf1ZBTmdUvDR6wugbNqOqvVHkhvubgIdjK6uzbBhYrX3c+Dm6f3tIUMOq
oNMzBaeCQcILqibm9hkFK4gpIEDNI3R2EqippDu1bMcuJImNPi5vzlT0KbpzJIH4
sKubU322QIReqcG/4R+wCfNAIC0JM7fZKEj8rJonYLlvDd7KdhoPFD3xOs2uNZrw
zeksSFWJmTFuRYwGzP+X4vmXIekcRu3Wdls+lPUvy8sZKqnRJp7Wr9SN97V/7gHC
AatxKsDLsI5NvS8C1TeYqLc52Umby3ivJbzSR9T2WWy30UcoWFhYMwu1dftkgra5
rJNOgw2Ke95XQHCR1mlcZyD00l8ZzpIAU7jirTq1gSYj94t+GzGjTcN1a7GV/r2d
v8pwDNAgJbeEzMBtxFsHsZOFM4GJbX/Qx+i/j6/f6zvWCEwUmMd7mNl4/SZ/aHlm
XiaVSrXdVUDzMZqGQX9Lzsgf1SHurGCMy2J5uGijMiR3FpuzcjPoD1u5/DrGo02d
qRdyDzdNdCeygcOQbCDS
=Wmnl
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



?????? ?????? why only 2 requests for async request can raise from a end-point?

2015-06-30 Thread ????
Hi, Christopher,


yes, i connect tomcat directly, port is 8080.


I wrote the test tool in pure non-block mode, so just one thread in c#, and i 
used webbrowser, wget, telnet to perform this test too. 


It's very strange that it wont happen when the tomcat run in localhost, this 
problem exist only between different machines. and I had write a simple echo 
server for compare, the echo server can accept many connection as expected.


now i run tomcat in embed mode, hope i can find out what happened...


Thanks




--  --
??: "Christopher Schultz";;
: 2015??7??1??(??) 1:04
??: "Tomcat Users List"; 

????: Re: ?????? why only 2 requests for async request can raise from a 
end-point?



-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

,

On 6/29/15 5:37 AM,  wrote:
> I wrote a test tool with c#, not with browser, and each request
> has it's own session, that browser not support now.
> 
> And, PHP and IIS can change option to set the limitation of one 
> end-point requests, so i can't agree browser has this limit.
> 
> I have run tomcat in localhost, and 100 requests are allowed, it's 
> only appear when the server and client run on different machine.

Are you connecting directly to Tomcat, or are you connecting through IIS
?

How many threads are you starting in your C# driver?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVkswtAAoJEBzwKT+lPKRY63YP/iDSLQRyZF9rzpKmj1Y+zzGw
wByBGhbT/kjUpTZ5nCOz7b3alDhJCiZ5EHXdC5h9vAiQWp0nM1VUz7uDpH0wrAxp
97xxR4BzTmwE+HzvehXWP6gpw3UZkWN4ILEi51qyYYkCVyy2ZxO3D2jDXHMvM4Aj
rdUrktB7rDhLKi/0RB18NjfmIWxvWF1HbXaEkFK6NZh0bu0B7mVuKmba2bJmFJRM
OCMaeP8WC1//2DH2+S4/QWro++tugFUE+vV+xUsW2kd4DEtczi6ZwvGnCD7uuyZc
a2T/eDe0GDP4aguBGJkP/l61X1NHHnW5vLAx26/b6f4ZJCZ9yXOdxt4b0tihHVXq
aGgcHnL6P2Z39HZZpDAdRQ46XzohkVfd4zcb+QTAEZzjzvy7r0u/Y/s4WwZwxZYk
jTMM1FEfezbiTVkd+Kvc21s8HLGHa/Ftb0m8Ywt9ISWmCWUdOMY8RNPsQ0oa6TNH
LQ9luPgg8tAe5o4aK2q1MLV9BjbrzcPCWYGMPHLCZ3rCRWj1llAmcYO9Y5VxT2xT
zirtT9VWE5hc6bYQI1irNrpPQblOBJOJlzVE4Gbb4EY87fGJZKVx6DXfXnQiy0SS
ib787uUqCiSTXbS7Jw0uZOlhRj1T5UvjzV++FTYdcH5xCIqQasvBXb6LzfLp0A8+
B48cov2uWgAQ61a+Qg7B
=w5AE
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Re: 回复: why only 2 requests for async request can raise from a end-point?

2015-06-30 Thread Christopher Schultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA256

许明,

On 6/29/15 5:37 AM, 许明 wrote:
> I wrote a test tool with c#, not with browser, and each request
> has it's own session, that browser not support now.
> 
> And, PHP and IIS can change option to set the limitation of one 
> end-point requests, so i can't agree browser has this limit.
> 
> I have run tomcat in localhost, and 100 requests are allowed, it's 
> only appear when the server and client run on different machine.

Are you connecting directly to Tomcat, or are you connecting through IIS
?

How many threads are you starting in your C# driver?

- -chris
-BEGIN PGP SIGNATURE-
Comment: GPGTools - http://gpgtools.org

iQIcBAEBCAAGBQJVkswtAAoJEBzwKT+lPKRY63YP/iDSLQRyZF9rzpKmj1Y+zzGw
wByBGhbT/kjUpTZ5nCOz7b3alDhJCiZ5EHXdC5h9vAiQWp0nM1VUz7uDpH0wrAxp
97xxR4BzTmwE+HzvehXWP6gpw3UZkWN4ILEi51qyYYkCVyy2ZxO3D2jDXHMvM4Aj
rdUrktB7rDhLKi/0RB18NjfmIWxvWF1HbXaEkFK6NZh0bu0B7mVuKmba2bJmFJRM
OCMaeP8WC1//2DH2+S4/QWro++tugFUE+vV+xUsW2kd4DEtczi6ZwvGnCD7uuyZc
a2T/eDe0GDP4aguBGJkP/l61X1NHHnW5vLAx26/b6f4ZJCZ9yXOdxt4b0tihHVXq
aGgcHnL6P2Z39HZZpDAdRQ46XzohkVfd4zcb+QTAEZzjzvy7r0u/Y/s4WwZwxZYk
jTMM1FEfezbiTVkd+Kvc21s8HLGHa/Ftb0m8Ywt9ISWmCWUdOMY8RNPsQ0oa6TNH
LQ9luPgg8tAe5o4aK2q1MLV9BjbrzcPCWYGMPHLCZ3rCRWj1llAmcYO9Y5VxT2xT
zirtT9VWE5hc6bYQI1irNrpPQblOBJOJlzVE4Gbb4EY87fGJZKVx6DXfXnQiy0SS
ib787uUqCiSTXbS7Jw0uZOlhRj1T5UvjzV++FTYdcH5xCIqQasvBXb6LzfLp0A8+
B48cov2uWgAQ61a+Qg7B
=w5AE
-END PGP SIGNATURE-

-
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org



?????? why only 2 requests for async request can raise from a end-point?

2015-06-29 Thread ????
Hi,


I wrote a test tool with c#, not with browser, and each request has it's own 
session, that browser not support now.


And, PHP and IIS can change option to set the limitation of one end-point 
requests, so i can't agree browser has this limit.


I have run tomcat in localhost, and 100 requests are allowed, it's only appear 
when the server and client run on different machine.


Best Regards,
Hsuming


--  --
??: "Ari Luoma";;
: 2015??6??29??(??) 5:18
??: "Tomcat Users List"; 

: Re: why only 2 requests for async request can raise from a end-point?



Hi,

The number of concurrent connections is limited by the browser:
http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browse

Best Regards,
Ari Luoma


On Mon, Jun 29, 2015 at 12:08 PM,   wrote:

> Hi,
>
> I am trying to bench async servlet, tomcat7 and tomcat8, now it's seems I
> can only start 2 request from a end-point.
>
>
> I make a simple tool, start 100 request same time, each request has own
> session, and write a simple async servlet, which pasted in the bottom of
> this mail.
>
>
> It's the result:
>
>
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 1
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 2
> 06-29 16:29:02 633 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 637 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 642 INFO  (Test.java:35)- test serve 3
> 06-29 16:29:02 677 INFO  (Test.java:35)- test serve 4
> 06-29 16:29:12 647 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:12 650 INFO  (Test.java:35)- test serve 5
> 06-29 16:29:12 682 INFO  (Test.java:35)- test serve 6
> 
>
>
> i have test this on tomcat7 and tomcat8 in windows and linux(ubuntu), and
> test it in browser manually.
>
>
> Best Regards
>
>
> ===
> my Test servlet:
> ===
>
>
> package com.botao.im;
>
>
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.util.concurrent.Executors;
> import java.util.concurrent.ScheduledExecutorService;
> import java.util.concurrent.TimeUnit;
>
>
> import javax.servlet.AsyncContext;
> import javax.servlet.ServletException;
> import javax.servlet.annotation.WebServlet;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
>
> import org.apache.log4j.Logger;
>
>
> /**
>  * Servlet implementation class Test
>  */
> @WebServlet(asyncSupported = true, name = "test", urlPatterns = { "/test"
> })
> public class Test extends HttpServlet {
> private static final long serialVersionUID = 1L;
>
>
> private static Logger logger = Logger.getLogger(Test.class);
>
> private static ScheduledExecutorService es =
> Executors.newSingleThreadScheduledExecutor();
>
> private static int counter = 0;
>
> protected void doGet(HttpServletRequest request, final
> HttpServletResponse response) throws ServletException, IOException {
>
> logger.info("test serve " + (++counter ));
> final AsyncContext context = request.startAsync();
>
>
> context.start(new Runnable() {
>
> @Override
> public void run() {
> context.setTimeout(100);
>  es.schedule(new Runnable(){
>
>
> @Override
> public void run() {
>
> response.setContentType("text/plain");
> PrintWriter out;
> try {
> out =
> response.getWriter();
>
> out.print("hello");
>
> out.flush();
>
> context.complete();
>
> logger.debug("timout and  print");
> } catch
> (IOException e) {
> }
>
> }
>
>  }, 10, TimeUnit.SECONDS);
> }
> });
>
> }
>
>
>
>
> }

Re: why only 2 requests for async request can raise from a end-point?

2015-06-29 Thread Ari Luoma
Hi,

The number of concurrent connections is limited by the browser:
http://stackoverflow.com/questions/561046/how-many-concurrent-ajax-xmlhttprequest-requests-are-allowed-in-popular-browse

Best Regards,
Ari Luoma


On Mon, Jun 29, 2015 at 12:08 PM, 许明  wrote:

> Hi,
>
> I am trying to bench async servlet, tomcat7 and tomcat8, now it's seems I
> can only start 2 request from a end-point.
>
>
> I make a simple tool, start 100 request same time, each request has own
> session, and write a simple async servlet, which pasted in the bottom of
> this mail.
>
>
> It's the result:
>
>
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 1
> 06-29 16:28:52 622 INFO  (Test.java:35)- test serve 2
> 06-29 16:29:02 633 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 637 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:02 642 INFO  (Test.java:35)- test serve 3
> 06-29 16:29:02 677 INFO  (Test.java:35)- test serve 4
> 06-29 16:29:12 647 DEBUG (Test.java:54)- timout and  print
> 06-29 16:29:12 650 INFO  (Test.java:35)- test serve 5
> 06-29 16:29:12 682 INFO  (Test.java:35)- test serve 6
> 
>
>
> i have test this on tomcat7 and tomcat8 in windows and linux(ubuntu), and
> test it in browser manually.
>
>
> Best Regards
>
>
> ===
> my Test servlet:
> ===
>
>
> package com.botao.im;
>
>
> import java.io.IOException;
> import java.io.PrintWriter;
> import java.util.concurrent.Executors;
> import java.util.concurrent.ScheduledExecutorService;
> import java.util.concurrent.TimeUnit;
>
>
> import javax.servlet.AsyncContext;
> import javax.servlet.ServletException;
> import javax.servlet.annotation.WebServlet;
> import javax.servlet.http.HttpServlet;
> import javax.servlet.http.HttpServletRequest;
> import javax.servlet.http.HttpServletResponse;
>
>
> import org.apache.log4j.Logger;
>
>
> /**
>  * Servlet implementation class Test
>  */
> @WebServlet(asyncSupported = true, name = "test", urlPatterns = { "/test"
> })
> public class Test extends HttpServlet {
> private static final long serialVersionUID = 1L;
>
>
> private static Logger logger = Logger.getLogger(Test.class);
>
> private static ScheduledExecutorService es =
> Executors.newSingleThreadScheduledExecutor();
>
> private static int counter = 0;
>
> protected void doGet(HttpServletRequest request, final
> HttpServletResponse response) throws ServletException, IOException {
>
> logger.info("test serve " + (++counter ));
> final AsyncContext context = request.startAsync();
>
>
> context.start(new Runnable() {
>
> @Override
> public void run() {
> context.setTimeout(100);
>  es.schedule(new Runnable(){
>
>
> @Override
> public void run() {
>
> response.setContentType("text/plain");
> PrintWriter out;
> try {
> out =
> response.getWriter();
>
> out.print("hello");
>
> out.flush();
>
> context.complete();
>
> logger.debug("timout and  print");
> } catch
> (IOException e) {
> }
>
> }
>
>  }, 10, TimeUnit.SECONDS);
> }
> });
>
> }
>
>
>
>
> }


why only 2 requests for async request can raise from a end-point?

2015-06-29 Thread ????
Hi, 

I am trying to bench async servlet, tomcat7 and tomcat8, now it's seems I can 
only start 2 request from a end-point.


I make a simple tool, start 100 request same time, each request has own 
session, and write a simple async servlet, which pasted in the bottom of this 
mail.


It's the result:


06-29 16:28:52 622 INFO  (Test.java:35)- test serve 1
06-29 16:28:52 622 INFO  (Test.java:35)- test serve 2
06-29 16:29:02 633 DEBUG (Test.java:54)- timout and  print
06-29 16:29:02 637 DEBUG (Test.java:54)- timout and  print
06-29 16:29:02 642 INFO  (Test.java:35)- test serve 3
06-29 16:29:02 677 INFO  (Test.java:35)- test serve 4
06-29 16:29:12 647 DEBUG (Test.java:54)- timout and  print
06-29 16:29:12 650 INFO  (Test.java:35)- test serve 5
06-29 16:29:12 682 INFO  (Test.java:35)- test serve 6



i have test this on tomcat7 and tomcat8 in windows and linux(ubuntu), and test 
it in browser manually.


Best Regards


===
my Test servlet:
===


package com.botao.im;


import java.io.IOException;
import java.io.PrintWriter;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;


import javax.servlet.AsyncContext;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;


import org.apache.log4j.Logger;


/**
 * Servlet implementation class Test
 */
@WebServlet(asyncSupported = true, name = "test", urlPatterns = { "/test" })
public class Test extends HttpServlet {
private static final long serialVersionUID = 1L;


private static Logger logger = Logger.getLogger(Test.class);

private static ScheduledExecutorService es =  
Executors.newSingleThreadScheduledExecutor();

private static int counter = 0;

protected void doGet(HttpServletRequest request, final 
HttpServletResponse response) throws ServletException, IOException {

logger.info("test serve " + (++counter ));
final AsyncContext context = request.startAsync();


context.start(new Runnable() {

@Override
public void run() {
context.setTimeout(100);

 es.schedule(new Runnable(){


@Override
public void run() {

response.setContentType("text/plain");
PrintWriter out;
try {
out = 
response.getWriter();

out.print("hello");
out.flush();

context.complete();

logger.debug("timout and  print");
} catch (IOException e) 
{
}

}
 
 }, 10, TimeUnit.SECONDS);
}
});

}




}