CMDAPIRework #25

Zusammengeführt
YoyoNow hat 10 Commits von CMDAPIRework nach master 2023-01-15 20:13:39 +01:00 zusammengeführt
3 geänderte Dateien mit 22 neuen und 17 gelöschten Zeilen
Nur Änderungen aus Commit eaeb810062 werden angezeigt - Alle Commits anzeigen

0
build.gradle Normale Datei → Ausführbare Datei
Datei anzeigen

Datei anzeigen

@ -157,32 +157,36 @@ public class Statement implements AutoCloseable {
private <T> T withConnection(SQLRunnable<T> runnable, Object... objects) {
Connection connection = aquireConnection();
T result;
try {
try {
return tryWithConnection(connection, runnable, objects);
} finally {
if(connectionInvalid(connection)) {
closeConnection(connection);
} else {
synchronized (connections) {
connections.push(connection);
connections.notify();
}
}
}
} catch (SQLException e) {
result = tryWithConnection(connection, runnable, objects);
} catch (Throwable e) {
if(connectionInvalid(connection)) {
closeConnection(connection);
return withConnection(runnable, objects);
} else {
synchronized (connections) {
connections.push(connection);
connections.notify();
}
throw new SecurityException("Failing sql statement", e);
}
}
synchronized (connections) {
connections.push(connection);
connections.notify();
}
return result;
}
private boolean connectionInvalid(Connection connection) {
try {
return connection.isClosed();
return connection.isClosed() || !connection.isValid(1);
} catch (SQLException e) {
logger.log(Level.INFO, "Could not check SQL connection status", e); // No database logging possible at this state
return true;

Datei anzeigen

@ -1,5 +1,6 @@
build:
setup:
- "ln -s /home/gitea/lib"
- "cp ~/gradle.properties ."
- "chmod u+x build.gradle"
build:
- "./gradlew buildProject"
- "./gradlew --stop"