Author: chamikara
Date: Sun May 14 12:11:02 2006
New Revision: 406403

URL: http://svn.apache.org/viewcvs?rev=406403&view=rev
Log:
Enclosed the commit and roleback method called with try-catch blocks.

Modified:
    webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
    
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java
    webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/Sandesha2Constants.java 
Sun May 14 12:11:02 2006
@@ -483,7 +483,7 @@
        
        String INMEMORY_STORAGE_MANAGER = "inmemory";
        
-       String PERMANENT_STORAGE_MANAGER = "permanent";
+       String PERMANENT_STORAGE_MANAGER = "persistent";
        
        String DEFAULT_STORAGE_MANAGER = INMEMORY_STORAGE_MANAGER;
        

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaGlobalInHandler.java
 Sun May 14 12:11:02 2006
@@ -75,13 +75,12 @@
                try {
                        storageManager = 
SandeshaUtil.getSandeshaStorageManager(configContext,configContext.getAxisConfiguration());
                        if (storageManager==null) {
-                               //TODO make this a log
-                               System.out.println ("Sandesha2 cannot proceed. 
The StorageManager is not available");
+                               log.debug ("Sandesha2 cannot proceed. The 
StorageManager is not available");
                                return;
                        }
                } catch (SandeshaException e1) {
                        //TODO make this a log
-                       System.out.println ("Sandesha2 cannot proceed. 
Exception thrown when looking for the StorageManager");
+                       log.debug ("Sandesha2 cannot proceed. Exception thrown 
when looking for the StorageManager");
                        return;
                }
 
@@ -180,17 +179,27 @@
                        msgContext.pause();
                        
                        if (!withinTransaction) {
-                               transaction.rollback();
-                               
msgContext.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
-                               rolebacked = true;
+                               try {
+                                       transaction.rollback();
+                                       
msgContext.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                                       rolebacked = true;
+                               } catch (Exception e1) {
+                                       String message = "Exception thrown when 
trying to roleback the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                        
                        String message = "Sandesha2 got an exception when 
processing the in message";
                        throw new AxisFault (message,e);
                } finally {
                        if (!withinTransaction && !rolebacked) {
-                               transaction.commit();
-                               
msgContext.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               try {
+                                       transaction.commit();
+                                       
msgContext.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               } catch (Exception e) {
+                                       String message = "Exception thrown when 
trying to commit the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                }
        }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaInHandler.java
 Sun May 14 12:11:02 2006
@@ -113,17 +113,27 @@
                        msgCtx.pause();
                        
                        if (!withinTransaction) {
-                               transaction.rollback();
-                               
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
-                               rolebacked = true;
+                               try {
+                                       transaction.rollback();
+                                       
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                                       rolebacked = true;
+                               } catch (Exception e1) {
+                                       String message = "Exception thrown when 
trying to roleback the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                        
                        String message = "Sandesha2 got an exception when 
processing the in message";
                        throw new AxisFault (message,e);
                } finally {
                        if (!withinTransaction && !rolebacked) {
-                               transaction.commit();
-                               
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               try {
+                                       transaction.commit();
+                                       
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               } catch (Exception e) {
+                                       String message = "Exception thrown when 
trying to commit the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                }
 

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/handlers/SandeshaOutHandler.java
 Sun May 14 12:11:02 2006
@@ -124,17 +124,27 @@
                        
                        //rolling back the transaction
                        if (!withinTransaction) {
-                               transaction.rollback();
-                               
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
-                               rolebacked = true;
+                               try {
+                                       transaction.rollback();
+                                       
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                                       rolebacked = true;
+                               } catch (Exception e1) {
+                                       String message = "Exception thrown when 
trying to roleback the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                        
                        String message = "Sandesha2 got an exception when 
processing the out message";
                        throw new AxisFault (message,e);
                } finally {
                        if (!withinTransaction && !rolebacked) {
-                               transaction.commit();
-                               
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               try {
+                                       transaction.commit();
+                                       
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION, 
Sandesha2Constants.VALUE_FALSE);
+                               } catch (Exception e) {
+                                       String message = "Exception thrown when 
trying to commit the transaction.";
+                                       log.debug(message,e);
+                               }
                        }
                }
        }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
 (original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/msgreceivers/RMMessageReceiver.java
 Sun May 14 12:11:02 2006
@@ -21,7 +21,10 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.receivers.AbstractMessageReceiver;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
 import org.apache.sandesha2.RMMsgContext;
+import org.apache.sandesha2.handlers.SandeshaGlobalInHandler;
 import org.apache.sandesha2.util.MsgInitializer;
 import org.apache.sandesha2.util.SandeshaUtil;
 
@@ -36,11 +39,13 @@
 
 public class RMMessageReceiver extends AbstractMessageReceiver {
 
+       private static final Log log = 
LogFactory.getLog(RMMessageReceiver.class.getName());
+       
        public final void receive(MessageContext messgeCtx) throws AxisFault {
-               System.out.println("RM MESSSAGE RECEIVER WAS CALLED");
+               log.info("RM MESSSAGE RECEIVER WAS CALLED");
                
                RMMsgContext rmMsgCtx = 
MsgInitializer.initializeMessage(messgeCtx);
-               System.out.println("MsgReceiver got type:" + 
SandeshaUtil.getMessageTypeString(rmMsgCtx.getMessageType()));     
+               log.info("MsgReceiver got type:" + 
SandeshaUtil.getMessageTypeString(rmMsgCtx.getMessageType()));       
        }
        
 }

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=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java 
(original)
+++ 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/InOrderInvoker.java 
Sun May 14 12:11:02 2006
@@ -210,17 +210,27 @@
                                        }       
                                }
                                
-                       } catch (Exception e1) {
-                               String message = "Sandesha2 got an exception 
when trying to invoke the message";
-                               log.debug(message,e1);
-                               
+                       } catch (Exception e) {                         
                                if (transaction!=null) {
-                                       transaction.rollback();
-                                       rolebacked = true;
+                                       try {
+                                               transaction.rollback();
+                                               rolebacked = true;
+                                       } catch (Exception e1) {
+                                               String message = "Exception 
thrown when trying to roleback the transaction.";
+                                               log.debug(message,e1);
+                                       }
                                }
+                               String message = "Sandesha2 got an exception 
when trying to invoke the message";
+                               log.debug(message,e);
                        } finally { 
-                               if (!rolebacked && transaction!=null) 
-                                       transaction.commit();
+                               if (!rolebacked && transaction!=null) {
+                                       try {
+                                               transaction.commit();
+                                       } catch (Exception e) {
+                                               String message = "Exception 
thrown when trying to commit the transaction.";
+                                               log.debug(message,e);
+                                       }
+                               }
                        }
                }
        }

Modified: 
webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java
URL: 
http://svn.apache.org/viewcvs/webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java?rev=406403&r1=406402&r2=406403&view=diff
==============================================================================
--- webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java 
(original)
+++ webservices/sandesha/trunk/src/org/apache/sandesha2/workers/Sender.java Sun 
May 14 12:11:02 2006
@@ -232,19 +232,31 @@
                                
msgCtx.setProperty(Sandesha2Constants.WITHIN_TRANSACTION,Sandesha2Constants.VALUE_FALSE);
                                
                        } catch (Exception e) {
-                               String message = "An Exception was throws in 
sending";
-                               log.debug(message,e);
                                
                                // TODO : when this is the client side throw 
the exception to
                                // the client when necessary.
 
                                if (transaction!=null) {
-                                       transaction.rollback();
-                                       rolebacked = true;
+                                       try {
+                                               transaction.rollback();
+                                               rolebacked = true;
+                                       } catch (Exception e1) {
+                                               String message = "Exception 
thrown when trying to roleback the transaction.";
+                                               log.debug(message,e1);
+                                       }
                                }
+                               
+                               String message = "An Exception was throws in 
sending";
+                               log.debug(message,e);
                        } finally {
-                               if (transaction!=null && !rolebacked) 
-                                       transaction.commit();
+                               if (transaction!=null && !rolebacked) {
+                                       try {
+                                               transaction.commit();
+                                       } catch (Exception e) {
+                                               String message = "Exception 
thrown when trying to commit the transaction.";
+                                               log.debug(message,e);
+                                       }
+                               }
                        }
                }
        }



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

Reply via email to