简体   繁体   中英

Asyncronous Servlet do not serves multiple request

i have some problem with async request in java... Simply have following servlet:

public class Notifier extends HttpServlet{
public void service(final ServletRequest req, final ServletResponse res){

final AsyncContext ctx = req.startAsync();`
...
}

I thoght, that this servlet serves thousand request (by few threed), but wen i test it by ajax only 6 request received on servlet side;

test code snippet is following:

for(i=0;i<5000;i++){
var xmlhttp;
if (window.XMLHttpRequest)
{
xmlhttp=new XMLHttpRequest();
}

xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{

} }

xmlhttp.open("GET","http://localhost:8080/Notifier?mode=authorised&a="+i,true);
xmlhttp.send();
}

I have not idea why Notifier servlet does not serve all request which i send from browser...

Thank you in advance...

maybe it deals with the maximum length of the GET request? the information you can send has a maximum of 1024 characters? try it out with POST

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM