However, even then, you may find that the requests are not as asynchronous as you'd like. If the two HTTP requests underlying the AJAX requests happen to be sent over the same HTTP connection, then the HTTP protocol dictates that the responses must be returned in the same order, i.e. the response for request 2 cannot be returned, until the response for request 1 has been returned. If the two HTTP requests happen to be sent over separate HTTP connections, you will get the desired behavior. While guidelines indicate 1-4 concurrent connections may be used by a client, most browsers will try to minimize the use of separate connections, and pipeline some of the requests. The bottom line is that you may, or may not, get the asynchronous behavior you seek, depending on decisions made within the browser under a given set of circumstances.
Please respond to "Tomcat Users List" <users@tomcat.apache.org> To: Tomcat Users List <users@tomcat.apache.org> cc: keif <[EMAIL PROTECTED]> Subject: Re: Interrupting tomcat threads. On Fri Jul 20 15:23:45 CEST 2007 Tomcat Users List <users@tomcat.apache.org> wrote: > > > Christopher Schultz-2 wrote: > > > > So, multiple simultaneous AJAX requests are considered illegal? > > > > Exactly. All requests that modify the session state will be synchronized. > > > Christopher Schultz-2 wrote: > > > > I would also recommend vetoing the /second/ request, rather than > > canceling the first request when a second one comes in. > > > > Well, once the requests are synchronized, I'd like to give users an ability > to change their mind and not wait until the first request finishes. That is > the main justification for interrupting threads. It will allow for a more > responsive interaction with the UI. There is an article with a good example > of request synchronization: > http://www.onjava.com/pub/a/onjava/2004/03/24/loadcontrol.html. > > Hope it's clear now why I'm asking about interrupting threads - vetoing the > second request would make the user wait for the first one to complete. > The requests aren't synchronized. Only updating the session is synchronized. So, you can make multiple ajax requests to servlets if the browser supports it. Ronald.