Hi Daniel,

So what you are saying is that it is still thread safe if I store the
generated "port" in a static map in the application context and use it in
all Struts2 request context?

MyService service = new MyService();
MyPortType port = service.getMyPortType();
ports.put("myPort", port);

On Tue, Jan 20, 2009 at 1:34 AM, Daniel Kulp <[email protected]> wrote:

>  On Monday 19 January 2009 7:54:57 am Christopher Cheng wrote:
> > One of the major issues I have with my project using Struts2 and CXF is
> the
> > single thread per request nature of Struts2
> > CXF seems to initialize the definition of WSDL into the memory per
> thread.
> > For large WSDL file, it usually takes 10-15 seconds for a Xeon based
> > server. I tried to use a for loop inside an Action of Struts2 to test the
> > performance, the first call takes 15 seconds, subsequential calls takes 1
> > second.
> > This is fine with Struts1 but not with Struts2 because each request is a
> > seperate thread!
> >
> > How could I solve this performance problem with Struts2 and CXF?
>
> I'm not sure I follow the whole problem....    Is this while creating a CXF
> client to talk to another service within the context of a Struts2 request?
>
> If that's the issue, my suggestion would be to just use a single proxy
> client.
> See the thread last week about the thread safety of the clients.
>
> Alternatively, create a single client and hold onto it in a static or
> something.    By holding onto it, the wsdl cache will hold onto the wsdl,
> the
> JAXB context cache would hold onto the jaxb context and creating other
> clients should be much quicker due to the expensive things being cached.
> By
> creating a client each time and discarding it, the caches get cleared out
> and
> we need to reparse/process things.
>
>
> --
> Daniel Kulp
> [email protected]
> http://dankulp.com/blog
>

Reply via email to