From cc2bce4300e2c2bac2781406bb271cf11ef188af Mon Sep 17 00:00:00 2001 From: Gravita <12893402+gravit0@users.noreply.github.com> Date: Sat, 28 Sep 2024 02:29:19 +0700 Subject: [PATCH] [FIX] initializeAtStart thread safety --- .../pro/gravit/launchserver/auth/HikariSQLSourceConfig.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/HikariSQLSourceConfig.java b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/HikariSQLSourceConfig.java index 54e2f69f..ba4924dc 100644 --- a/LaunchServer/src/main/java/pro/gravit/launchserver/auth/HikariSQLSourceConfig.java +++ b/LaunchServer/src/main/java/pro/gravit/launchserver/auth/HikariSQLSourceConfig.java @@ -19,15 +19,15 @@ public class HikariSQLSourceConfig implements SQLSourceConfig { private boolean initializeAtStart; public void init() { - if (dataSource != null) { - return; - } if(initializeAtStart) { initializeConnection(); } } private void initializeConnection() { + if (dataSource != null) { + return; + } HikariConfig config = new HikariConfig(); consumeIfNotNull(config::setDataSourceClassName, dsClass); consumeIfNotNull(config::setDataSourceProperties, dsProps);