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

com.scalar.db.sql.SqlTransactionProvider Maven / Gradle / Ivy

There is a newer version: 3.14.0
Show newest version
package com.scalar.db.sql;

import java.util.Properties;
import javax.annotation.Nullable;

/**
 * An interface that creates {@link SqlTransactionManager} and {@link
 * SqlTwoPhaseCommitTransactionManager} instances. Each connection mode should implement this
 * interface. The implementation is assumed to be loaded by {@link java.util.ServiceLoader}.
 */
public interface SqlTransactionProvider {

  /**
   * Returns the name of the connection mode. This is for the configuration {@link
   * SqlConfig#CONNECTION_MODE}.
   *
   * @return the name of the connection mode
   */
  String getName();

  /**
   * Creates an instance of {@link SqlTransactionManager} for the connection mode.
   *
   * @param properties properties for the configuration
   * @return an instance of {@link SqlTransactionManager} for the connection mode
   */
  SqlTransactionManager createSqlTransactionManager(Properties properties);

  /**
   * Creates an instance of {@link SqlTwoPhaseCommitTransactionManager} for the connection mode.
   *
   * @param properties properties for the configuration
   * @return an instance of {@link SqlTwoPhaseCommitTransactionManager} for the connection mode. If
   *     the transaction manager does not support the two-phase commit interface, returns {@code
   *     null}.
   */
  @Nullable
  SqlTwoPhaseCommitTransactionManager createSqlTwoPhaseCommitTransactionManager(
      Properties properties);
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy