Make connection pool init timeout configurable
This commit is contained in:
@@ -165,6 +165,7 @@ server:
|
||||
DB_URL: "jdbc:mysql://localhost:3306/cosmic"
|
||||
DB_USER: "cosmic_server"
|
||||
DB_PASS: "snailshell"
|
||||
INIT_CONNECTION_POOL_TIMEOUT: 60 # Seconds
|
||||
|
||||
#Login Configuration
|
||||
WORLDS: 1 #Initial number of worlds on the server.
|
||||
|
||||
@@ -8,6 +8,7 @@ public class ServerConfig {
|
||||
public String DB_URL;
|
||||
public String DB_USER;
|
||||
public String DB_PASS;
|
||||
public int INIT_CONNECTION_POOL_TIMEOUT;
|
||||
|
||||
//Login Configuration
|
||||
public int WORLDS;
|
||||
|
||||
@@ -49,7 +49,7 @@ public class DatabaseConnection {
|
||||
* @return true if connection to the database initiated successfully, false if not successful
|
||||
*/
|
||||
public static boolean initializeConnectionPool() {
|
||||
final int timeoutSeconds = 60;
|
||||
final int timeoutSeconds = YamlConfig.config.server.INIT_CONNECTION_POOL_TIMEOUT;
|
||||
final Instant timeout = Instant.now().plusSeconds(timeoutSeconds);
|
||||
|
||||
System.out.println("Initializing connection pool...");
|
||||
|
||||
Reference in New Issue
Block a user