[jboss-cvs] JBossAS SVN: r76634 - projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container.
jboss-cvs-commits at lists.jboss.org
jboss-cvs-commits at lists.jboss.org
Tue Aug 5 01:30:59 EDT 2008
Author: ALRubinger
Date: 2008-08-05 01:30:58 -0400 (Tue, 05 Aug 2008)
New Revision: 76634
Modified:
projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java
Log:
[EJBTHREE-1345] Ensure the TCL gets reset to original
Modified: projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java
===================================================================
--- projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-08-05 05:15:47 UTC (rev 76633)
+++ projects/ejb3/trunk/proxy/src/test/java/org/jboss/ejb3/test/proxy/common/container/SessionContainer.java 2008-08-05 05:30:58 UTC (rev 76634)
@@ -211,61 +211,63 @@
// Set the Container's CL as TCL, required to unmarshall methods from the bean impl class
Thread.currentThread().setContextClassLoader(this.getClassLoader());
- /*
- * Obtain the target method (unmarshall from invocation)
- */
+ try
+ {
- // Cast
- assert invocation instanceof MethodInvocation : SessionContainer.class.getName() + ".dynamicInoke supports only "
- + MethodInvocation.class.getSimpleName() + ", but has been passed: " + invocation;
- MethodInvocation mi = (MethodInvocation) invocation;
+ /*
+ * Obtain the target method (unmarshall from invocation)
+ */
- // Get the method hash
- long methodHash = mi.getMethodHash();
- log.debug("Received dynamic invocation for method with hash: " + methodHash);
+ // Cast
+ assert invocation instanceof MethodInvocation : SessionContainer.class.getName()
+ + ".dynamicInoke supports only " + MethodInvocation.class.getSimpleName() + ", but has been passed: "
+ + invocation;
+ MethodInvocation mi = (MethodInvocation) invocation;
- // Get the Method via MethodInfo from the Advisor
- Advisor advisor = this.getAdvisor();
- MethodInfo info = advisor.getMethodInfo(mi.getMethodHash());
+ // Get the method hash
+ long methodHash = mi.getMethodHash();
+ log.debug("Received dynamic invocation for method with hash: " + methodHash);
- /*
- * Build a new Invocation
- */
+ // Get the Method via MethodInfo from the Advisor
+ Advisor advisor = this.getAdvisor();
+ MethodInfo info = advisor.getMethodInfo(mi.getMethodHash());
- // Construct the invocation
- MethodInvocation newInvocation = new MethodInvocation(info, new Interceptor[]
- {});
- Object[] args = mi.getArguments();
- newInvocation.setArguments(args);
- newInvocation.setMetaData(mi.getMetaData());
- newInvocation.setAdvisor(advisor);
+ /*
+ * Build a new Invocation
+ */
- // Obtain the Session ID
- Serializable sessionId = null;
- Object objSessionId = mi.getMetaData(StatefulSessionRemotingMetadata.TAG_SFSB_INVOCATION,
- StatefulSessionRemotingMetadata.KEY_SESSION_ID);
- if (objSessionId != null)
- {
- assert objSessionId instanceof Serializable : "Session IDs must be " + Serializable.class.getSimpleName();
- sessionId = (Serializable) objSessionId;
- }
+ // Construct the invocation
+ MethodInvocation newInvocation = new MethodInvocation(info, new Interceptor[]
+ {});
+ Object[] args = mi.getArguments();
+ newInvocation.setArguments(args);
+ newInvocation.setMetaData(mi.getMetaData());
+ newInvocation.setAdvisor(advisor);
- // Get the target, and set on the invocation
- Object target = this.getBeanInstance(sessionId);
- newInvocation.setTargetObject(target);
+ // Obtain the Session ID
+ Serializable sessionId = null;
+ Object objSessionId = mi.getMetaData(StatefulSessionRemotingMetadata.TAG_SFSB_INVOCATION,
+ StatefulSessionRemotingMetadata.KEY_SESSION_ID);
+ if (objSessionId != null)
+ {
+ assert objSessionId instanceof Serializable : "Session IDs must be " + Serializable.class.getSimpleName();
+ sessionId = (Serializable) objSessionId;
+ }
- // Create an Object reference to hold the return value
- Object returnValue = null;
+ // Get the target, and set on the invocation
+ Object target = this.getBeanInstance(sessionId);
+ newInvocation.setTargetObject(target);
- // Create a reference to the Invocation's response
- InvocationResponse response = null;
+ // Create an Object reference to hold the return value
+ Object returnValue = null;
- /*
- * Invoke
- */
+ // Create a reference to the Invocation's response
+ InvocationResponse response = null;
- try
- {
+ /*
+ * Invoke
+ */
+
// Invoke
returnValue = newInvocation.invokeNext();
@@ -273,15 +275,15 @@
response = new InvocationResponse(returnValue);
Map<Object, Object> responseContext = newInvocation.getResponseContextInfo();
response.setContextInfo(responseContext);
+
+ // Return
+ return response;
}
finally
{
// Reset the TCL to original
Thread.currentThread().setContextClassLoader(originalLoader);
}
-
- // Return
- return response;
}
protected Object createInstance() throws InstantiationException, IllegalAccessException
More information about the jboss-cvs-commits
mailing list