提交 11ac5243 authored 作者: Evgenij Ryazanov's avatar Evgenij Ryazanov

Consume possible expected exception in TestMemoryUsage

上级 ade0f58b
......@@ -13,6 +13,7 @@ import java.sql.Statement;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import org.h2.api.ErrorCode;
import org.h2.test.TestBase;
import org.h2.test.TestDb;
import org.h2.util.Utils;
......@@ -72,7 +73,7 @@ public class TestMemoryUsage extends TestDb {
}
} finally {
freeMemory();
conn.close();
closeConnection(conn);
}
}
......@@ -145,7 +146,24 @@ public class TestMemoryUsage extends TestDb {
}
} finally {
freeMemory();
closeConnection(conn);
}
}
/**
* Closes the specified connection. It silently consumes OUT_OF_MEMORY that
* may happen in background thread during the tests.
*
* @param conn connection to close
* @throws SQLException on other SQL exception
*/
private static void closeConnection(Connection conn) throws SQLException {
try {
conn.close();
} catch (SQLException e) {
if (e.getErrorCode() != ErrorCode.OUT_OF_MEMORY) {
throw e;
}
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论