Add max query timeout setting for h2 dialect
Change-Id: I78985722fc01f72885318d128a05d617087d8eea
This commit is contained in:
@@ -1905,6 +1905,13 @@ utils (e.g. MigrateToNoteDb).
|
||||
+
|
||||
Default is `false`.
|
||||
|
||||
[[database.h2.maxQueryTimeout]]database.h2.maxQueryTimeout::
|
||||
+
|
||||
The maximum timeout of a query in milliseconds.
|
||||
(see http://www.h2database.com/javadoc/org/h2/engine/DbSettings.html?#MAX_QUERY_TIMEOUT[MAX_QUERY_TIMEOUT]).
|
||||
+
|
||||
The default is 0, meaning no limit.
|
||||
|
||||
[[download]]
|
||||
=== Section download
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ class H2 extends BaseDataSourceType {
|
||||
|
||||
public static String appendUrlOptions(Config cfg, String url) {
|
||||
long h2CacheSize = cfg.getLong("database", "h2", "cacheSize", -1);
|
||||
long h2MaxQueryTimeout = cfg.getLong("database", "h2", "maxQueryTimeout", -1);
|
||||
boolean h2AutoServer = cfg.getBoolean("database", "h2", "autoServer", false);
|
||||
|
||||
StringBuilder urlBuilder = new StringBuilder().append(url);
|
||||
@@ -55,6 +56,9 @@ class H2 extends BaseDataSourceType {
|
||||
// H2 CACHE_SIZE is always given in KB
|
||||
urlBuilder.append(";CACHE_SIZE=").append(h2CacheSize / 1024);
|
||||
}
|
||||
if (h2MaxQueryTimeout >= 0) {
|
||||
urlBuilder.append(";MAX_QUERY_TIMEOUT=").append(h2MaxQueryTimeout);
|
||||
}
|
||||
if (h2AutoServer) {
|
||||
urlBuilder.append(";AUTO_SERVER=TRUE");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user