You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by ng...@apache.org on 2008/05/27 16:53:29 UTC
svn commit: r660543 -
/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
Author: ngallardo
Date: Tue May 27 07:53:26 2008
New Revision: 660543
URL: http://svn.apache.org/viewvc?rev=660543&view=rev
Log:
Set the ClassLoader on the response BEFORE we try to unmarshall the response.
Modified:
webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java?rev=660543&r1=660542&r2=660543&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java Tue May 27 07:53:26 2008
@@ -243,15 +243,37 @@
error = e;
}
+
+ /*
+ * An invocation of the call() method is what drives the response processing
+ * for Callback clients. The end result of this should be that the AysncHandler
+ * (the callback instance) provided by the client is called and the response or
+ * an error is delivered.
+ */
@SuppressWarnings("unchecked")
public Object call() throws Exception {
try {
- ClassLoader classLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
+ // The ClassLoader that was used to load the AsyncHandler instance is the same
+ // one that is used to create the JAXB request object instances. Because of that
+ // we need to make sure we're using the same ClassLoader as we start response
+ // processing or ClassCastExceptions will occur.
+ final ClassLoader classLoader = (ClassLoader)AccessController.doPrivileged(new PrivilegedAction() {
public Object run() {
return handler.getClass().getClassLoader();
}
});
+ if (log.isDebugEnabled()) {
+ log.debug("Setting up the thread's ClassLoader");
+ log.debug(classLoader.toString());
+ }
+ AccessController.doPrivileged(new PrivilegedAction() {
+ public Object run() {
+ Thread.currentThread().setContextClassLoader(classLoader);
+ return null;
+ }
+ });
+
// Set the response or fault content on the AsyncResponse object
// so that it can be collected inside the Executor thread and processed.
if (error != null) {
@@ -262,13 +284,6 @@
// Now that the content is available, call the JAX-WS AsyncHandler class
// to deliver the response to the user.
- ClassLoader cl = handler.getClass().getClassLoader();
- if (log.isDebugEnabled()) {
- log.debug("Setting up the thread's ClassLoader");
- log.debug(cl.toString());
- }
- Thread.currentThread().setContextClassLoader(cl);
-
if (debug) {
log.debug("Calling JAX-WS AsyncHandler with the Response object");
log.debug("AyncHandler class: " + handler.getClass());