src/org/nutz/trans/NutTransaction.java
@Override
    public void close() {
        ComboException ce = new ComboException();
        for (ConnInfo cInfo : list) {
            try {
                // 试图恢复旧的事务级别
                if (!cInfo.conn.isClosed()) {
                    if (cInfo.restoreIsoLevel)
                        cInfo.conn.setTransactionIsolation(cInfo.oldLevel);
                    if (cInfo.restoreAutoCommit)
                        cInfo.conn.setAutoCommit(true);
                }
            }
            catch (Throwable e) {}
            finally {
                try {
                    cInfo.conn.close();
                }
                catch (Exception e) {
                    ce.add(e);
                }
            }
        }
        // 清除数据源记录
        list.clear();
    }
@Override
    public void close() {
        ComboException ce = new ComboException();
        for (ConnInfo cInfo : list) {
            try {
                // 试图恢复旧的事务级别
                if (!cInfo.conn.isClosed()) {
                    if (cInfo.restoreIsoLevel)
                        cInfo.conn.setTransactionIsolation(cInfo.oldLevel);
                    if (cInfo.restoreAutoCommit)
                        cInfo.conn.setAutoCommit(true);
                }
            }
            catch (Throwable e) {}
            finally {
                try {
                    cInfo.conn.close();
                }
                catch (Exception e) {
                    ce.add(e);
                }
            }
        }
        // 清除数据源记录
        list.clear();
    }
@ Override public void close ( ) { ComboException ce = new ComboException ( ) ; for ( ConnInfo cInfo : list ) { try { // 试图恢复旧的事务级别 if ( ! cInfo . conn . isClosed ( ) ) { if ( cInfo . restoreIsoLevel ) cInfo . conn . setTransactionIsolation ( cInfo . oldLevel ) ; if ( cInfo . restoreAutoCommit ) cInfo . conn . setAutoCommit ( true ) ; } } catch ( Throwable e ) { } finally { try { cInfo . conn . close ( ) ; } catch ( Exception e ) { ce . add ( e ) ; } } } // 清除数据源记录 list . clear ( ) ; }
关闭事务,清理现场
关闭事务 清理现场