Hello,
I am still having issues with this and am in desperate need for help.
I have followed Amila's solution and still couldn't get it to work.
My Environment:
I have a bunch of search services deployed as one serviceGroup in axis2
1.5.1 under Tomcat 6.0. My front end search application is a Spring
application on the same Tomcat instance. For a search request, I invoke the
top level search service (Federated Search Service), which then invokes
other search services that are members of the federation. For each service
invocation, I use the Axis ServiceClient() class with options set as Amila's
suggestion.
The web tier uses one ServiceClient instance per user session. The federated
search service uses one new instance per member service call. So, for a
single search request, there are three ServiceClient instances - one for the
web tier and the other two for the member services.
Problem:
When I run the search application from three sessions (different browsers),
I immediately get the connection timeout error as specified in this post.
Scenarios:
I have tried the following scenarios without any success. The federated
search service still uses a new instance for each member service call for
all cases:
1. Run one single ServiceClient instance for all user sessions.
2. Run one ServiceClient instance per user session.
3. In both cases above, run the init() and cleanup() methods before/after
EACH method invocation.
4. In both cases above, run the init() method only once per service
instantiation in the constructor, and run cleanup() after every method
invocation.
5. In both cases above, run the init() and finalize() methods only once per
service instance. I realize finalize() is upto the gc, but tried it anyways.
HELP NEEDED ASAP:
As you can see, I have tried all kinds of combination and I've run out of
options. I need your help desperately to solve this problem. Please share
your suggestions/tips - they will be very much appreciated. Thank you in
advance for your help.
Here are the notable code snippets:
this.client = new ServiceClient(null, null);
this.client.setOptions(this.getServiceClientOptions(serviceUrl, "search"));
protected Options getServiceClientOptions(String serviceUrl, String action)
{
Options options = new Options();
options.setTo(new EndpointReference(serviceUrl));
options.setManageSession(true);
options.setAction("urn:" + action);
options.setProperty(HTTPConstants.SO_TIMEOUT, super.getSocketTimeout());
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT,
Constants.VALUE_TRUE);
options.setProperty(HTTPConstants.CACHED_HTTP_CLIENT, this.httpClient);
return options;
}
protected void init()
{
this.httpConnectionManager = new MultiThreadedHttpConnectionManager();
HttpConnectionManagerParams params =
this.httpConnectionManager.getParams();
if(params == null)
{
params = new HttpConnectionManagerParams();
this.httpConnectionManager.setParams(params);
}
params.setMaxTotalConnections(100);
params.setDefaultMaxConnectionsPerHost(25);
this.httpClient = new HttpClient(this.httpConnectionManager);
}
protected void cleanup()
{
try {
if(this.client != null)
this.client.cleanup();
} catch(Throwable e) {
//e.printStackTrace();
}
try {
if(this.client != null)
this.client.cleanupTransport();
} catch(Throwable e) {
//e.printStackTrace();
}
try {
if(this.httpConnectionManager != null)
this.httpConnectionManager.closeIdleConnections(0);
} catch(Throwable e) {
//e.printStackTrace();
}
try {
if(this.httpConnectionManager != null)
this.httpConnectionManager.shutdown();
} catch(Throwable e) {
//e.printStackTrace();
}
}
protected void finalize() throws Throwable
{
super.finalize();
this.cleanup();
}
--
View this message in context:
http://old.nabble.com/Third-web-service-invoctaion-always-throws-Timeout-Exception-tp27029690p27135054.html
Sent from the Axis - User mailing list archive at Nabble.com.