Refine exception messages in AssetLoadingHooks and RolesHooks for clarity during hook registration and transaction handling.
This commit is contained in:
1 parent
e61026a3d4
commit
9178d36168
2 files changed
+6
-6
No files matched your search
+2
-2
@@ -44,7 +44,7 @@ public final class AssetLoadingHooks
|
|||||||
executor = MethodHandles.privateLookupIn(FileSystemImpl.class, MethodHandles.lookup())
|
executor = MethodHandles.privateLookupIn(FileSystemImpl.class, MethodHandles.lookup())
|
||||||
.findVarHandle(FileSystemImpl.class, "executor", ExecutorService.class);
|
.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;
|
EXECUTOR = executor;
|
||||||
}
|
}
|
||||||
@@ -79,7 +79,7 @@ public final class AssetLoadingHooks
|
|||||||
// A fixed pool: maximum first, the core size may not exceed it.
|
// A fixed pool: maximum first, the core size may not exceed it.
|
||||||
if (executor instanceof ThreadPoolExecutor pool && pool.getMaximumPoolSize() < threads)
|
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.setMaximumPoolSize(threads);
|
||||||
pool.setCorePoolSize(threads);
|
pool.setCorePoolSize(threads);
|
||||||
}
|
}
|
||||||
|
|||||||
+4
-4
@@ -33,7 +33,7 @@ public final class RolesHooks
|
|||||||
connection = MethodHandles.privateLookupIn(ServerWorldDatabase.class, MethodHandles.lookup())
|
connection = MethodHandles.privateLookupIn(ServerWorldDatabase.class, MethodHandles.lookup())
|
||||||
.findVarHandle(ServerWorldDatabase.class, "conn", Connection.class);
|
.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;
|
CONNECTION = connection;
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ public final class RolesHooks
|
|||||||
connection.setAutoCommit(false);
|
connection.setAutoCommit(false);
|
||||||
RolesHooks.transaction = connection;
|
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;
|
if (connection == null) return;
|
||||||
|
|
||||||
try { connection.commit(); }
|
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
|
finally
|
||||||
{
|
{
|
||||||
try { connection.setAutoCommit(true); }
|
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); }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user