[ 
https://issues.apache.org/jira/browse/AIRAVATA-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403201#comment-16403201
 ] 

ASF GitHub Bot commented on AIRAVATA-2607:
------------------------------------------

DImuthuUpe commented on a change in pull request #183: [AIRAVATA-2607]  Change 
all thrift clients to use ThriftClientPool
URL: https://github.com/apache/airavata/pull/183#discussion_r175244420
 
 

 ##########
 File path: 
airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/IamAdminServicesHandler.java
 ##########
 @@ -240,29 +264,23 @@ private PasswordCredential 
getSuperAdminPasswordCredential() {
 
     private PasswordCredential getTenantAdminPasswordCredential(String 
tenantId) throws TException, ApplicationSettingsException {
 
-        GatewayResourceProfile gwrp = 
getRegistryServiceClient().getGatewayResourceProfile(tenantId);
-
-        CredentialStoreService.Client csClient = 
getCredentialStoreServiceClient();
-        return 
csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), 
gwrp.getGatewayID());
-    }
-
-    private RegistryService.Client getRegistryServiceClient() throws 
TException, ApplicationSettingsException {
-        final int serverPort = 
Integer.parseInt(ServerSettings.getRegistryServerPort());
-        final String serverHost = ServerSettings.getRegistryServerHost();
+        RegistryService.Client regClient = registryClientPool.getResource();
+        GatewayResourceProfile gwrp = 
regClient.getGatewayResourceProfile(tenantId);
+        CredentialStoreService.Client csClient = csClientPool.getResource();
         try {
-            return 
RegistryServiceClientFactory.createRegistryClient(serverHost, serverPort);
-        } catch (RegistryServiceException e) {
-            throw new TException("Unable to create registry client...", e);
-        }
-    }
-
-    private CredentialStoreService.Client getCredentialStoreServiceClient() 
throws TException, ApplicationSettingsException {
-        final int serverPort = 
Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
-        final String serverHost = 
ServerSettings.getCredentialStoreServerHost();
-        try {
-            return 
CredentialStoreClientFactory.createAiravataCSClient(serverHost, serverPort);
-        } catch (CredentialStoreException e) {
-            throw new TException("Unable to create credential store 
client...", e);
+            PasswordCredential TenantAdminPassword = 
csClient.getPasswordCredential(gwrp.getIdentityServerPwdCredToken(), 
gwrp.getGatewayID());
+            csClientPool.returnResource(csClient);
+            registryClientPool.returnResource(regClient);
+            return TenantAdminPassword;
+        }catch (Exception e){
+            logger.error("Error while getting the tenant admin password", e);
 
 Review comment:
   Print the tenant id in the log. Otherwise we can not figure out to which 
tenant this error is belonged

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


> Change all thrift clients to use ThriftClientPool
> -------------------------------------------------
>
>                 Key: AIRAVATA-2607
>                 URL: https://issues.apache.org/jira/browse/AIRAVATA-2607
>             Project: Airavata
>          Issue Type: Improvement
>            Reporter: Suresh Marru
>            Assignee: Sachin Kariyattin
>            Priority: Major
>
> Currently, the API server uses ThriftClientPool but all other thrift servers 
> use a regular client. 
> We probably should move the current ThriftClientPool into the commons library 
> and have all thrift servers use this instead.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to