We have found two important factors to keep in mind when reusing stubs:
- The stubs are not thread safe, so you cannot use the same stub in
two concurrent threads
- We recently discovered that even the stub constructor is not
thread safe! So two concurrent threads cannot call the constructor at
the same time.
If you have a typical architecture that reuses client processing
threads, then each needs their own stub but once it creates a stub it
can continue to use that indefinitely. As Ajith suggests, it is easy
to create the config context once and reuse it for each stub
constructor invocation; this helps considerably.
Another useful thing to do is:
options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, new Boolean(true));
Chuck
Ajith Ranabahu wrote on 08/27/2006 10:58 AM:
Forwarding with Axis2 prefix. I suppose you are using
Axis2 :)
BTW we were not hoping to cache the stubs and the internals of the
stubs may screw up if cached!
However I can suggest the following. If you are using the usual no
args constructor of the stub, the stub may need to create its own
configuration context and that may take significant time. You can
cache the config context and create the stub passing in your config
context.
Ajith
---------- Forwarded message ----------
From: Alex Yakimovich <[EMAIL PROTECTED]>
Date: Aug 25, 2006 5:54 PM
Subject: Stub caching and concurrent reuse problems
To: axis-dev@ws.apache.org
Hi,
I'm trying to cache the generated stubs for reusing by concurrent
clients because instantiating of them takes too long.
But every time I start 4+ concurrent clients for the same web-service
I receive some weird exception from the core of Axis.
This happens only in case of caching the stubs, if I create new stub
for every client then I don't have any problems but performance.
Has somebody encountered the same problem ?
Thanks in advance.
Alex.
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
|
- Re: [Axis2] Fwd: Stub caching and concurrent reuse problem... Chuck Williams
-