mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-04 23:48:42 +01:00
Don't close driver class loader during disable
Affects issues: - Fixed #2274
This commit is contained in:
parent
362d1d4e0b
commit
856d5f57e7
@ -46,7 +46,6 @@ import net.playeranalytics.plugin.scheduling.TimeAmount;
|
||||
import net.playeranalytics.plugin.server.PluginLogger;
|
||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.sql.Connection;
|
||||
import java.sql.SQLException;
|
||||
import java.util.*;
|
||||
@ -230,6 +229,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
*/
|
||||
private void setupDatabase() {
|
||||
executeTransaction(new CreateTablesTransaction());
|
||||
logger.info("Database: Making sure schema is up to date..");
|
||||
for (Patch patch : patches()) {
|
||||
executeTransaction(patch);
|
||||
}
|
||||
@ -240,6 +240,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
}
|
||||
});
|
||||
registerIndexCreationTask();
|
||||
logger.info("Database: Ready for operation.");
|
||||
}
|
||||
|
||||
private void registerIndexCreationTask() {
|
||||
@ -279,14 +280,17 @@ public abstract class SQLDB extends AbstractDatabase {
|
||||
}
|
||||
|
||||
private void unloadDriverClassloader() {
|
||||
try {
|
||||
if (driverClassLoader instanceof IsolatedClassLoader) {
|
||||
((IsolatedClassLoader) driverClassLoader).close();
|
||||
}
|
||||
// Unloading class loader causes issues when reloading.
|
||||
// It is better to leak this memory than crash the plugin on reload.
|
||||
|
||||
// try {
|
||||
// if (driverClassLoader instanceof IsolatedClassLoader) {
|
||||
// ((IsolatedClassLoader) driverClassLoader).close();
|
||||
// }
|
||||
driverClassLoader = null;
|
||||
} catch (IOException e) {
|
||||
errorLogger.error(e, ErrorContext.builder().build());
|
||||
}
|
||||
// } catch (IOException e) {
|
||||
// errorLogger.error(e, ErrorContext.builder().build());
|
||||
// }
|
||||
}
|
||||
|
||||
public abstract Connection getConnection() throws SQLException;
|
||||
|
Loading…
Reference in New Issue
Block a user