[jbossws-commits] JBossWS SVN: r13414 - common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation.
jbossws-commits at lists.jboss.org
jbossws-commits at lists.jboss.org
Mon Dec 6 09:19:39 EST 2010
Author: richard.opalka at jboss.com
Date: 2010-12-06 09:19:39 -0500 (Mon, 06 Dec 2010)
New Revision: 13414
Modified:
common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
Log:
[JBWS-3179] refactoring JSE endpoint injections from CXF to COMMON
Modified: common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
===================================================================
--- common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2010-12-06 14:17:33 UTC (rev 13413)
+++ common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2010-12-06 14:19:39 UTC (rev 13414)
@@ -23,6 +23,10 @@
import java.lang.reflect.Method;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.Invocation;
import org.jboss.wsf.spi.invocation.InvocationContext;
@@ -36,6 +40,10 @@
public abstract class AbstractInvocationHandlerJSE extends AbstractInvocationHandler
{
+ private static final String POJO_JNDI_PREFIX = "java:comp/env/";
+
+ private boolean initialized;
+
/**
* Constructor.
*/
@@ -63,7 +71,8 @@
* @return endpoint implementation
* @throws Exception if any error occurs
*/
- protected final Object getTargetBean(final Endpoint endpoint, final Invocation invocation) throws Exception
+ protected synchronized final Object getTargetBean(final Endpoint endpoint, final Invocation invocation)
+ throws Exception
{
final InvocationContext invocationContext = invocation.getInvocationContext();
Object targetBean = invocationContext.getTargetBean();
@@ -76,9 +85,6 @@
final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
targetBean = endpointImplClass.newInstance();
invocationContext.setTargetBean(targetBean);
-
- // notify subclasses
- this.onEndpointInstantiated(endpoint, invocation);
}
catch (Exception ex)
{
@@ -86,6 +92,13 @@
}
}
+ if (!this.initialized)
+ {
+ // notify subclasses
+ this.onEndpointInstantiated(endpoint, invocation);
+ this.initialized = true;
+ }
+
return targetBean;
}
@@ -144,4 +157,10 @@
}
}
+ @Override
+ public Context getJNDIContext(final Endpoint ep) throws NamingException
+ {
+ return (Context) new InitialContext().lookup(POJO_JNDI_PREFIX);
+ }
+
}
Modified: common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java
===================================================================
--- common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java 2010-12-06 14:17:33 UTC (rev 13413)
+++ common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/InvocationHandlerJAXWS.java 2010-12-06 14:19:39 UTC (rev 13414)
@@ -21,9 +21,6 @@
*/
package org.jboss.wsf.common.invocation;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
import javax.xml.ws.WebServiceContext;
import org.jboss.wsf.common.injection.InjectionHelper;
@@ -47,8 +44,6 @@
public final class InvocationHandlerJAXWS extends AbstractInvocationHandlerJSE
{
- private static final String POJO_JNDI_PREFIX = "java:comp/env/";
-
/**
* Constructor.
*/
@@ -108,11 +103,6 @@
ThreadLocalAwareWebServiceContext.getInstance().setMessageContext(null);
}
- public Context getJNDIContext(final Endpoint ep) throws NamingException
- {
- return (Context) new InitialContext().lookup(POJO_JNDI_PREFIX);
- }
-
/**
* Returns WebServiceContext associated with this invocation.
*
More information about the jbossws-commits
mailing list