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)
// DynamicProxy
annotationProcessor(libs.dynamicproxy)
annotationProcessor(libs.dynamicproxy.api)
}
test {

View File

@ -71,10 +71,8 @@ dependencies {
runtimeDownloadApi(libs.caffeine)
// DynamicProxy
runtimeDownloadApi(libs.dynamicproxy) {
// Not needed at runtime
exclude module: 'javaparser-symbol-solver-core'
}
compileOnlyApi(libs.dynamicproxy.api)
runtimeDownloadApi(libs.dynamicproxy.runtime)
// Jackson (transitive in :api)
compileOnlyApi(libs.jackson.databind)
@ -96,10 +94,7 @@ dependencies {
runtimeDownloadApi(libs.enhancedlegacytext)
// Database
hikariOnly(libs.hikaricp) {
// Already provided
exclude group: 'org.slf4j'
}
hikariOnly(libs.hikaricp)
h2DriverOnly(libs.h2)
mysqlDriverOnly(libs.mysql)
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.exception.StorageException;
import com.zaxxer.hikari.HikariConfig;
import dev.vankka.dependencydownload.classloader.IsolatedClassLoader;
import java.io.IOException;
import java.sql.Connection;
@ -12,8 +11,6 @@ import java.sql.SQLException;
public class MariaDBStorage extends HikariStorage {
private IsolatedClassLoader classLoader;
public MariaDBStorage(DiscordSRV discordSRV) {
super(discordSRV);
}
@ -21,19 +18,13 @@ public class MariaDBStorage extends HikariStorage {
@Override
public void close() {
super.close();
if (classLoader != null) {
try {
classLoader.close();
} catch (IOException e) {
discordSRV.logger().error("Failed to close isolated classloader", e);
}
}
}
@Override
public void initialize() {
try {
initializeWithContext(classLoader = discordSRV.dependencyManager().mariadb().loadIntoIsolated());
discordSRV.dependencyManager().mariadb().download().join();
super.initialize();
} catch (IOException e) {
throw new StorageException(e);
}

View File

@ -72,7 +72,9 @@ dependencyResolutionManagement {
}
// 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
library('jackson-databind', 'com.fasterxml.jackson.core', 'jackson-databind').version('2.14.2')