Log the error that caused the rollback

git-svn-id: https://svn.apache.org/repos/asf/activemq/trunk@509486 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Robert Davies 2007-02-20 09:58:34 +00:00
parent a5f74d673d
commit 7b317ba7ad
1 changed files with 4 additions and 1 deletions

View File

@ -18,9 +18,10 @@
package org.apache.activemq.util;
import java.io.IOException;
import org.apache.activemq.broker.ConnectionContext;
import org.apache.activemq.store.PersistenceAdapter;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A helper class for running code with a PersistenceAdapter
@ -29,6 +30,7 @@ import org.apache.activemq.store.PersistenceAdapter;
* @version $Revision: 1.2 $
*/
public class TransactionTemplate {
static private final Log log=LogFactory.getLog(TransactionTemplate.class);
private PersistenceAdapter persistenceAdapter;
private ConnectionContext context;
@ -59,6 +61,7 @@ public class TransactionTemplate {
persistenceAdapter.commitTransaction(context);
}
else {
log.error("Having to Rollback - caught an exception: " + throwable);
persistenceAdapter.rollbackTransaction(context);
}
}