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

io.ebeaninternal.server.transaction.ExternalTransactionScopeManager Maven / Gradle / Ivy

There is a newer version: 15.8.1
Show newest version
package io.ebeaninternal.server.transaction;

import io.ebean.config.ExternalTransactionManager;
import io.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;
  }

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


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

  @Override
  public SpiTransaction get() {

    return (SpiTransaction) externalManager.getCurrentTransaction();
  }

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

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

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




© 2015 - 2025 Weber Informatics LLC | Privacy Policy