Refine exception messages in AssetLoadingHooks and RolesHooks for clarity during hook registration and transaction handling.

This commit is contained in:
Overlord committed 2026-10-05 19:46:18 +02:00
1 parent e61026a3d4
commit 9178d36168
2 files changed
+6 -6

No files matched your search

@@ -44,7 +44,7 @@ public final class AssetLoadingHooks
executor = MethodHandles.privateLookupIn(FileSystemImpl.class, MethodHandles.lookup())
.findVarHandle(FileSystemImpl.class, "executor", ExecutorService.class);
}
catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Asset loading keeps its loader threads: 'FileSystemImpl.executor' not found: " + e); }
catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Unable to register hook 'AssetLoadingHooks.updateAsyncTransactions': 'FileSystemImpl.executor' not found: " + e); }
EXECUTOR = executor;
}
@@ -79,7 +79,7 @@ public final class AssetLoadingHooks
// A fixed pool: maximum first, the core size may not exceed it.
if (executor instanceof ThreadPoolExecutor pool && pool.getMaximumPoolSize() < threads)
{
System.out.println("[ZomboidForge] Asset loading: " + threads + " loader threads instead of " + pool.getMaximumPoolSize() + ".");
System.out.println("[ZomboidForge] Loader threads: " + pool.getMaximumPoolSize() + " -> " + threads + ".");
pool.setMaximumPoolSize(threads);
pool.setCorePoolSize(threads);
}
@@ -33,7 +33,7 @@ public final class RolesHooks
connection = MethodHandles.privateLookupIn(ServerWorldDatabase.class, MethodHandles.lookup())
.findVarHandle(ServerWorldDatabase.class, "conn", Connection.class);
}
catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Roles are saved without a transaction: 'ServerWorldDatabase.conn' not found: " + e); }
catch (ReflectiveOperationException e) { System.out.println("[ZomboidForge] Unable to register hook 'RolesHooks.beginSave': 'ServerWorldDatabase.conn' not found: " + e); }
CONNECTION = connection;
}
@@ -58,7 +58,7 @@ public final class RolesHooks
connection.setAutoCommit(false);
RolesHooks.transaction = connection;
}
catch (SQLException e) { System.out.println("[ZomboidForge] Roles are saved without a transaction: " + e); }
catch (SQLException e) { System.out.println("[ZomboidForge] Unable to begin the roles transaction: " + e); }
}
/**
@@ -72,11 +72,11 @@ public final class RolesHooks
if (connection == null) return;
try { connection.commit(); }
catch (SQLException e) { System.out.println("[ZomboidForge] Committing the saved roles failed: " + e); }
catch (SQLException e) { System.out.println("[ZomboidForge] Unable to commit the roles transaction: " + e); }
finally
{
try { connection.setAutoCommit(true); }
catch (SQLException e) { System.out.println("[ZomboidForge] Switching the database back to autocommit failed: " + e); }
catch (SQLException e) { System.out.println("[ZomboidForge] Unable to restore autocommit: " + e); }
}
}
}