diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
index bfe5a9177b..b1c7c57bcb 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension.api/pom.xml
@@ -77,7 +77,18 @@
commons-httpclient
provided
-
+
+ org.wso2.carbon
+ org.wso2.carbon.base
+
+
+ com.googlecode.json-simple.wso2
+ json-simple
+
+
+ org.wso2.carbon
+ org.wso2.carbon.user.api
+
org.wso2.carbon
org.wso2.carbon.utils
diff --git a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
index e7eb8d6da9..986e173f32 100644
--- a/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
+++ b/components/apimgt-extensions/org.wso2.carbon.apimgt.application.extension/src/main/java/org/wso2/carbon/apimgt/application/extension/APIManagementProviderServiceImpl.java
@@ -286,14 +286,18 @@ public class APIManagementProviderServiceImpl implements APIManagementProviderSe
try {
APIConsumer consumer = APIManagerFactory.getInstance().getAPIConsumer(subscriberName);
if (consumer != null) {
- Subscriber subscriber = new Subscriber(subscriberName);
- subscriber.setSubscribedDate(new Date());
- subscriber.setEmail(subscriberEmail);
- subscriber.setTenantId(tenantId);
- consumer.addSubscriber(subscriber, groupId);
- if (log.isDebugEnabled()) {
- log.debug("Successfully created subscriber with name : " + subscriberName + " with groupID : " +
- groupId);
+ synchronized (consumer) {
+ if (consumer.getSubscriber(subscriberName) == null) {
+ Subscriber subscriber = new Subscriber(subscriberName);
+ subscriber.setSubscribedDate(new Date());
+ subscriber.setEmail(subscriberEmail);
+ subscriber.setTenantId(tenantId);
+ consumer.addSubscriber(subscriber, groupId);
+ if (log.isDebugEnabled()) {
+ log.debug("Successfully created subscriber with name : " + subscriberName +
+ " with groupID : " + groupId);
+ }
+ }
}
} else {
throw new APIManagerException("API provider configured for the given API configuration is null. " +