ws-sandesha-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gatf...@apache.org
Subject svn commit: r580921 - /webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
Date Mon, 01 Oct 2007 11:01:14 GMT
Author: gatfora
Date: Mon Oct  1 04:01:08 2007
New Revision: 580921

URL: http://svn.apache.org/viewvc?rev=580921&view=rev
Log:
SenderBean changed to set sentCount in adjustRetransmission is not the same bean instance
as the one updated in SenderBeanManager from inside the SenderWorker

Modified:
    webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java

Modified: webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
URL: http://svn.apache.org/viewvc/webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java?rev=580921&r1=580920&r2=580921&view=diff
==============================================================================
--- webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
(original)
+++ webservices/sandesha/trunk/java/modules/core/src/main/java/org/apache/sandesha2/workers/SenderWorker.java
Mon Oct  1 04:01:08 2007
@@ -200,20 +200,6 @@
 				return;
 			}
 			
-			boolean continueSending = updateMessage(rmMsgCtx,senderBean,storageManager);
-
-			if (!continueSending) { 
-				if (log.isDebugEnabled())
-					log.debug("Exit: SenderWorker::run, !continueSending");
-				
-				if(transaction != null && transaction.isActive()) {
-					transaction.commit();
-					transaction = null;
-				}
-				
-				return;
-			}
-
 			int messageType = senderBean.getMessageType();
 			
 			if (isAckPiggybackableMsgType(messageType)) {
@@ -225,17 +211,33 @@
 				transaction = AcknowledgementManager.piggybackAcksIfPresent(rmMsgCtx, storageManager,
transaction);
 			}
 
-			// sending the message
-			boolean successfullySent = false;
+			
+			if (transaction != null && transaction.isActive()) 
+				transaction.commit();			
+			
+			transaction = storageManager.getTransaction();
+			
+			senderBean = updateMessage(rmMsgCtx,senderBean,storageManager);
+
+			if (senderBean == null) { 
+				if (log.isDebugEnabled())
+					log.debug("Exit: SenderWorker::run, !continueSending");
+				
+				if(transaction != null && transaction.isActive()) {
+					transaction.rollback();
+					transaction = null;
+				}
+				
+				return;
+			}
 
 			// Although not actually sent yet, update the send count to indicate an attempt
 			if (senderBean.isReSend()) {
-				SenderBean bean2 = senderBeanMgr.retrieve(senderBean.getMessageID());
-				if (bean2 != null) {
-					bean2.setSentCount(senderBean.getSentCount());
-					senderBeanMgr.update(bean2);
-				}
+				senderBeanMgr.update(senderBean);
 			}
+
+			// sending the message
+			boolean successfullySent = false;
 			
 			//try to redecorate the EPR if necessary
 			if (log.isDebugEnabled())
@@ -401,20 +403,20 @@
 	 * for the message. If the message is an application message then we ensure that we have
added
 	 * the Sequence header.
 	 */
-	private boolean updateMessage(RMMsgContext rmMsgContext, SenderBean senderBean, StorageManager
storageManager) throws AxisFault {
+	private SenderBean updateMessage(RMMsgContext rmMsgContext, SenderBean senderBean, StorageManager
storageManager) throws AxisFault {
 		
 		// Lock the message to enable retransmission update
 		senderBean = storageManager.getSenderBeanMgr().retrieve(senderBean.getMessageID());
 		
 		// Only continue if we find a SenderBean
 		if (senderBean == null)
-			return false;
+			return senderBean;
 
 		int messageType = senderBean.getMessageType();
 
 		boolean continueSending = MessageRetransmissionAdjuster.adjustRetransmittion(
 				rmMsgContext, senderBean, rmMsgContext.getConfigurationContext(), storageManager);
-		if(!continueSending) return false;
+		if(!continueSending) return null;
 		
 		Identifier id = null;
 
@@ -497,7 +499,7 @@
 			
 		}
 		
-		return true;
+		return senderBean;
 	}
 	
 	private boolean isAckPiggybackableMsgType(int messageType) {



---------------------------------------------------------------------
To unsubscribe, e-mail: sandesha-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: sandesha-dev-help@ws.apache.org


Mime
View raw message