You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ma...@apache.org on 2020/08/31 20:52:19 UTC

[airavata] branch develop updated: AIRAVATA-3358 Synchronize creating gateway groups to prevent multiple request threads from creating duplicates

This is an automated email from the ASF dual-hosted git repository.

machristie pushed a commit to branch develop
in repository https://gitbox.apache.org/repos/asf/airavata.git


The following commit(s) were added to refs/heads/develop by this push:
     new 06aa064  AIRAVATA-3358 Synchronize creating gateway groups to prevent multiple request threads from creating duplicates
06aa064 is described below

commit 06aa0641f1f86a39e7224e84766f9374482e7c8c
Author: Marcus Christie <ma...@apache.org>
AuthorDate: Mon Aug 31 16:51:34 2020 -0400

    AIRAVATA-3358 Synchronize creating gateway groups to prevent multiple request threads from creating duplicates
---
 .../airavata/service/security/GatewayGroupsInitializer.java      | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java b/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
index fcc1ae5..5d0afc3 100644
--- a/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
+++ b/airavata-services/services-security/src/main/java/org/apache/airavata/service/security/GatewayGroupsInitializer.java
@@ -47,7 +47,7 @@ public class GatewayGroupsInitializer {
 
     private final static Logger logger = LoggerFactory.getLogger(KeyCloakSecurityManager.class);
 
-    public static GatewayGroups initializeGatewayGroups(String gatewayId) {
+    public static synchronized GatewayGroups initializeGatewayGroups(String gatewayId) {
 
         SharingRegistryService.Client sharingRegistryClient = createSharingRegistryClient();
         RegistryService.Client registryClient = createRegistryClient();
@@ -110,7 +110,12 @@ public class GatewayGroupsInitializer {
                 "Group of admin users with read-only access.");
         gatewayGroups.setReadOnlyAdminsGroupId(readOnlyAdminsGroup.getGroupId());
 
-        registryClient.createGatewayGroups(gatewayGroups);
+        try {
+            registryClient.createGatewayGroups(gatewayGroups);
+        } catch (TException e) {
+            logger.error("Gateway groups created in Sharing Catalog failed to save GatewayGroups entity in Registry", e);
+            throw e;
+        }
 
         return gatewayGroups;
     }