svn commit: r899244 - /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java

[email protected] Thu, 14 Jan 2010 15:38:48 -0000
Newsgroups gmane.comp.apache.webservices.fx.devel
Message-ID <[email protected]>
Author: parsonsd
Date: Thu Jan 14 15:38:48 2010
New Revision: 899244

URL: http://svn.apache.org/viewvc?rev=899244&view=rev
Log:
Fix to Sandesha as problem highlighted after move to recent Axis2 release.  The thread ABORT logic has changed slightly in Axis2 so was causing NPE's when an RM inorder response was being delivered to a client.  The fix is to use a thread SUSPEND for inorder Sync responses.

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java?rev=899244&r1=899243&r2=899244&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java (original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/msgprocessors/SequenceProcessor.java Thu Jan 14 15:38:48 2010
@@ -244,7 +244,7 @@
 			
 			EndpointReference acksTo = bean.getAcksToEndpointReference();
 			
-			// Send an Ack if needed.
+			//Send an Ack if needed.
 			//We are not sending acks for duplicate messages in the anon InOut case.
 			//If a standalone ack get sent before the actualy message (I.e. before the original msg get
 			//replied), the client may take this as a InOnly message and may avoid looking for the application
@@ -430,11 +430,17 @@
 			}
 
             // if the relates to is not null then this is at the client side
-            // so it is receiving a response. always have to return the thread.
-            if (msgCtx.getRelatesTo() != null) {
+            // so it is receiving a response.  We have to abort the thread in the Async case as 
+			// we don't want too many threads open e.g. many async responses coming in at once all waiting
+			// for an earlier response which hasn't arrived.  In the Sync case we need to suspend as aborting
+			// causes Axis to mark this msg as delivered and then when the invoker thread tries to deliver
+			// the msg Axis returns with a NullPointerException.
+            if (msgCtx.getRelatesTo() != null && !msgCtx.getTo().hasAnonymousAddress()) {
                 result = InvocationResponse.ABORT;
-            }
-
+                if (log.isDebugEnabled())
+    				log.debug("SequenceProcessor::processReliableMessage, Aborting the thread as this " +
+    						"is an async response requiring inorder delivery.  An invoker thread will process the delivery"); 
+            } 
 		}
 
 		if (transaction != null && transaction.isActive())