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

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_r175244487
 
 

 ##########
 File path: 
airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/TenantProfileServiceHandler.java
 ##########
 @@ -42,25 +37,39 @@
 import 
org.apache.airavata.service.profile.tenant.cpi.profile_tenant_cpiConstants;
 import org.apache.airavata.service.profile.utils.ProfileServiceUtils;
 import org.apache.airavata.service.security.interceptor.SecurityCheck;
+import org.apache.commons.pool.impl.GenericObjectPool;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-
 import java.util.List;
 import java.util.UUID;
 
 /**
  * Created by goshenoy on 3/6/17.
  */
 public class TenantProfileServiceHandler implements TenantProfileService.Iface 
{
-
     private final static Logger logger = 
LoggerFactory.getLogger(TenantProfileServiceHandler.class);
-
     private TenantProfileRepository tenantProfileRepository;
-
+    private ThriftClientPool<CredentialStoreService.Client> csClientPool;
     public TenantProfileServiceHandler() {
-        logger.debug("Initializing TenantProfileServiceHandler");
         this.tenantProfileRepository = new 
TenantProfileRepository(Gateway.class, GatewayEntity.class);
+        try {
+            logger.debug("Initializing TenantProfileServiceHandler");
+            GenericObjectPool.Config poolConfig = new 
GenericObjectPool.Config();
+            poolConfig.maxActive = 100;
+            poolConfig.minIdle = 5;
+            poolConfig.whenExhaustedAction = 
GenericObjectPool.WHEN_EXHAUSTED_BLOCK;
+            poolConfig.testOnBorrow = true;
+            poolConfig.testWhileIdle = true;
+            poolConfig.numTestsPerEvictionRun = 10;
+            poolConfig.maxWait = 3000;
+            csClientPool = new ThriftClientPool<>(
+                    tProtocol -> new CredentialStoreService.Client(tProtocol), 
poolConfig, ServerSettings.getCredentialStoreServerHost(),
+                    
Integer.parseInt(ServerSettings.getCredentialStoreServerPort()));
+
+        }catch (ApplicationSettingsException e) {
 
 Review comment:
   space after }

----------------------------------------------------------------
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