Question

Here is the simple scenario:

User triggers some operation from a web page of the web application. This operation is heavy one and takes some more time.

And before the operation is completed on server side, user triggers say same operation with some different parameters. so the second operation for second request will also start processing.

So in this case, are there two different threads like 1st one processing first request and other for 2nd request ? or it's just one thread processing both the requests and first operation is just interrupted (left uncompleted) for sake of execution for second request ?

Here I don't want to avoid user requesting same operation multiple times. Just want to know how it works.

This might be a silly question but i am little confused with this. And what is happening with me is adding into the confusion. For me it seems like operation for 1st request is not getting completed.

It's Websphere application server, if that helps.

Was it helpful?

Solution

WebSphere Web Container uses a Thread Pool for all the requests.

For any request (doesn't matter who made it) a thread is obtained from the pool, the request is processed, and the thread goes back to the pool.

Even if the requests are one after the other, there is no guarantee the same thread will process them.

If you see one request interfere with another it is most likely something you do in your code and not due to how WebSphere behaves.

OTHER TIPS

No. Each request is independent of others. There is no thread affinity in websphere. One good way of teaching urself is checkout the websphere logs. When WebSphere writes a record to its log file e.g. SystemOut.log,etc the log includes a thread id. Here is an example record in the WebSphere log file:

[12/11/08 13:06:36:830 CST] 0000002e VirtualHost I .....

The second field is the thread id which is "0000002e". So this way you may correlate how two requests are being handled by two different threads. Hope it make sense to you.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top