예제 #1
0
  private void handleEndTransaction(DruidAbstractDataSource dataSource, Savepoint savepoint) {
    if (transactionInfo != null && savepoint == null) {
      transactionInfo.setEndTimeMillis();

      long transactionMillis =
          transactionInfo.getEndTimeMillis() - transactionInfo.getStartTimeMillis();
      dataSource.getTransactionHistogram().record(transactionMillis);

      dataSource.logTransaction(transactionInfo);

      transactionInfo = null;
    }
  }
예제 #2
0
  protected void transactionRecord(String sql) throws SQLException {
    if (transactionInfo == null && (!conn.getAutoCommit())) {
      DruidAbstractDataSource dataSource = holder.getDataSource();
      dataSource.incrementStartTransactionCount();
      transactionInfo = new TransactionInfo(dataSource.createTransactionId());
    }

    if (transactionInfo != null) {
      transactionInfo.getSqlList().add(sql);
    }
  }