From 62991ed709724b5f384c6dd8652213a16666bdc4 Mon Sep 17 00:00:00 2001 From: microwin7 Date: Sat, 4 Sep 2021 08:51:34 +0300 Subject: [PATCH 1/5] [FIX] MySQLSourceConfig HikariCP --- .../launchserver/auth/MySQLSourceConfig.java | 24 +++++++++++-------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/MySQLSourceConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/MySQLSourceConfig.java index 459e8c38..ec9d1e60 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/MySQLSourceConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/MySQLSourceConfig.java @@ -32,8 +32,8 @@ public final class MySQLSourceConfig implements AutoCloseable { private String username; private String password; private String database; - private String timeZone; - private boolean enableHikari; + private String timezone; + private boolean useHikari; // Cache private transient DataSource source; @@ -93,22 +93,26 @@ public synchronized Connection getConnection() throws SQLException { mysqlSource.setPassword(password); mysqlSource.setDatabaseName(database); mysqlSource.setTcpNoDelay(true); - if (timeZone != null) mysqlSource.setServerTimezone(timeZone); + if (timezone != null) mysqlSource.setServerTimezone(timezone); hikari = false; // Try using HikariCP source = mysqlSource; - if (enableHikari) { + if (useHikari) { try { Class.forName("com.zaxxer.hikari.HikariDataSource"); hikari = true; // Used for shutdown. Not instanceof because of possible classpath error - HikariConfig cfg = new HikariConfig(); - cfg.setDataSource(mysqlSource); - cfg.setPoolName(poolName); - cfg.setMaximumPoolSize(MAX_POOL_SIZE); + HikariConfig hikariConfig = new HikariConfig(); + hikariConfig.setDataSource(mysqlSource); + hikariConfig.setPoolName(poolName); + hikariConfig.setMinimumIdle(1); + hikariConfig.setMaximumPoolSize(MAX_POOL_SIZE); + hikariConfig.setConnectionTestQuery("SELECT 1"); + hikariConfig.setConnectionTimeout(1000); + hikariConfig.setAutoCommit(true); + hikariConfig.setLeakDetectionThreshold(2000); // Set HikariCP pool // Replace source with hds - source = new HikariDataSource(cfg); - logger.warn("HikariCP pooling enabled for '{}'", poolName); + source = new HikariDataSource(hikariConfig); } catch (ClassNotFoundException ignored) { logger.debug("HikariCP isn't in classpath for '{}'", poolName); } From ad5c2382cf713a266e2eb3db62bb3109f6378a95 Mon Sep 17 00:00:00 2001 From: microwin7 Date: Sat, 4 Sep 2021 08:54:34 +0300 Subject: [PATCH 2/5] [FIX] AdditionalHash_module --- .../gravit/launchserver/auth/provider/MySQLAuthProvider.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/MySQLAuthProvider.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/MySQLAuthProvider.java index fbb0f387..d3be58ba 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/MySQLAuthProvider.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/provider/MySQLAuthProvider.java @@ -24,9 +24,10 @@ public final class MySQLAuthProvider extends AuthProvider { @Override public void init(LaunchServer srv) { super.init(srv); + if (mySQLHolder == null) throw new RuntimeException("[Verify][AuthProvider] mySQLHolder cannot be null"); if (query == null) throw new RuntimeException("[Verify][AuthProvider] query cannot be null"); if (message == null) throw new RuntimeException("[Verify][AuthProvider] message cannot be null"); - if (mySQLHolder == null) throw new RuntimeException("[Verify][AuthProvider] mySQLHolder cannot be null"); + if (queryParams == null) throw new RuntimeException("[Verify][AuthProvider] queryParams cannot be null"); } @Override From f279e97ea20903a969689dd567f3dc68b4eca397 Mon Sep 17 00:00:00 2001 From: microwin7 Date: Sat, 4 Sep 2021 08:57:35 +0300 Subject: [PATCH 3/5] [ANY] Update common modules and FileAuthSystem_module README.md --- LaunchServer/build.gradle | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index c77d4498..aa0b3a6b 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -85,15 +85,15 @@ pack project(':LauncherAPI') bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn'] bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn'] bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard'] - bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j'] + bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1' bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: rootProject['verLog4j'] bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-impl', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-gson', version: rootProject['verJwt'] testImplementation group: 'org.junit.jupiter', name: 'junit-jupiter', version: rootProject['verJunit'] - hikari 'io.micrometer:micrometer-core:1.5.10' - hikari('com.zaxxer:HikariCP:4.0.3') { + hikari 'io.micrometer:micrometer-core:1.7.2' + hikari('com.zaxxer:HikariCP:5.0.0') { exclude group: 'javassist' exclude group: 'io.micrometer' exclude group: 'org.slf4j' @@ -112,7 +112,7 @@ pack project(':LauncherAPI') compileOnlyA group: 'com.google.guava', name: 'guava', version: rootProject['verGuavaC'] // Do not update (laggy deps). compileOnlyA 'log4j:log4j:1.2.17' - compileOnlyA 'org.apache.logging.log4j:log4j-core:2.11.2' + compileOnlyA 'org.apache.logging.log4j:log4j-core:2.14.1' } task hikari(type: Copy) { From 6211744b836afa341628880e0b000ff894fd2578 Mon Sep 17 00:00:00 2001 From: microwin7 Date: Sat, 4 Sep 2021 09:02:58 +0300 Subject: [PATCH 4/5] [FIX] build.gradle --- LaunchServer/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index aa0b3a6b..53f2fbf3 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -85,7 +85,7 @@ pack project(':LauncherAPI') bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn'] bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn'] bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard'] - bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.14.1' + bundle group: 'org.apache.logging.log4j', name: 'log4j-core', rootProject['verLog4j'] bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: rootProject['verLog4j'] bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-impl', version: rootProject['verJwt'] From c44162dbbe18a29f246bb2fdffe72d96111fbf73 Mon Sep 17 00:00:00 2001 From: microwin7 Date: Sat, 4 Sep 2021 09:03:33 +0300 Subject: [PATCH 5/5] [FIX] build.gradle --- LaunchServer/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/LaunchServer/build.gradle b/LaunchServer/build.gradle index 53f2fbf3..32c525bb 100644 --- a/LaunchServer/build.gradle +++ b/LaunchServer/build.gradle @@ -85,7 +85,7 @@ pack project(':LauncherAPI') bundle group: 'mysql', name: 'mysql-connector-java', version: rootProject['verMySQLConn'] bundle group: 'org.postgresql', name: 'postgresql', version: rootProject['verPostgreSQLConn'] bundle group: 'com.guardsquare', name: 'proguard-base', version: rootProject['verProguard'] - bundle group: 'org.apache.logging.log4j', name: 'log4j-core', rootProject['verLog4j'] + bundle group: 'org.apache.logging.log4j', name: 'log4j-core', version: rootProject['verLog4j'] bundle group: 'org.apache.logging.log4j', name: 'log4j-slf4j-impl', version: rootProject['verLog4j'] bundle group: 'io.jsonwebtoken', name: 'jjwt-api', version: rootProject['verJwt'] bundle group: 'io.jsonwebtoken', name: 'jjwt-impl', version: rootProject['verJwt']