Skip to content

Commit

Permalink
closing the profile database when profile closes (#1057)
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkhi authored Jan 18, 2024
1 parent e52be44 commit 3c0ed56
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@
*
*/
public class SpringProfileInstanceFactory implements ProfileInstanceLocator {

/**
*
*/
Expand All @@ -63,7 +62,7 @@ public class SpringProfileInstanceFactory implements ProfileInstanceLocator {

private final Logger log = LoggerFactory.getLogger(getClass());

private Map<String, GenericApplicationContext> profileInstanceManagers =
private final Map<String, GenericApplicationContext> profileInstanceManagers =
new HashMap<String, GenericApplicationContext>();

/**
Expand Down Expand Up @@ -159,6 +158,10 @@ public Connection getConnection(String profileId) {
*/
@Override
public synchronized void closeProfileInstance(String location) {
ApplicationContext ac = profileInstanceManagers.get(location);
DerbyPooledDataSource dataSource = (DerbyPooledDataSource) ac
.getBean(DATA_SOURCE_BEAN_NAME);
dataSource.close();
GenericApplicationContext ctx = profileInstanceManagers
.remove(location);
if (ctx != null) {
Expand Down

0 comments on commit 3c0ed56

Please sign in to comment.