Fix compat with older hikari versions (#600)

This commit is contained in:
Luck 2017-12-11 19:26:17 +00:00
parent 0bec93ab1c
commit a765be0a6f
No known key found for this signature in database
GPG Key ID: EFA9B3EC5FD90F8B

View File

@ -91,9 +91,15 @@ public abstract class HikariConnectionFactory extends AbstractConnectionFactory
// The drivers are really old in some of the older Spigot binaries, so Connection#isValid doesn't work. // The drivers are really old in some of the older Spigot binaries, so Connection#isValid doesn't work.
config.setConnectionTestQuery("/* LuckPerms ping */ SELECT 1"); config.setConnectionTestQuery("/* LuckPerms ping */ SELECT 1");
try {
// don't perform any initial connection validation - we subsequently call #getConnection // don't perform any initial connection validation - we subsequently call #getConnection
// to setup the schema anyways // to setup the schema anyways
config.setInitializationFailTimeout(-1); config.setInitializationFailTimeout(-1);
} catch (NoSuchMethodError e) {
//noinspection deprecation
config.setInitializationFailFast(false);
}
hikari = new HikariDataSource(config); hikari = new HikariDataSource(config);
} }