mirror of
https://github.com/GravitLauncher/Launcher
synced 2024-11-15 11:39:11 +03:00
Правки Hikari кода
This commit is contained in:
parent
23966a3b04
commit
d450a17d58
1 changed files with 1 additions and 7 deletions
|
@ -105,19 +105,13 @@ public synchronized Connection getConnection() throws SQLException {
|
||||||
Class.forName("com.zaxxer.hikari.HikariDataSource");
|
Class.forName("com.zaxxer.hikari.HikariDataSource");
|
||||||
hikari = true; // Used for shutdown. Not instanceof because of possible classpath error
|
hikari = true; // Used for shutdown. Not instanceof because of possible classpath error
|
||||||
HikariConfig cfg = new HikariConfig();
|
HikariConfig cfg = new HikariConfig();
|
||||||
cfg.setUsername(username);
|
|
||||||
cfg.setPassword(password);
|
|
||||||
cfg.setDataSource(mysqlSource);
|
cfg.setDataSource(mysqlSource);
|
||||||
cfg.setPoolName(poolName);
|
cfg.setPoolName(poolName);
|
||||||
cfg.setMinimumIdle(0);
|
|
||||||
cfg.setMaximumPoolSize(MAX_POOL_SIZE);
|
cfg.setMaximumPoolSize(MAX_POOL_SIZE);
|
||||||
cfg.setIdleTimeout(TIMEOUT * 1000L);
|
|
||||||
// Set HikariCP pool
|
// Set HikariCP pool
|
||||||
HikariDataSource hikariSource = new HikariDataSource(cfg);
|
|
||||||
// Replace source with hds
|
// Replace source with hds
|
||||||
source = hikariSource;
|
source = new HikariDataSource(cfg);
|
||||||
LogHelper.info("HikariCP pooling enabled for '%s'", poolName);
|
LogHelper.info("HikariCP pooling enabled for '%s'", poolName);
|
||||||
return hikariSource.getConnection();
|
|
||||||
} catch (ClassNotFoundException ignored) {
|
} catch (ClassNotFoundException ignored) {
|
||||||
LogHelper.warning("HikariCP isn't in classpath for '%s'", poolName);
|
LogHelper.warning("HikariCP isn't in classpath for '%s'", poolName);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue