[
https://issues.apache.org/jira/browse/AIRAVATA-2607?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16403216#comment-16403216
]
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_r175244767
##########
File path:
airavata-services/profile-service/profile-service-server/src/main/java/org/apache/airavata/service/profile/handlers/GroupManagerServiceHandler.java
##########
@@ -185,74 +208,76 @@ public boolean transferGroupOwnership(AuthzToken
authzToken, String groupId, Str
@Override
@SecurityCheck
public boolean addGroupAdmins(AuthzToken authzToken, String groupId,
List<String> adminIds) throws GroupManagerServiceException,
AuthorizationException, TException {
+ SharingRegistryService.Client sharingClient =
sharingClientPool.getResource();
try {
- SharingRegistryService.Client sharingClient =
getSharingRegistryServiceClient();
- return
sharingClient.addGroupAdmins(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminIds);
+ boolean result =
sharingClient.addGroupAdmins(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminIds);
+ sharingClientPool.returnResource(sharingClient);
+ return result;
}
catch (Exception e) {
String msg = "Error Adding Admins to Group. Group ID: " + groupId;
logger.error(msg, e);
GroupManagerServiceException exception = new
GroupManagerServiceException();
exception.setMessage(msg + " More info : " + e.getMessage());
+ sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@Override
@SecurityCheck
public boolean removeGroupAdmins(AuthzToken authzToken, String groupId,
List<String> adminIds) throws GroupManagerServiceException,
AuthorizationException, TException {
+ SharingRegistryService.Client sharingClient =
sharingClientPool.getResource();
try {
- SharingRegistryService.Client sharingClient =
getSharingRegistryServiceClient();
- return
sharingClient.removeGroupAdmins(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminIds);
+ boolean result =
sharingClient.removeGroupAdmins(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminIds);
+ sharingClientPool.returnResource(sharingClient);
+ return result;
}
catch (Exception e) {
String msg = "Error Removing Admins from the Group. Group ID: " +
groupId;
logger.error(msg, e);
GroupManagerServiceException exception = new
GroupManagerServiceException();
exception.setMessage(msg + " More info : " + e.getMessage());
+ sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@Override
@SecurityCheck
public boolean hasAdminAccess(AuthzToken authzToken, String groupId,
String adminId) throws GroupManagerServiceException, AuthorizationException,
TException {
+ SharingRegistryService.Client sharingClient =
sharingClientPool.getResource();
try {
- SharingRegistryService.Client sharingClient =
getSharingRegistryServiceClient();
- return
sharingClient.hasAdminAccess(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminId);
+ boolean result =
sharingClient.hasAdminAccess(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, adminId);
+ sharingClientPool.returnResource(sharingClient);
+ return result;
}
catch (Exception e) {
String msg = "Error Checking Admin Access for the Group. Group ID:
" + groupId + " Admin ID: " + adminId;
logger.error(msg, e);
GroupManagerServiceException exception = new
GroupManagerServiceException();
exception.setMessage(msg + " More info : " + e.getMessage());
+ sharingClientPool.returnBrokenResource(sharingClient);
throw exception;
}
}
@Override
@SecurityCheck
public boolean hasOwnerAccess(AuthzToken authzToken, String groupId,
String ownerId) throws GroupManagerServiceException, AuthorizationException,
TException {
+ SharingRegistryService.Client sharingClient =
sharingClientPool.getResource();
try {
- SharingRegistryService.Client sharingClient =
getSharingRegistryServiceClient();
- return
sharingClient.hasOwnerAccess(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, ownerId);
+ boolean result =
sharingClient.hasOwnerAccess(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
groupId, ownerId);
+ sharingClientPool.returnResource(sharingClient);
+ return result;
}
Review comment:
} catch {
----------------------------------------------------------------
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)