You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by ro...@apache.org on 2007/07/30 19:35:32 UTC

svn commit: r561058 - /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/async/CallbackFuture.java

Author: rott
Date: Mon Jul 30 10:35:31 2007
New Revision: 561058

URL: http://svn.apache.org/viewvc?view=rev&rev=561058
Log:
thread switch after async handoff may null out the response
InputStream, causing NullPointerException in the parser on 
some platforms.

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?view=diff&rev=561058&r1=561057&r2=561058
==============================================================================
--- 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 Mon Jul 30 10:35:31 2007
@@ -172,6 +172,31 @@
                 if (log.isDebugEnabled()) {
                     log.debug("Task submitted to Executor");
                 }
+                
+                /*
+                 * TODO:  review
+                 * A thread switch will occur immediately after going out of scope
+                 * on this method.  This is ok, except on some platforms this will
+                 * prompt the JVM to clean up the old thread, thus cleaning up any
+                 * InputStreams there.  If that's the case, and we have not fully
+                 * read the InputStreams, we will likely get a NullPointerException
+                 * coming from the parser, which has a reference to the InputStream
+                 * that got nulled out from under it.  Make sure to do the
+                 * cft.notifyAll() in the right place.  CallbackFutureTask.call()
+                 * is the right place since at that point, the parser has fully read
+                 * the InputStream.
+                 */
+                try {
+                    synchronized (cft) {
+                        cft.wait(180000);  // 3 minutes
+                    }
+                } catch (InterruptedException e) {
+                    if (debug) {
+                        log.debug("cft.wait() was interrupted");
+                        log.debug("Exception: " + e.getMessage());
+                    }
+                }
+                
             } else {
                 if (log.isDebugEnabled()) {
                     log.info(
@@ -239,6 +264,10 @@
             if (debug) {
                 log.debug("An error occured while invoking the callback object.");
                 log.debug("Error: " + t.getMessage());
+            }
+        } finally {
+            synchronized(this) {
+                this.notifyAll();
             }
         }
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org