Author: richard.opalka(a)jboss.com
Date: 2010-12-14 05:49:32 -0500 (Tue, 14 Dec 2010)
New Revision: 13481
Modified:
common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java
Log:
[JBWS-3184] invocation handler is not responsible for endpoint instatiation - it
justoperates upon it
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-14
10:45:50 UTC (rev 13480)
+++
common/branches/jbossws-common-1.4.1/src/main/java/org/jboss/wsf/common/invocation/AbstractInvocationHandlerJSE.java 2010-12-14
10:49:32 UTC (rev 13481)
@@ -29,7 +29,6 @@
import org.jboss.wsf.spi.deployment.Endpoint;
import org.jboss.wsf.spi.invocation.Invocation;
-import org.jboss.wsf.spi.invocation.InvocationContext;
/**
* Handles invocations on JSE endpoints.
@@ -52,54 +51,14 @@
super();
}
- /**
- * Retrieves endpoint implementation bean that will be used in invocation process.
- *
- * This method does the following steps:
- *
- * <ul>
- * <li>tries to retrieve endpoint instance from invocation
context,</li>
- * <li>if endpoint instance is not found it's created and instantiated
(lazy initialization)</li>
- * <li>
- * if endpoint instance was created all subclasses will be notified about this
event
- * (using {@link #onEndpointInstantiated(Endpoint, Invocation)} template method).
- * </li>
- * </ul>
- *
- * @param endpoint to lookup implementation instance for
- * @param invocation current invocation
- * @return endpoint implementation
- * @throws Exception if any error occurs
- */
- protected synchronized final Object getTargetBean(final Endpoint endpoint, final
Invocation invocation)
- throws Exception
+ private synchronized void init(final Endpoint endpoint, final Invocation invocation)
+ throws Exception
{
- final InvocationContext invocationContext = invocation.getInvocationContext();
- Object targetBean = invocationContext.getTargetBean();
-
- if (targetBean == null)
- {
- try
- {
- // create endpoint instance
- final Class<?> endpointImplClass = endpoint.getTargetBeanClass();
- targetBean = endpointImplClass.newInstance();
- invocationContext.setTargetBean(targetBean);
- }
- catch (Exception ex)
- {
- throw new IllegalStateException("Cannot create endpoint instance:
", ex);
- }
- }
-
if (!this.initialized)
{
- // notify subclasses
this.onEndpointInstantiated(endpoint, invocation);
this.initialized = true;
}
-
- return targetBean;
}
/**
@@ -129,7 +88,8 @@
try
{
// prepare for invocation
- final Object targetBean = this.getTargetBean(endpoint, invocation);
+ this.init(endpoint, invocation);
+ final Object targetBean = invocation.getInvocationContext().getTargetBean();
final Class<?> implClass = targetBean.getClass();
final Method seiMethod = invocation.getJavaMethod();
final Method implMethod = this.getImplMethod(implClass, seiMethod);
Show replies by date