All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.avaje.ebeaninternal.server.transaction.ExternalTransactionScopeManager Maven / Gradle / Ivy

There is a newer version: 8.1.1
Show newest version
package com.avaje.ebeaninternal.server.transaction;

import com.avaje.ebean.config.ExternalTransactionManager;
import com.avaje.ebeaninternal.api.SpiTransaction;

/**
 * A TransactionScopeManager aware of external transaction managers.
 */
public class ExternalTransactionScopeManager extends TransactionScopeManager {

  final ExternalTransactionManager externalManager;

  /**
   * Instantiates  transaction scope manager.
   *
   * @param transactionManager the transaction manager
   */
  public ExternalTransactionScopeManager(TransactionManager transactionManager, ExternalTransactionManager externalManager) {
    super(transactionManager);
    this.externalManager = externalManager;
  }

  public void commit() {
    DefaultTransactionThreadLocal.commit(serverName);
  }


  public void end() {
    DefaultTransactionThreadLocal.end(serverName);
  }

  public SpiTransaction get() {

    return (SpiTransaction) externalManager.getCurrentTransaction();
  }

  public void replace(SpiTransaction trans) {
    DefaultTransactionThreadLocal.replace(serverName, trans);
  }

  public void rollback() {
    DefaultTransactionThreadLocal.rollback(serverName);
  }

  public void set(SpiTransaction trans) {
    DefaultTransactionThreadLocal.set(serverName, trans);
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy