From 15bfff3eb0274e07a91a683f74eadadafc1cec08 Mon Sep 17 00:00:00 2001 From: Bojan Momcilov Date: Fri, 17 Sep 2021 11:28:14 +0200 Subject: [PATCH] Close session factories on DB.invalidateSessionFactories() Signed-off-by: Bojan Momcilov --- modules/dbsupport/src/main/java/org/jpos/ee/DB.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java index 64c5b8c563..88c12e5ad9 100644 --- a/modules/dbsupport/src/main/java/org/jpos/ee/DB.java +++ b/modules/dbsupport/src/main/java/org/jpos/ee/DB.java @@ -170,6 +170,11 @@ public Dialect getDialect() { } public static synchronized void invalidateSessionFactories() { + for (SessionFactory sf : sessionFactories.values()) { + try { + sf.close(); + } catch (Exception ignored) {} + } sessionFactories.clear(); }