In my application, when the user makes a request to an extension (it is a game... the user makes a request to the extension to get some kind of response from it), the extension calls a method from a private object it has instantiated when the extension is started (init() method). This object has its logic, generates the result, and returns it to the extension... the extension returns the response to the user as usual.
This is basically the logic and, when some users are connected, it begins responding very slowly.
I have to say that, in the logic of this private object in the extension, I have a call to a Web Service which takes about 1'5 seconds to get the response.
My question is about how the client requests are treated:
- Is the extension single threaded (I mean... when it gets a request, it doesn't handle the next request until the first one is finished)?
- Is the private class handling requests one by one or is it handling them in parallel?
- Do i have to create a thread for each user request which handles the call to the private's class method?
To make things more clear, I wil try to write the program logic in pseudo-code:
Code: Select all
public class gameExt extends AbstractExtension{
private MyLogicClass _logicClass;
public void init(){
...
_logicClass = new MyLogicClass();
...
}
public void handleRequest(String cmd, String[] params, User user, int fromRoom){
...
if (cmd.equals("xxx")){
String result = _logicClass.myMethod();
...
//Code to return the result to the client
}
...
}
}
Code: Select all
public class MyLogicClass(){
public String myMethod(){
...
//Whatever code for the logic
[call to a web service] //This takes about 1'5 seconds
...
return result;
}
}
Thank you in advance for any clue or comment