cxf-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "William Tam (JIRA)" <>
Subject [jira] Commented: (CXF-2145) Proxy in JCA connector throws exception due to concurrency issues
Date Wed, 01 Apr 2009 01:01:51 GMT


William Tam commented on CXF-2145:

I was wondering whether recycling MessageEndpoint instance is a good idea or not. I went back
to the JCA spec. Then, I came to the conclusion that it is NOT a good thing. 

First, Chapter 1.5 Message Delivery in the JCA spec confirms the root problem. "The same endpoint
instance may be used again to deliver subsequent messages serially, but it must not use the
same endpoint instance concurrently."

However, it is unnecessary for the resource adapter to pool endpoint instances. It says in
the same chapter, "The resource adapter may call the release method on the proxy endpoint
instance to indicate that it no longer needs the proxy instance. This hint may be used by
the application server for proxy endpoint pooling decisions. This method call frees the state
of the proxy instance. The released proxy instance may be reused for further proxy endpoint
requests from the same resource adapter." That means, the application server may already maintain
a pool of endpoint instances per resource adapter. We should just call the release() method
on the endpoint instance and call createEndpoint() when it is needed again. I guess the biggest
issue of our pooling is XA transaction support (in the future). Each endpoint could be attached
to a different XAResource at creation time.

I think a fix would be to have the MDBInvoker() holding on to a MessageEndpointFactory instead
of a MessageEndpoint instance. In the getServiceObject(), it calls createEndpoint() and release()
when it is done.

(BTW, it looks like a bug in the patch that the MDBInvoker.getServiceObject() is not recycling
endpoint instance.) 

> Proxy in JCA connector throws exception due to concurrency issues
> -----------------------------------------------------------------
>                 Key: CXF-2145
>                 URL:
>             Project: CXF
>          Issue Type: Bug
>          Components: Integration
>    Affects Versions: 2.1, 2.0.6, 2.2
>            Reporter: Seumas Soltysik
>         Attachments: patch.txt
> A customer is having a problem with concurrent access to a JCA endpoint that is deployed
in WebSphere. The stacktrace is below.
> They are running a 2.0.x version of CXF with WebSphere, HP/UX version B.11.23,
Java .
> The problem is that the JCA connector uses a single MDB/EJB proxy for all threads which
is causing the exception to be thrown. The solution is to create a pool of proxies which can
be accessed so that the proxy is used by no more than 1 thread at a time.
> [3/10/09 15:55:19:685 EDT] 0000042f DispatchMDBIn E Failed to obtain service object java:comp/env/GreeterWithWsdlLocalHome

>                                  java.lang.IllegalStateException: Multiple threads can
not use same MessageEndpoint proxy instance concurrently 
>             at

>             at

>             at

>             at

>             at $Proxy50.lookupTargetObject(Unknown Source) 
>             at org.apache.cxf.jca.inbound.DispatchMDBInvoker.getServiceObject(

>             at org.apache.cxf.service.invoker.AbstractInvoker.invoke(

>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor$

>             at org.apache.cxf.workqueue.SynchronousExecutor.execute(

>             at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(

>             at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(

>             at org.apache.cxf.transport.ChainInitiationObserver.onMessage(

>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.serviceRequest(

>             at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.doService(

>             at org.apache.cxf.transport.http_jetty.JettyHTTPHandler.handle(

>             at org.mortbay.jetty.handler.ContextHandler.handle(

>             at org.mortbay.jetty.handler.ContextHandlerCollection.handle(

>             at org.mortbay.jetty.handler.HandlerWrapper.handle(

>             at org.mortbay.jetty.Server.handle( 
>             at org.mortbay.jetty.HttpConnection.handleRequest(

>             at org.mortbay.jetty.HttpConnection$RequestHandler.content(

>             at org.mortbay.jetty.HttpParser.parseNext( 
>             at org.mortbay.jetty.HttpParser.parseAvailable( 
>             at org.mortbay.jetty.HttpConnection.handle( 
>             at

>             at org.mortbay.thread.BoundedThreadPool$

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message