View Javadoc
1   package com.atlassian.activeobjects.internal;
2   
3   import com.atlassian.sal.api.transaction.TransactionCallback;
4   import org.slf4j.Logger;
5   import org.slf4j.LoggerFactory;
6   
7   /**
8    * An abstract implementation that log at debug level runtime exception that cross the boundary
9    * of a transaction.
10   */
11  abstract class AbstractLoggingTransactionManager implements TransactionManager {
12      protected final Logger logger = LoggerFactory.getLogger(this.getClass());
13  
14      public final <T> T doInTransaction(TransactionCallback<T> callback) {
15          try {
16              return inTransaction(callback);
17          } catch (RuntimeException e) {
18              logger.debug("Exception thrown within transaction", e);
19              throw e;
20          }
21      }
22  
23      abstract <T> T inTransaction(TransactionCallback<T> callback);
24  }