From bfc635d4c36ef878aa27346f3d61859d46e7f939 Mon Sep 17 00:00:00 2001 From: isharamadhawa Date: Thu, 13 Jun 2019 16:03:50 +0530 Subject: [PATCH] [INTGW-606] - closed the DB connection properly to get rid of the pool exhaustion. --- .../hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java index 37586d144..f12f340f5 100644 --- a/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java +++ b/components/workflow-extensions/src/main/java/com/wso2telco/hub/workflow/extensions/impl/WorkflowAPIConsumerImpl.java @@ -33,7 +33,7 @@ public class WorkflowAPIConsumerImpl implements WorkflowAPIConsumer { @Override public int getAPIID(APIIdentifier apiId) throws APIManagementException { int id = -1; - Connection connection; + Connection connection = null; try { connection = APIMgtDBUtil.getConnection(); @@ -43,6 +43,8 @@ public int getAPIID(APIIdentifier apiId) throws APIManagementException { handleException("Failed to retrieve api id. ", e); } catch (APIManagementException e) { handleException("Error occured in retrieving api id. ", e); + } finally { + APIMgtDBUtil.closeAllConnections(null, connection, null); } return id; }