mirror of
https://github.com/mcMMO-Dev/mcMMO.git
synced 2024-11-26 07:06:45 +01:00
This seems easier.
This commit is contained in:
parent
4304970059
commit
2147417322
@ -29,9 +29,7 @@ import com.gmail.nossr50.datatypes.skills.SkillType;
|
|||||||
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
import com.gmail.nossr50.runnables.database.UUIDUpdateAsyncTask;
|
||||||
import com.gmail.nossr50.util.Misc;
|
import com.gmail.nossr50.util.Misc;
|
||||||
|
|
||||||
import snaq.db.CacheConnection;
|
|
||||||
import snaq.db.ConnectionPool;
|
import snaq.db.ConnectionPool;
|
||||||
import snaq.db.ConnectionValidator;
|
|
||||||
|
|
||||||
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";
|
||||||
@ -72,26 +70,23 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
0 /*No Minimum really needed*/,
|
0 /*No Minimum really needed*/,
|
||||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC) /*max pool size */,
|
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.MISC) /*max pool size */,
|
||||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC) /*max num connections*/,
|
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.MISC) /*max num connections*/,
|
||||||
0 /* idle timeout of connections */,
|
400 /* idle timeout of connections */,
|
||||||
connectionString,
|
connectionString,
|
||||||
connectionProperties);
|
connectionProperties);
|
||||||
miscPool.setValidator(new mcMMOValidator());
|
|
||||||
loadPool = new ConnectionPool("mcMMO-Load-Pool",
|
loadPool = new ConnectionPool("mcMMO-Load-Pool",
|
||||||
1 /*Minimum of one*/,
|
1 /*Minimum of one*/,
|
||||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD) /*max pool size */,
|
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.LOAD) /*max pool size */,
|
||||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD) /*max num connections*/,
|
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.LOAD) /*max num connections*/,
|
||||||
0 /* idle timeout of connections */,
|
400 /* idle timeout of connections */,
|
||||||
connectionString,
|
connectionString,
|
||||||
connectionProperties);
|
connectionProperties);
|
||||||
loadPool.setValidator(new mcMMOValidator());
|
|
||||||
savePool = new ConnectionPool("mcMMO-Save-Pool",
|
savePool = new ConnectionPool("mcMMO-Save-Pool",
|
||||||
1 /*Minimum of one*/,
|
1 /*Minimum of one*/,
|
||||||
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE) /*max pool size */,
|
Config.getInstance().getMySQLMaxPoolSize(PoolIdentifier.SAVE) /*max pool size */,
|
||||||
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE) /*max num connections*/,
|
Config.getInstance().getMySQLMaxConnections(PoolIdentifier.SAVE) /*max num connections*/,
|
||||||
0 /* idle timeout of connections */,
|
400 /* idle timeout of connections */,
|
||||||
connectionString,
|
connectionString,
|
||||||
connectionProperties);
|
connectionProperties);
|
||||||
savePool.setValidator(new mcMMOValidator());
|
|
||||||
miscPool.init(); // Init first connection
|
miscPool.init(); // Init first connection
|
||||||
miscPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
miscPool.registerShutdownHook(); // Auto release on jvm exit just in case
|
||||||
loadPool.init();
|
loadPool.init();
|
||||||
@ -1609,12 +1604,4 @@ public final class SQLDatabaseManager implements DatabaseManager {
|
|||||||
LOAD,
|
LOAD,
|
||||||
SAVE;
|
SAVE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class mcMMOValidator implements ConnectionValidator {
|
|
||||||
@Override
|
|
||||||
public boolean isValid(Connection connection) throws SQLException {
|
|
||||||
return connection instanceof CacheConnection && connection.isValid(0);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user