commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jstrac...@apache.org
Subject cvs commit: jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet XAConsumerThread.java
Date Fri, 08 Nov 2002 16:23:26 GMT
jstrachan    2002/11/08 08:23:25

  Modified:    messenger/src/java/org/apache/commons/messagelet
                        XAConsumerThread.java
  Log:
  Fixed an XA schoolboy error; the delist() should be called prior to a commit() or rollback().
DOH!
  
  Revision  Changes    Path
  1.3       +10 -13    jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/XAConsumerThread.java
  
  Index: XAConsumerThread.java
  ===================================================================
  RCS file: /home/cvs/jakarta-commons-sandbox/messenger/src/java/org/apache/commons/messagelet/XAConsumerThread.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- XAConsumerThread.java	8 Nov 2002 15:26:00 -0000	1.2
  +++ XAConsumerThread.java	8 Nov 2002 16:23:25 -0000	1.3
  @@ -147,8 +147,15 @@
   	 * a transaction.
   	 */
   	protected void commitTransaction() throws Exception {
  -		transaction.commit();
   		delist(transaction, XAResource.TMSUCCESS);
  +		try {
  +			transaction.commit();
  +		}
  +		catch (Exception e) {
  +			log.error("Caught exception while committing txn: " + e, e);
  +			transaction.setRollbackOnly();
  +			throw e;		
  +		}
   	}
   
   	/**
  @@ -156,18 +163,8 @@
   	 * a transaction.
   	 */
   	protected void rollbackTransaction() throws Exception {
  -		transaction.rollback();
  -		delist(transaction, XAResource.TMFAIL);
  -	}
  -
  -	/**
  -	* Strategy method to represent the code required to rollback
  -	* a transaction.
  -	*/
  -	protected void rollbackOnlyTransaction(Exception e) throws Exception {
  -		transaction.setRollbackOnly();
  -		log.error(e);
   		delist(transaction, XAResource.TMFAIL);
  +		transaction.rollback();
   	}
   
   	/**
  @@ -176,8 +173,8 @@
   	 * This is called when a message is not received.
   	 */
   	protected void cancelTransaction() throws Exception {
  -		transaction.rollback();
   		delist(transaction, XAResource.TMFAIL);
  +		transaction.rollback();
   	}
   
   	/**
  
  
  

--
To unsubscribe, e-mail:   <mailto:commons-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:commons-dev-help@jakarta.apache.org>


Mime
View raw message