Hi,
I just want a confirmation/explaination on the buffering of requests. We are developing a system that we want to sequentially handle requests. Various customers make use of the
Servlet, where the sequentiality only matters for one customer.
First we wrote a Servlet that was directly instantiated. All requests were handled by this Servlet in sequential order. No matter what customer the request belonged to.
Now we came up with the following idea and tested it:
The Servlet is a dispatching Servlet, that dispatches request handling for a specific customer. It contains a table of handlers (that are instantiated at initialization to ensure sequential processing per customer) for each customer. When a request comes in with a parameter for the customer identifier, the Servlet uses that key to pass the request on to the specific handler.
In other words:
- The Servlet is a dispatcher containing a table of handlers.
- Each handler belongs to a customer and is instantiated at Servlet initialization.
- The Servlet does not handle requests sequential.
- The specific handler handles requests sequential.
Requests for customer A does not have to wait for requests for customer B. Requests for customer A do wait for eachother.
A requesttimeschema could look something like this:
CUSTOMER | TIMESTAMP
-----------------------------------
A | 15
A | 15
B | 16
A | 17
B | 20
B | 21
A | 18
A | 19
B | 40
The timestamps are in chronological order for each customer.
We tested this and it worked, but can anyone of you explain or confirm this? In our first situation buffering of request took place before the Servlet itself, now it seems that the buffering takes place before a certain handler, without bothering the other handlers.
Thanks in advance!
Jeroen Oosterlaar