Don't isolate MariaDB driver, update DynamicProxy usage

This commit is contained in:
Vankka 2023-10-15 23:23:32 +03:00
parent affa127906
commit 28dbbb8466
No known key found for this signature in database
GPG Key ID: 6E50CB7A29B96AD0
4 changed files with 9 additions and 21 deletions

View File

@ -94,7 +94,7 @@ subprojects {
testRuntimeOnly(libs.jupiter.engine) testRuntimeOnly(libs.jupiter.engine)
// DynamicProxy // DynamicProxy
annotationProcessor(libs.dynamicproxy) annotationProcessor(libs.dynamicproxy.api)
} }
test { test {

View File

@ -71,10 +71,8 @@ dependencies {
runtimeDownloadApi(libs.caffeine) runtimeDownloadApi(libs.caffeine)
// DynamicProxy // DynamicProxy
runtimeDownloadApi(libs.dynamicproxy) { compileOnlyApi(libs.dynamicproxy.api)
// Not needed at runtime runtimeDownloadApi(libs.dynamicproxy.runtime)
exclude module: 'javaparser-symbol-solver-core'
}
// Jackson (transitive in :api) // Jackson (transitive in :api)
compileOnlyApi(libs.jackson.databind) compileOnlyApi(libs.jackson.databind)
@ -96,10 +94,7 @@ dependencies {
runtimeDownloadApi(libs.enhancedlegacytext) runtimeDownloadApi(libs.enhancedlegacytext)
// Database // Database
hikariOnly(libs.hikaricp) { hikariOnly(libs.hikaricp)
// Already provided
exclude group: 'org.slf4j'
}
h2DriverOnly(libs.h2) h2DriverOnly(libs.h2)
mysqlDriverOnly(libs.mysql) mysqlDriverOnly(libs.mysql)
mariadbDriverOnly(libs.mariadb) mariadbDriverOnly(libs.mariadb)

View File

@ -4,7 +4,6 @@ import com.discordsrv.common.DiscordSRV;
import com.discordsrv.common.config.connection.StorageConfig; import com.discordsrv.common.config.connection.StorageConfig;
import com.discordsrv.common.exception.StorageException; import com.discordsrv.common.exception.StorageException;
import com.zaxxer.hikari.HikariConfig; import com.zaxxer.hikari.HikariConfig;
import dev.vankka.dependencydownload.classloader.IsolatedClassLoader;
import java.io.IOException; import java.io.IOException;
import java.sql.Connection; import java.sql.Connection;
@ -12,8 +11,6 @@ import java.sql.SQLException;
public class MariaDBStorage extends HikariStorage { public class MariaDBStorage extends HikariStorage {
private IsolatedClassLoader classLoader;
public MariaDBStorage(DiscordSRV discordSRV) { public MariaDBStorage(DiscordSRV discordSRV) {
super(discordSRV); super(discordSRV);
} }
@ -21,19 +18,13 @@ public class MariaDBStorage extends HikariStorage {
@Override @Override
public void close() { public void close() {
super.close(); super.close();
if (classLoader != null) {
try {
classLoader.close();
} catch (IOException e) {
discordSRV.logger().error("Failed to close isolated classloader", e);
}
}
} }
@Override @Override
public void initialize() { public void initialize() {
try { try {
initializeWithContext(classLoader = discordSRV.dependencyManager().mariadb().loadIntoIsolated()); discordSRV.dependencyManager().mariadb().download().join();
super.initialize();
} catch (IOException e) { } catch (IOException e) {
throw new StorageException(e); throw new StorageException(e);
} }

View File

@ -72,7 +72,9 @@ dependencyResolutionManagement {
} }
// DynamicProxy // DynamicProxy
library('dynamicproxy', 'dev.vankka', 'dynamicproxy').version('1.0.0') version('dynamicproxy', '1.0.1-SNAPSHOT')
library('dynamicproxy-api', 'dev.vankka', 'dynamicproxy').versionRef('dynamicproxy')
library('dynamicproxy-runtime', 'dev.vankka', 'dynamicproxy-runtime').versionRef('dynamicproxy')
// Jackson // Jackson
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.14.2') library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.14.2')