Skip to content

Commit

Permalink
closing the profile database when profile closes
Browse files Browse the repository at this point in the history
  • Loading branch information
sparkhi committed Jan 17, 2024
1 parent 0937308 commit 29986c4
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 29986c4

Please sign in to comment.