Author: chamikara
Date: Wed Feb 15 01:04:23 2006
New Revision: 377970

URL: http://svn.apache.org/viewcvs?rev=377970&view=rev
Log:
transaction based invocation works was limited to on-only scenario

Modified:
    
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=377970&r1=377969&r2=377970&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java 
(original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java 
Wed Feb 15 01:04:23 2006
@@ -23,6 +23,7 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperationFactory;
 import org.apache.axis2.engine.AxisEngine;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
@@ -59,6 +60,8 @@
        private ConfigurationContext context = null;
        
        Log log = LogFactory.getLog(getClass());
+       
+       int i = 1;
 
        public synchronized void stopInvokerForTheSequence(String sequenceID) {
                workingSequences.remove(sequenceID);
@@ -133,7 +136,9 @@
 
                                        String sequenceId = (String) 
allSequencesItr.next();
 
-                                       Transaction 
sequenceInvocationTransaction = storageManager.getTransaction();
+                                       //Transaction 
sequenceInvocationTransaction = storageManager.getTransaction();
+                                       
+                                       Transaction invocationTransaction = 
storageManager.getTransaction();   //Transaction based invocation
                                        
                                        NextMsgBean nextMsgBean = 
nextMsgMgr.retrieve(sequenceId);
                                        if (nextMsgBean == null) {
@@ -160,14 +165,14 @@
                                                        new InvokerBean(null, 
nextMsgno, sequenceId))
                                                        .iterator();
 
-                                       sequenceInvocationTransaction.commit();
-                                       
-                                       
-                                       Transaction invocationTransaction = 
storageManager.getTransaction();   //Transaction based invocation
+                                       
//sequenceInvocationTransaction.commit();
                                        
                                        
+
                                        while (stMapIt.hasNext()) {
 
+
+                                               
                                                InvokerBean stMapBean = 
(InvokerBean) stMapIt
                                                                .next();
                                                String key = 
stMapBean.getMessageContextRefKey();
@@ -187,17 +192,28 @@
                                                        //Invoking the message.
 //                                                     new 
AxisEngine(msgToInvoke.getConfigurationContext())
 //                                                                     
.receive(msgToInvoke);
+                                                       
+                                                       //currently Transaction 
based invocation can be supplied only for the in-only case.
+                                                       
+                                                       if 
(!AxisOperationFactory.MEP_URI_IN_ONLY.equals(msgToInvoke.getAxisOperation().getMessageExchangePattern()))
 {
+                                                               
invocationTransaction.commit();
+                                                       }
+                                                       
                                                        new AxisEngine 
(msgToInvoke.getConfigurationContext())
                                                                        
.resume(msgToInvoke);
                                                        
+                                                       if 
(!AxisOperationFactory.MEP_URI_IN_ONLY.equals(msgToInvoke.getAxisOperation().getMessageExchangePattern()))
 {
+                                                               
invocationTransaction = storageManager.getTransaction();
+                                                       }
+                                                       
                                                        log.info("Invoker 
invoking a '" + SandeshaUtil.getMessageTypeString(rmMsg
                                                                                
                .getMessageType()) + "' message.");
                                                        
-                                                       Transaction 
deleteEntryTransaction = storageManager.getTransaction();
+                                                       //Transaction 
deleteEntryTransaction = storageManager.getTransaction();
                                                        //deleting the message 
entry.
                                                        
storageMapMgr.delete(key);
                                                        
-                                                       
deleteEntryTransaction.commit();
+                                                       
//deleteEntryTransaction.commit();
                                                        
                                                } catch (AxisFault e) {
                                                        throw new 
SandeshaException(e);
@@ -205,11 +221,11 @@
 
                                                //Transaction 
postInvocationTransaction = storageManager.getTransaction();
                                                //undating the next msg to 
invoke
-                                               nextMsgno++;
-                                               stMapIt = storageMapMgr
-                                                               .find(
-                                                                               
new InvokerBean(null, nextMsgno,
-                                                                               
                sequenceId)).iterator();
+//                                             nextMsgno++;
+//                                             stMapIt = storageMapMgr
+//                                                             .find(
+//                                                                             
new InvokerBean(null, nextMsgno,
+//                                                                             
                sequenceId)).iterator();
 
                                                //terminate (AfterInvocation)
                                                if (rmMsg.getMessageType() == 
Sandesha2Constants.MessageTypes.APPLICATION) {
@@ -223,6 +239,7 @@
                                                                
stopInvokerForTheSequence(sequenceId);
                                                                
                                                                //exit from 
current iteration. (since an entry was removed)
+                                                               
invocationTransaction.commit();
                                                                break 
currentIteration;
                                                        }
                                                }
@@ -231,13 +248,22 @@
                                        }
 
                                        //Transaction updateNextMsgTransaction 
= storageManager.getTransaction();
+                                       nextMsgno++;
                                        
nextMsgBean.setNextMsgNoToProcess(nextMsgno);
                                        nextMsgMgr.update(nextMsgBean);
                                        //updateNextMsgTransaction.commit();
                                        
+//                                     i++;
+//                                     if (i==3) {
+//                                             throw new SandeshaException 
("test");
+//                                     }
+                                       
                                        invocationTransaction.commit();
+                                       
+
                                
                                }
+                               
                        } catch (SandeshaException e1) {
                                // TODO Auto-generated catch block
                                e1.printStackTrace();



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

Reply via email to