master #1

Merged
bedohswe merged 27 commits from pixtaded/crab:master into master 2025-02-11 18:05:01 +00:00
2 changed files with 9 additions and 3 deletions
Showing only changes of commit b914364c49 - Show all commits

View File

@ -60,9 +60,9 @@ public class CrabServer implements Crab {
}
}
public void stop() {
public synchronized void stop() {
isStopped = true;
try {
isStopped = true;
if (socket != null) socket.close();
if (serverSocket != null) serverSocket.close();
} catch (IOException e) {

View File

@ -6,7 +6,7 @@ import java.sql.*;
import java.util.Date;
import java.util.Locale;
public class Database {
public class Database implements AutoCloseable {
private Connection connection;
private String logs = "";
@ -68,4 +68,10 @@ public class Database {
else return logs.getBytes().length;
}
@Override
public void close() throws SQLException {
if (connection != null && !connection.isClosed()) {
connection.close();
}
}
}