Author: gatfora
Date: Thu Sep 20 02:23:25 2007
New Revision: 577650

URL: http://svn.apache.org/viewvc?rev=577650&view=rev
Log:
If an InvokerBean fails to insert the request should be dropped

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=577650&r1=577649&r2=577650&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 Sep 20 02:23:25 2007
@@ -392,17 +392,31 @@
                    
                        InvokerBeanMgr storageMapMgr = 
storageManager.getInvokerBeanMgr();
 
-                       storageManager.storeMessageContext(key, 
rmMsgCtx.getMessageContext());
                        InvokerBean invokerBean = new InvokerBean(key, msgNo, 
sequenceId);
                        
                        ContextManager contextMgr = 
SandeshaUtil.getContextManager(configCtx);
                        if(contextMgr != null) 
invokerBean.setContext(contextMgr.storeContext());
 
-                       storageMapMgr.insert(invokerBean);
+                       boolean wasAdded = storageMapMgr.insert(invokerBean);
 
                        // This will avoid performing application processing 
more than once.
                        
rmMsgCtx.setProperty(Sandesha2Constants.APPLICATION_PROCESSING_DONE, "true");
+                       
+                       if (wasAdded) {
+                               storageManager.storeMessageContext(key, 
rmMsgCtx.getMessageContext());        
+                       } else {
+                               // Abort this message immediately as this 
message has already been added
+                               sendAck = false;
+                               result = InvocationResponse.ABORT;
+                               RequestResponseTransport t = null;
+                               t = (RequestResponseTransport) 
rmMsgCtx.getProperty(RequestResponseTransport.TRANSPORT_CONTROL);
 
+                               // Tell the transport that there will be no 
response message
+                               if(t != null && 
RequestResponseTransportStatus.WAITING.equals(t.getStatus())) {
+                                       
TransportUtils.setResponseWritten(msgCtx, false);
+                                       t.acknowledgeMessage(msgCtx);
+                               }
+                       }
                }
 
                if (transaction != null && transaction.isActive()) 



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to