Author: chamikara
Date: Mon Jun 19 01:54:04 2006
New Revision: 415263

URL: http://svn.apache.org/viewvc?rev=415263&view=rev
Log:
Applied the patch from Andrew

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

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InOrderInvoker.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InOrderInvoker.java?rev=415263&r1=415262&r2=415263&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InOrderInvoker.java
 (original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/InOrderInvoker.java
 Mon Jun 19 01:54:04 2006
@@ -20,7 +20,6 @@
 import java.util.ArrayList;
 import java.util.Iterator;
 
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.MessageContext;
@@ -59,25 +58,48 @@
        private static final Log log = LogFactory.getLog(InOrderInvoker.class);
        
        public synchronized void stopInvokerForTheSequence(String sequenceID) {
+    if (log.isDebugEnabled())
+      log.debug("Enter: InOrderInvoker::stopInvokerForTheSequence, 
"+sequenceID);
+
                workingSequences.remove(sequenceID);
                if (workingSequences.size()==0) {
                        runInvoker = false;
                }
+    
+    if (log.isDebugEnabled())
+      log.debug("Exit: InOrderInvoker::stopInvokerForTheSequence");
        }
        
        public synchronized void stopInvoking () {
+    if (log.isDebugEnabled())
+      log.debug("Enter: InOrderInvoker::stopInvoking");
+    
                runInvoker = false;
+    
+    if (log.isDebugEnabled())
+      log.debug("Exit: InOrderInvoker::stopInvoking");
        }
 
        public synchronized boolean isInvokerStarted() {
+    if (log.isDebugEnabled())
+    {
+      log.debug("Enter: InOrderInvoker::isInvokerStarted");
+      log.debug("Exit: InOrderInvoker::isInvokerStarted, " + runInvoker);
+    }
                return runInvoker;
        }
 
        public void setConfugurationContext(ConfigurationContext context) {
+    if (log.isDebugEnabled())
+      log.debug("Enter: InOrderInvoker::setConfugurationContext");
                this.context = context;
+    if (log.isDebugEnabled())
+      log.debug("Exit: InOrderInvoker::setConfugurationContext");
        }
 
        public synchronized void runInvokerForTheSequence(ConfigurationContext 
context, String sequenceID) {
+    if (log.isDebugEnabled())
+      log.debug("Enter: InOrderInvoker::runInvokerForTheSequence");
                
                if (!workingSequences.contains(sequenceID))
                        workingSequences.add(sequenceID);
@@ -87,10 +109,14 @@
                        runInvoker = true;     //so that isSenderStarted()=true.
                        super.start();
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: InOrderInvoker::runInvokerForTheSequence");
        }
 
        public void run() {
-
+    if (log.isDebugEnabled())
+      log.debug("Enter: InOrderInvoker::run");
+    
                while (isInvokerStarted()) {
 
                        try {
@@ -115,12 +141,14 @@
                                transaction = storageManager.getTransaction();
                                
                                //Getting the incomingSequenceIdList
-                               SequencePropertyBean allSequencesBean = 
(SequencePropertyBean) sequencePropMgr
+                               SequencePropertyBean allSequencesBean = 
sequencePropMgr
                                                .retrieve(
                                                                
Sandesha2Constants.SequenceProperties.ALL_SEQUENCES,
                                                                
Sandesha2Constants.SequenceProperties.INCOMING_SEQUENCE_LIST);
                                
                                if (allSequencesBean == null) {
+          if (log.isDebugEnabled())
+            log.debug("AllSequencesBean not found");
                                        continue;
                                }
                                ArrayList allSequencesList = 
SandeshaUtil.getArrayListFromString (allSequencesBean.getValue());
@@ -150,6 +178,8 @@
 
                                        long nextMsgno = 
nextMsgBean.getNextMsgNoToProcess();
                                        if (nextMsgno <= 0) { 
+            if (log.isDebugEnabled())
+              log.debug("Invalid Next Message Number " + nextMsgno);
                                                String message = "Invalid 
message number as the Next Message Number.";
                                                throw new 
SandeshaException(message);
                                        }
@@ -185,14 +215,20 @@
                                                        AxisEngine engine = new 
AxisEngine (context);
                                                        if 
(postFailureInvocation) {
                                                                
makeMessageReadyForReinjection (msgToInvoke);
+                if (log.isDebugEnabled())
+                  log.debug("Receiving message, key=" + key +", msgCtx=" + 
msgToInvoke.getEnvelope().getHeader());
                                                                
engine.receive(msgToInvoke);
                                                        } else {
+                if (log.isDebugEnabled())
+                  log.debug("Resuming message, key=" + key +", msgCtx=" + 
msgToInvoke.getEnvelope().getHeader());
                                                                
engine.resume(msgToInvoke);
                                                        }
                                                        
                                                        invoked = true;
 
                                                } catch (Exception e) {
+              if (log.isDebugEnabled())
+                log.debug("Exception :", e);
                                                        throw new 
SandeshaException(e);
                                                } finally {
                                                        transaction = 
storageManager.getTransaction();
@@ -252,6 +288,8 @@
                                }
                        }
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: InOrderInvoker::run");
        }
        
        private void makeMessageReadyForReinjection (MessageContext 
messageContext) {
@@ -261,4 +299,4 @@
                messageContext.getOptions().setAction(null);
                
messageContext.setProperty(Sandesha2Constants.REINJECTED_MESSAGE,Sandesha2Constants.VALUE_TRUE);
        }
-}
\ No newline at end of file
+}

Modified: 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/Sender.java
URL: 
http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/Sender.java?rev=415263&r1=415262&r2=415263&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/Sender.java 
(original)
+++ 
webservices/sandesha/trunk/java/src/org/apache/sandesha2/workers/Sender.java 
Mon Jun 19 01:54:04 2006
@@ -62,21 +62,36 @@
        private static final Log log = LogFactory.getLog(Sender.class);
 
        public synchronized void stopSenderForTheSequence(String sequenceID) {
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::stopSenderForTheSequence, " + sequenceID);
                workingSequences.remove(sequenceID);
                if (workingSequences.size() == 0) {
                         runSender = false;
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::stopSenderForTheSequence");
        }
        
        public synchronized void stopSending () {
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::stopSending");
                runSender = false;
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::stopSending");
        }
 
        public synchronized boolean isSenderStarted() {
+    if (log.isDebugEnabled())
+    {
+      log.debug("Enter: Sender::isSenderStarted");
+      log.debug("Exit: Sender::isSenderStarted, " + runSender);
+    }
                return runSender;
        }
 
        public void run() {
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::run");
 
                StorageManager storageManager = null;
 
@@ -84,7 +99,7 @@
                        storageManager = 
SandeshaUtil.getSandeshaStorageManager(context,context.getAxisConfiguration());
                } catch (SandeshaException e2) {
                        // TODO Auto-generated catch block
-                       log.debug("ERROR: Could not start sender");
+                       log.debug("ERROR: Could not start sender", e2);
                        e2.printStackTrace();
                        return;
                }
@@ -115,10 +130,12 @@
                                SenderBeanMgr mgr = 
storageManager.getRetransmitterBeanMgr();
                                SenderBean senderBean = mgr.getNextMsgToSend();
                                if (senderBean==null) {
+          if (log.isDebugEnabled())
+            log.debug("SenderBean not found");
                                        continue;
                            }
                                
-                               String key = (String) 
senderBean.getMessageContextRefKey();
+                               String key = 
senderBean.getMessageContextRefKey();
                                MessageContext msgCtx = 
storageManager.retrieveMessageContext(key, context);
                                
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION,Sandesha2Constants.VALUE_TRUE);
                                
@@ -189,6 +206,8 @@
                                                //But this has a performance 
reduction.
                                                msgCtx.getEnvelope().build();
                                                
+            if (log.isDebugEnabled())
+              log.debug("Invoking using transportSender " + transportSender + 
", msgCtx=" + msgCtx.getEnvelope().getHeader());
                                                //TODO change this to cater for 
security.
                                                transportSender.invoke(msgCtx);
                                                successfullySent = true;
@@ -263,10 +282,14 @@
                                }
                        }
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::run");
        }
 
        public synchronized void runSenderForTheSequence(
                        ConfigurationContext context, String sequenceID) {
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::runSenderForTheSequence, " + sequenceID);
 
                if (sequenceID != null && 
!workingSequences.contains(sequenceID))
                        workingSequences.add(sequenceID);
@@ -276,6 +299,8 @@
                        runSender = true; // so that isSenderStarted()=true.
                        super.start();
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::runSenderForTheSequence");
        }
 
        private void updateMessage(MessageContext msgCtx1) throws 
SandeshaException {
@@ -284,6 +309,8 @@
 
        private void checkForSyncResponses(MessageContext msgCtx)
                        throws SandeshaException {
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::checkForSyncResponses, " + 
msgCtx.getEnvelope().getHeader());
 
                try {
 
@@ -355,17 +382,23 @@
                        
                } catch (Exception e) {
                        String message = "No valid Sync response...";
-                       log.debug(message);
+                       log.debug(message, e);
                        throw new SandeshaException(message, e);
                }
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::checkForSyncResponses");
        }
        
        private boolean isAckPiggybackableMsgType(int messageType) {
-               boolean piggybackable = true;
-               
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::isAckPiggybackableMsgType, " + messageType);
+               boolean piggybackable = true;           
+    
                if (messageType==Sandesha2Constants.MessageTypes.ACK) 
                        piggybackable = false;
                
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::isAckPiggybackableMsgType, " + piggybackable);
                return piggybackable;   
        }
        
@@ -377,11 +410,18 @@
        }
        
        private boolean isFaultEnvelope (SOAPEnvelope envelope) throws 
SandeshaException {              
+    if (log.isDebugEnabled())
+      log.debug("Enter: Sender::isFaultEnvelope, " + 
envelope.getBody().getFault());
                SOAPFault fault = envelope.getBody().getFault();
-               if (fault!=null)
+               if (fault!=null) {
+      if (log.isDebugEnabled())
+        log.debug("Exit: Sender::isFaultEnvelope, TRUE");
                        return true;
-               else
-                       return false;
+    }
+               
+    if (log.isDebugEnabled())
+      log.debug("Exit: Sender::isFaultEnvelope, FALSE");
+               return false;
        }
        
-}
\ No newline at end of file
+}



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

Reply via email to