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() {
try {
isStopped = true; isStopped = true;
try {
if (socket != null) socket.close(); if (socket != null) socket.close();
if (serverSocket != null) serverSocket.close(); if (serverSocket != null) serverSocket.close();
} catch (IOException e) { } catch (IOException e) {

View File

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