micro refactor

This commit is contained in:
mykola2312 2024-04-19 09:04:56 +03:00
parent 68909c3102
commit cc2e24afbd
2 changed files with 3 additions and 1 deletions

View file

@ -12,7 +12,6 @@ import org.jooq.Record;
import org.jooq.impl.*;
import java.io.IOException;
import java.sql.Connection;
public class Main {
private static final Logger logger = Logger.getLogger(Main.class);

View file

@ -53,6 +53,7 @@ public class DBPool implements ConnectionProvider {
@Override
public @Nullable Connection acquire() throws DataAccessException {
logger.debug("acquire");
DBConnection conn;
try {
conn = connections
@ -87,6 +88,8 @@ public class DBPool implements ConnectionProvider {
if (connections.size() > POOL_LOW_CAP) {
connections.remove(db);
}
logger.debug(String.format("release %s", db.toString()));
} catch (NoSuchElementException e) {
throw new DataAccessException("connection is not present in pool");
}