com.scalar.db.sql.springdata.txmgr.ScalarDbSuspendableTransactionManager Maven / Gradle / Ivy
package com.scalar.db.sql.springdata.txmgr;
import com.scalar.db.sql.springdata.ScalarDbExceptionTranslator;
import javax.annotation.Nonnull;
import javax.sql.DataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.jdbc.support.JdbcTransactionManager;
import org.springframework.transaction.support.DefaultTransactionStatus;
public class ScalarDbSuspendableTransactionManager extends JdbcTransactionManager {
private static final Logger logger =
LoggerFactory.getLogger(ScalarDbSuspendableTransactionManager.class);
public ScalarDbSuspendableTransactionManager(DataSource dataSource) {
super(dataSource);
setExceptionTranslator(new ScalarDbExceptionTranslator(getExceptionTranslator()));
}
@Override
// CRUD (Execution), prepare and validate operations on participants shouldn't be committed before
// explicit commit requests from the coordinator. It's the reason why this method is overridden.
protected void doCommit(@Nonnull DefaultTransactionStatus status) {
logger.debug(
"doCommit() is called. But this transaction manager is for 2PC and does nothing here. status:{}",
status);
}
}