mirror of
https://github.com/plan-player-analytics/Plan.git
synced 2025-01-06 16:37:58 +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 net.playeranalytics.plugin.server.PluginLogger;
|
||||||
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
import org.apache.commons.lang3.concurrent.BasicThreadFactory;
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.sql.Connection;
|
import java.sql.Connection;
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
@ -230,6 +229,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
*/
|
*/
|
||||||
private void setupDatabase() {
|
private void setupDatabase() {
|
||||||
executeTransaction(new CreateTablesTransaction());
|
executeTransaction(new CreateTablesTransaction());
|
||||||
|
logger.info("Database: Making sure schema is up to date..");
|
||||||
for (Patch patch : patches()) {
|
for (Patch patch : patches()) {
|
||||||
executeTransaction(patch);
|
executeTransaction(patch);
|
||||||
}
|
}
|
||||||
@ -240,6 +240,7 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
registerIndexCreationTask();
|
registerIndexCreationTask();
|
||||||
|
logger.info("Database: Ready for operation.");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void registerIndexCreationTask() {
|
private void registerIndexCreationTask() {
|
||||||
@ -279,14 +280,17 @@ public abstract class SQLDB extends AbstractDatabase {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void unloadDriverClassloader() {
|
private void unloadDriverClassloader() {
|
||||||
try {
|
// Unloading class loader causes issues when reloading.
|
||||||
if (driverClassLoader instanceof IsolatedClassLoader) {
|
// It is better to leak this memory than crash the plugin on reload.
|
||||||
((IsolatedClassLoader) driverClassLoader).close();
|
|
||||||
}
|
// try {
|
||||||
|
// if (driverClassLoader instanceof IsolatedClassLoader) {
|
||||||
|
// ((IsolatedClassLoader) driverClassLoader).close();
|
||||||
|
// }
|
||||||
driverClassLoader = null;
|
driverClassLoader = null;
|
||||||
} catch (IOException e) {
|
// } catch (IOException e) {
|
||||||
errorLogger.error(e, ErrorContext.builder().build());
|
// errorLogger.error(e, ErrorContext.builder().build());
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public abstract Connection getConnection() throws SQLException;
|
public abstract Connection getConnection() throws SQLException;
|
||||||
|
Loading…
Reference in New Issue
Block a user