I am trying to grasp this from past few days but I'm unable to. Please help. Please correct me if any of the following doesn't make sense.
I've a simple static method called Client.getXMLData() which sends a HTTP post request to a website and retrieves information. This method is accessed from non-Java Platform/web page using a customtag.
Under low loads it is working fine but under heavy concurrent user request loads it slows down. I think it is because the requests que-up. (Correct?).
I would like to now convert this to a "multi threaded" program.
The multi-threading examples I've seen shows a client calling the main program which spawns multiple threads to perform multiple tasks. But I've not seen any examples where multiple client requests invoking threads directly.
I think I need a program that behaves like web server, which starts a
thread pool and waits for clients.
below is my current code snippet:
---------
webpage: test.cfm
<CFX ... result = Client.getXMLData() >
java class: client
public static
String getXMLData() {
//Send HTTP request to
http://javaranch.com/xml //return result;
return result;
}
Hope I'm clear. Thanks. Vijay