Merge remote-tracking branch 'origin/CMDAPIRework' into CMDAPIRework
Dieser Commit ist enthalten in:
Commit
9cc6004271
0
build.gradle
Normale Datei → Ausführbare Datei
0
build.gradle
Normale Datei → Ausführbare Datei
@ -157,32 +157,36 @@ public class Statement implements AutoCloseable {
|
|||||||
|
|
||||||
private <T> T withConnection(SQLRunnable<T> runnable, Object... objects) {
|
private <T> T withConnection(SQLRunnable<T> runnable, Object... objects) {
|
||||||
Connection connection = aquireConnection();
|
Connection connection = aquireConnection();
|
||||||
|
T result;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
try {
|
result = tryWithConnection(connection, runnable, objects);
|
||||||
return tryWithConnection(connection, runnable, objects);
|
} catch (Throwable e) {
|
||||||
} finally {
|
|
||||||
if(connectionInvalid(connection)) {
|
|
||||||
closeConnection(connection);
|
|
||||||
} else {
|
|
||||||
synchronized (connections) {
|
|
||||||
connections.push(connection);
|
|
||||||
connections.notify();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (SQLException e) {
|
|
||||||
if(connectionInvalid(connection)) {
|
if(connectionInvalid(connection)) {
|
||||||
|
closeConnection(connection);
|
||||||
|
|
||||||
return withConnection(runnable, objects);
|
return withConnection(runnable, objects);
|
||||||
} else {
|
} else {
|
||||||
|
synchronized (connections) {
|
||||||
|
connections.push(connection);
|
||||||
|
connections.notify();
|
||||||
|
}
|
||||||
|
|
||||||
throw new SecurityException("Failing sql statement", e);
|
throw new SecurityException("Failing sql statement", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
synchronized (connections) {
|
||||||
|
connections.push(connection);
|
||||||
|
connections.notify();
|
||||||
|
}
|
||||||
|
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean connectionInvalid(Connection connection) {
|
private boolean connectionInvalid(Connection connection) {
|
||||||
try {
|
try {
|
||||||
return connection.isClosed();
|
return connection.isClosed() || !connection.isValid(1);
|
||||||
} catch (SQLException e) {
|
} catch (SQLException e) {
|
||||||
logger.log(Level.INFO, "Could not check SQL connection status", e); // No database logging possible at this state
|
logger.log(Level.INFO, "Could not check SQL connection status", e); // No database logging possible at this state
|
||||||
return true;
|
return true;
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
build:
|
setup:
|
||||||
- "ln -s /home/gitea/lib"
|
- "ln -s /home/gitea/lib"
|
||||||
- "cp ~/gradle.properties ."
|
|
||||||
- "chmod u+x build.gradle"
|
build:
|
||||||
- "./gradlew buildProject"
|
- "./gradlew buildProject"
|
||||||
|
- "./gradlew --stop"
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren