Пример #1
0
  @Override
  protected boolean rollbackNative(ITrxSavepoint savepoint) throws SQLException
        // metas: end: 02367
      {
    if (m_connection == null || m_connection.getAutoCommit()) {
      log.debug(
          "rollbackNative: doing nothing because we have a null or autocomit connection; this={}, connection={}",
          this,
          m_connection);
      return false;
    }

    final String trxName = getTrxName();
    final Savepoint jdbcSavepoint = (Savepoint) savepoint.getNativeSavepoint();

    // local
    try {
      if (m_connection != null) {
        m_connection.rollback(jdbcSavepoint);
        log.debug("**** {}", trxName);
        return true;
      }
    } catch (SQLException e) {
      // Do nothing. The Savepoint might have been discarded because of an intermediate commit or
      // rollback
      // FIXME: track in AbstractTrx which savepoints where implicitly discarded in this way and
      // don't call rollbackNative in such a case.
      // log.error(trxName, e);
      // throw e;
    }
    return false;
  } // rollback
Пример #2
0
  @Override
  protected boolean releaseSavepointNative(final ITrxSavepoint savepoint) throws Exception {
    final Savepoint jdbcSavepoint = (Savepoint) savepoint.getNativeSavepoint();

    if (m_connection == null) {
      log.warn(
          "Cannot release savepoint "
              + savepoint
              + " because there is no active connection. Ignoring it.");
      return false;
    }
    if (m_connection.isClosed()) {
      log.warn(
          "Cannot release savepoint "
              + savepoint
              + " because the connection is closed. Ignoring it.");
      return false;
    }

    m_connection.releaseSavepoint(jdbcSavepoint);
    return true;
  }
Пример #3
0
 /**
  * @param name
  * @return Savepoint
  * @throws SQLException @Deprecated Please use {@link #createTrxSavepoint(String)}
  */
 @Deprecated
 public Savepoint setSavepoint(String name) throws SQLException {
   final ITrxSavepoint savepoint = createTrxSavepoint(name);
   final Savepoint jdbcSavepoint = (Savepoint) savepoint.getNativeSavepoint();
   return jdbcSavepoint;
 }