mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-12-01 17:36:46 +01:00
connectionString doesn't need to be its own variable anymore
This commit is contained in:
parent
77546e53f4
commit
e9dd0713d6
@ -31,7 +31,6 @@ import snaq.db.ConnectionPool;
|
|||||||
|
|
||||||
public final class SQLDatabaseManager implements DatabaseManager {
|
public final class SQLDatabaseManager implements DatabaseManager {
|
||||||
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
private static final String ALL_QUERY_VERSION = "taming+mining+woodcutting+repair+unarmed+herbalism+excavation+archery+swords+axes+acrobatics+fishing+alchemy";
|
||||||
private String connectionString;
|
|
||||||
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
private String tablePrefix = Config.getInstance().getMySQLTablePrefix();
|
||||||
|
|
||||||
private final int POOL_FETCH_TIMEOUT = 0; // How long a method will wait for a connection. Since none are on main thread, we can safely say wait for as long as you like.
|
private final int POOL_FETCH_TIMEOUT = 0; // How long a method will wait for a connection. Since none are on main thread, we can safely say wait for as long as you like.
|
||||||
@ -42,8 +41,6 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
private ConnectionPool connectionPool;
|
private ConnectionPool connectionPool;
|
||||||
|
|
||||||
protected SQLDatabaseManager() {
|
protected SQLDatabaseManager() {
|
||||||
connectionString = "jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName();
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Force driver to load if not yet loaded
|
// Force driver to load if not yet loaded
|
||||||
Class.forName("com.mysql.jdbc.Driver");
|
Class.forName("com.mysql.jdbc.Driver");
|
||||||
@ -56,7 +53,7 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
Config.getInstance().getMySQLMaxPoolSize() /*max pool size */,
|
Config.getInstance().getMySQLMaxPoolSize() /*max pool size */,
|
||||||
Config.getInstance().getMySQLMaxConnections() /*max num connections*/,
|
Config.getInstance().getMySQLMaxConnections() /*max num connections*/,
|
||||||
0 /* idle timeout of connections */,
|
0 /* idle timeout of connections */,
|
||||||
connectionString,
|
"jdbc:mysql://" + Config.getInstance().getMySQLServerName() + ":" + Config.getInstance().getMySQLServerPort() + "/" + Config.getInstance().getMySQLDatabaseName(),
|
||||||
connectionProperties);
|
connectionProperties);
|
||||||
connectionPool.init(); // Init first connection
|
connectionPool.init(); // Init first connection
|
||||||
connectionPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
connectionPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
||||||
|
Loading…
Reference in New Issue
Block a user