Author: richard.opalka(a)jboss.com
Date: 2012-11-18 14:09:55 -0500 (Sun, 18 Nov 2012)
New Revision: 17027
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
Log:
[JBPAPP-10410] fix endpoint instantiation concurrency issue
Modified:
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java
===================================================================
---
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2012-11-16
17:12:57 UTC (rev 17026)
+++
stack/cxf/branches/jbossws-cxf-3.1.2/modules/server/src/main/java/org/jboss/wsf/stack/cxf/AbstractInvoker.java 2012-11-18
19:09:55 UTC (rev 17027)
@@ -88,7 +88,8 @@
public abstract class AbstractInvoker implements Invoker
{
private static final Object[] NO_ARGS = new Object[]{};
-
+ private Object targetBean;
+
public Object invoke(Exchange exchange, Object o)
{
// set up the webservice request context
@@ -116,6 +117,15 @@
return new MessageContentsList(retObj);
}
+
+ private synchronized Object getTargetBean(Endpoint ep) throws Exception
+ {
+ if (targetBean == null)
+ {
+ targetBean = ep.getTargetBeanClass().newInstance();
+ }
+ return targetBean;
+ }
private Object _invokeInternal(Exchange exchange, Object o, WrappedMessageContext
ctx)
{
@@ -143,7 +153,7 @@
Invocation inv = invHandler.createInvocation();
InvocationContext invContext = inv.getInvocationContext();
- inv.getInvocationContext().addAttachment(WebServiceContext.class,
getWebServiceContext(ctx));
+ invContext.addAttachment(WebServiceContext.class, getWebServiceContext(ctx));
invContext.addAttachment(MessageContext.class, ctx);
inv.setJavaMethod(m);
inv.setArgs(params);
@@ -151,6 +161,7 @@
Object retObj = null;
try
{
+ invContext.setTargetBean(getTargetBean(ep)); //JBWS-2486 - JBWS-3002
invHandler.invoke(ep, inv);
retObj = inv.getReturnValue();
} catch (InvocationTargetException e) {
Show replies by date