list = new ArrayList<ConnInfo>();
id = TransIdMaker.getAndIncrement();
}
protected void commit() {
ComboException ce = new ComboException();
for (ConnInfo cInfo : list) {
try {
// 提交事务
cInfo.conn.commit();
// 恢复旧的事务级别
if (cInfo.conn.getTransactionIsolation() != cInfo.oldLevel)
cInfo.conn.setTransactionIsolation(cInfo.oldLevel);
}
catch (SQLException e) {
ce.add(e);
}
}
// 如果有一个数据源提交时发生异常,抛出
if (null != ce.getCause()) {
throw ce;
}
}