Codota Logo
DBI.setTransactionHandler
Code IndexAdd Codota to your IDE (free)

How to use
setTransactionHandler
method
in
org.skife.jdbi.v2.DBI

Best Java code snippets using org.skife.jdbi.v2.DBI.setTransactionHandler (Showing top 5 results out of 315)

  • Common ways to obtain DBI
private void myMethod () {
DBI d =
  • Codota IconDataSource dataSource;new DBI(dataSource)
  • Codota IconConnectionFactory connectionFactory;new DBI(connectionFactory)
  • Codota IconString url;String username;String password;new DBI(url, username, password)
  • Smart code suggestions by Codota
}
origin: org.kill-bill.commons/killbill-jdbi

@Override
public IDBI get() {
  final DBI dbi = new DBI(ds);
  for (final ArgumentFactory argumentFactory : argumentFactorySet) {
    dbi.registerArgumentFactory(argumentFactory);
  }
  for (final ResultSetMapperFactory resultSetMapperFactory : resultSetMapperFactorySet) {
    dbi.registerMapper(resultSetMapperFactory);
  }
  for (final ResultSetMapper resultSetMapper : resultSetMapperSet) {
    dbi.registerMapper(resultSetMapper);
  }
  if (transactionHandler != null) {
    dbi.setTransactionHandler(transactionHandler);
  }
  if (sqlLog != null) {
    dbi.setSQLLog(sqlLog);
  } else if (config != null) {
    final Slf4jLogging sqlLog = new Slf4jLogging(logger, config.getLogLevel());
    dbi.setSQLLog(sqlLog);
  }
  if (timingCollector != null) {
    dbi.setTimingCollector(timingCollector);
  }
  return dbi;
}
origin: com.ning.billing/killbill-analytics

  private DBI createDBI(final ConfigSource configSource) {
    final ComboPooledDataSource dataSource = new ComboPooledDataSource();
    dataSource.setJdbcUrl(configSource.getString(ANALYTICS_DBI_CONFIG_STRING + "url"));
    dataSource.setUser(configSource.getString(ANALYTICS_DBI_CONFIG_STRING + "user"));
    dataSource.setPassword(configSource.getString(ANALYTICS_DBI_CONFIG_STRING + "password"));
    dataSource.setMinPoolSize(1);
    dataSource.setMaxPoolSize(10);
    dataSource.setCheckoutTimeout(10 * 1000);
    dataSource.setMaxIdleTime(60 * 60);
    dataSource.setMaxConnectionAge(0);
    dataSource.setIdleConnectionTestPeriod(5 * 60);

    final DBI dbi = new DBI(dataSource);
    dbi.registerArgumentFactory(new UUIDArgumentFactory());
    dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
    dbi.registerArgumentFactory(new DateTimeArgumentFactory());
    dbi.registerArgumentFactory(new LocalDateArgumentFactory());
    dbi.registerArgumentFactory(new EnumArgumentFactory());
    dbi.registerMapper(new UuidMapper());
    try {
      dbi.setTransactionHandler((TransactionHandler) Class.forName("com.ning.jetty.jdbi.RestartTransactionRunner").newInstance());
    } catch (Exception e) {
      logger.warn("Unable to register transaction handler");
    }

    return dbi;
  }
}
origin: org.kill-bill.commons/killbill-queue

dbi = new DBI(embeddedDB.getDataSource());
InTransaction.setupDBI(dbi);
dbi.setTransactionHandler(new NotificationTransactionHandler(databaseTransactionNotificationApi));
origin: com.ning.jetty/ning-service-skeleton-jdbi

logger.info("Using " + config.getTransactionHandlerClass() + " as a transaction handler class");
try {
  dbi.setTransactionHandler((TransactionHandler) Class.forName(config.getTransactionHandlerClass()).newInstance());
} catch (Exception e) {
  throw new RuntimeException(e);
origin: com.ning.billing/killbill-util

  @Override
  public IDBI get() {
    final DBI dbi = new DBI(ds);
    dbi.registerArgumentFactory(new UUIDArgumentFactory());
    dbi.registerArgumentFactory(new DateTimeZoneArgumentFactory());
    dbi.registerArgumentFactory(new DateTimeArgumentFactory());
    dbi.registerArgumentFactory(new LocalDateArgumentFactory());
    dbi.registerArgumentFactory(new EnumArgumentFactory());
    dbi.registerMapper(new UuidMapper());
    dbi.registerMapper(new AuditLogModelDaoMapper());
    dbi.registerMapper(new RecordIdIdMappingsMapper());

    // Restart transactions in case of deadlocks
    dbi.setTransactionHandler(new SerializableTransactionRunner());
    //final SQLLog log = new Log4JLog();
    //dbi.setSQLLog(log);

    return dbi;
  }
}
org.skife.jdbi.v2DBIsetTransactionHandler

Javadoc

Specify the TransactionHandler instance to use. This allows overriding transaction semantics, or mapping into different transaction management systems.

The default version uses local transactions on the database Connection instances obtained.

Popular methods of DBI

  • <init>
    Constructor used to allow for obtaining a Connection in a customized manner. The org.skife.jdbi.v2.t
  • open
  • onDemand
    Create a new sql object which will obtain and release connections from this dbi instance, as it need
  • registerMapper
    Register a result set mapper which will have its parameterized type inspected to determine what it m
  • withHandle
    A convenience function which manages the lifecycle of a handle and yields it to a callback for use b
  • registerArgumentFactory
  • inTransaction
  • setSQLLog
    Specify the class used to log sql statements. Will be passed to all handles created from this instan
  • registerContainerFactory
  • setStatementLocator
    Use a non-standard StatementLocator to look up named statements for all handles created from this DB
  • setStatementRewriter
    Use a non-standard StatementRewriter to transform SQL for all Handle instances created by this DBI.
  • setTimingCollector
    Add a callback to accumulate timing information about the queries running from this data source.
  • setStatementRewriter,
  • setTimingCollector,
  • useHandle,
  • define,
  • close,
  • getStatementLocator,
  • getTransactionHandler,
  • registerColumnMapper

Popular in Java

  • Finding current android device location
  • getSharedPreferences (Context)
  • startActivity (Activity)
  • compareTo (BigDecimal)
    Compares this BigDecimal with the specified BigDecimal. Two BigDecimal objects that are equal in val
  • FileOutputStream (java.io)
    A file output stream is an output stream for writing data to aFile or to a FileDescriptor. Whether
  • System (java.lang)
    Provides access to system-related information and resources including standard input and output. Ena
  • Thread (java.lang)
    A thread is a thread of execution in a program. The Java Virtual Machine allows an application to ha
  • Socket (java.net)
    Provides a client-side TCP socket.
  • SocketException (java.net)
    This SocketException may be thrown during socket creation or setting options, and is the superclass
  • PriorityQueue (java.util)
    An unbounded priority Queue based on a priority heap. The elements of the priority queue are ordered
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now