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

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_r175244441
 
 

 ##########
 File path: 
airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/UserProfileServiceHandler.java
 ##########
 @@ -24,36 +24,47 @@
 import org.apache.airavata.common.utils.DBEventManagerConstants;
 import org.apache.airavata.common.utils.DBEventService;
 import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.common.utils.ThriftClientPool;
 import org.apache.airavata.model.dbevent.CrudType;
 import org.apache.airavata.model.dbevent.EntityType;
 import org.apache.airavata.model.error.AuthorizationException;
 import org.apache.airavata.model.security.AuthzToken;
-import org.apache.airavata.model.user.CustomDashboard;
 import org.apache.airavata.model.user.UserProfile;
-import org.apache.airavata.service.profile.client.ProfileServiceClientFactory;
 import 
org.apache.airavata.service.profile.commons.user.entities.UserProfileEntity;
 import 
org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
-import 
org.apache.airavata.service.profile.iam.admin.services.cpi.exception.IamAdminServicesException;
 import 
org.apache.airavata.service.profile.user.core.repositories.UserProfileRepository;
 import org.apache.airavata.service.profile.user.cpi.UserProfileService;
 import 
org.apache.airavata.service.profile.user.cpi.exception.UserProfileServiceException;
 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;
 
 public class UserProfileServiceHandler implements UserProfileService.Iface {
-
     private final static Logger logger = 
LoggerFactory.getLogger(UserProfileServiceHandler.class);
-
+    private ThriftClientPool<IamAdminServices.Client> iasClientPool;
     private UserProfileRepository userProfileRepository;
-
     public UserProfileServiceHandler() {
-
         userProfileRepository = new UserProfileRepository(UserProfile.class, 
UserProfileEntity.class);
+        try {
+            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;
+
+            iasClientPool = new ThriftClientPool<>(
+                    tProtocol -> new IamAdminServices.Client(tProtocol), 
poolConfig, ServerSettings.getProfileServiceServerHost(),
+                    
Integer.parseInt(ServerSettings.getProfileServiceServerPort()));
+        }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