You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by ya...@apache.org on 2026/03/26 05:04:34 UTC

(airavata) branch feat/single-jvm created (now 1c568090fd)

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

yasith pushed a change to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git


      at 1c568090fd fix: remove tests that depend on deleted DatabaseTestCases and SharingRegistryServer

This branch includes the following new commits:

     new bb29ae7c4d feat: add AiravataUnifiedServer consolidating all Thrift services
     new 4944767c92 refactor: replace ThriftClientPool RPC calls with in-process handler method calls
     new 2b511446e7 feat(python-sdk): route all service clients through single API server port via TMultiplexedProtocol
     new 15293bbb0b refactor: remove old per-service server classes and startup scripts
     new ddee63173e feat: update DevOps configs for single unified server deployment
     new 1c568090fd fix: remove tests that depend on deleted DatabaseTestCases and SharingRegistryServer

The 6 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.



(airavata) 03/06: feat(python-sdk): route all service clients through single API server port via TMultiplexedProtocol

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 2b511446e7815311d6ff39b646b2aab384ba7c7c
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Mar 25 23:51:24 2026 -0500

    feat(python-sdk): route all service clients through single API server port via TMultiplexedProtocol
    
    All Thrift service clients (Airavata, SharingRegistry, CredentialStore, and
    profile services) now connect to API_SERVER_HOSTNAME:API_SERVER_PORT with
    service-specific names via TMultiplexedProtocol. Removed separate host/port
    settings for PROFILE_SERVICE, SHARING_API, and CREDENTIAL_STORE.
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../airavata-python-sdk/airavata_sdk/__init__.py   | 48 ----------------------
 .../clients/credential_store_client.py             |  6 +--
 .../airavata_sdk/clients/group_manager_client.py   |  6 +--
 .../airavata_sdk/clients/iam_admin_client.py       |  6 +--
 .../clients/sharing_registry_client.py             |  6 +--
 .../airavata_sdk/clients/tenant_profile_client.py  |  6 +--
 .../airavata_sdk/clients/user_profile_client.py    |  6 +--
 .../airavata_sdk/transport/utils.py                | 42 +++++++++----------
 8 files changed, 39 insertions(+), 87 deletions(-)

diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/__init__.py b/dev-tools/airavata-python-sdk/airavata_sdk/__init__.py
index 0a559918e8..7b858662cc 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/__init__.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/__init__.py
@@ -94,54 +94,6 @@ class Settings:
     def FILE_SVC_URL(self):
         return str(os.getenv("FILE_SVC_URL", f"http://{self.API_SERVER_HOSTNAME}:8050"))
 
-    # ------------------------------------------------------------
-    # Profile Service Connection Settings
-    # ------------------------------------------------------------
-
-    @property
-    def PROFILE_SERVICE_HOST(self):
-        return str(os.getenv("PROFILE_SERVICE_HOST", self.API_SERVER_HOSTNAME))
-
-    @property
-    def PROFILE_SERVICE_PORT(self):
-        return int(os.getenv("PROFILE_SERVICE_PORT", 8962))
-
-    @property
-    def PROFILE_SERVICE_SECURE(self):
-        return bool(os.getenv("PROFILE_SERVICE_SECURE", False))
-
-    # ------------------------------------------------------------
-    # Sharing Service Connection Settings
-    # ------------------------------------------------------------
-
-    @property
-    def SHARING_API_HOST(self):
-        return str(os.getenv("SHARING_API_HOST", self.API_SERVER_HOSTNAME))
-
-    @property
-    def SHARING_API_PORT(self):
-        return int(os.getenv("SHARING_API_PORT", 7878))
-
-    @property
-    def SHARING_API_SECURE(self):
-        return bool(os.getenv("SHARING_API_SECURE", False))
-
-    # ------------------------------------------------------------
-    # Credential Store Connection Settings
-    # ------------------------------------------------------------
-
-    @property
-    def CREDENTIAL_STORE_API_HOST(self):
-        return str(os.getenv("CREDENTIAL_STORE_API_HOST", self.API_SERVER_HOSTNAME))
-
-    @property
-    def CREDENTIAL_STORE_API_PORT(self):
-        return int(os.getenv("CREDENTIAL_STORE_API_PORT", 8960))
-
-    @property
-    def CREDENTIAL_STORE_API_SECURE(self):
-        return bool(os.getenv("CREDENTIAL_STORE_API_SECURE", False))
-
     # ------------------------------------------------------------
     # Gateway Settings
     # ------------------------------------------------------------
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/credential_store_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/credential_store_client.py
index d0113b334b..f3d2c854c0 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/credential_store_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/credential_store_client.py
@@ -27,9 +27,9 @@ class CredentialStoreClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_credential_store_client(
-            self.settings.CREDENTIAL_STORE_API_HOST,
-            self.settings.CREDENTIAL_STORE_API_PORT,
-            self.settings.CREDENTIAL_STORE_API_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.get_SSH_credential = self.client.getSSHCredential
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/group_manager_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/group_manager_client.py
index 77db3dc639..f5b581a371 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/group_manager_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/group_manager_client.py
@@ -36,9 +36,9 @@ class GroupManagerClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_group_manager_client(
-            self.settings.PROFILE_SERVICE_HOST,
-            self.settings.PROFILE_SERVICE_PORT,
-            self.settings.PROFILE_SERVICE_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.get_api_version = self.client.getAPIVersion
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/iam_admin_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/iam_admin_client.py
index 45bb779cde..561a0bba77 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/iam_admin_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/iam_admin_client.py
@@ -38,9 +38,9 @@ class IAMAdminClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_iam_admin_client(
-            self.settings.PROFILE_SERVICE_HOST,
-            self.settings.PROFILE_SERVICE_PORT,
-            self.settings.PROFILE_SERVICE_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.set_up_gateway = self.client.setUpGateway
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/sharing_registry_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/sharing_registry_client.py
index 285e9342c3..e22c5534fa 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/sharing_registry_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/sharing_registry_client.py
@@ -36,9 +36,9 @@ class SharingRegistryClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_sharing_registry_client(
-            self.settings.SHARING_API_HOST,
-            self.settings.SHARING_API_PORT,
-            self.settings.SHARING_API_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.create_domain = self.client.createDomain
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/tenant_profile_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/tenant_profile_client.py
index 71b2916183..95bc6735bc 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/tenant_profile_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/tenant_profile_client.py
@@ -36,9 +36,9 @@ class TenantProfileClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_tenant_profile_client(
-            self.settings.PROFILE_SERVICE_HOST,
-            self.settings.PROFILE_SERVICE_PORT,
-            self.settings.PROFILE_SERVICE_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.add_gateway = self.client.addGateway
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/clients/user_profile_client.py b/dev-tools/airavata-python-sdk/airavata_sdk/clients/user_profile_client.py
index 75adae16df..542132000c 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/clients/user_profile_client.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/clients/user_profile_client.py
@@ -36,9 +36,9 @@ class UserProfileClient(object):
     def __init__(self):
         self.settings = Settings()
         self.client = utils.initialize_user_profile_client(
-            self.settings.PROFILE_SERVICE_HOST,
-            self.settings.PROFILE_SERVICE_PORT,
-            self.settings.PROFILE_SERVICE_SECURE,
+            self.settings.API_SERVER_HOSTNAME,
+            self.settings.API_SERVER_PORT,
+            self.settings.API_SERVER_SECURE,
         )
         # expose the needed functions
         self.get_api_version = self.client.getAPIVersion
diff --git a/dev-tools/airavata-python-sdk/airavata_sdk/transport/utils.py b/dev-tools/airavata-python-sdk/airavata_sdk/transport/utils.py
index 3954f60194..b53e216eb1 100644
--- a/dev-tools/airavata-python-sdk/airavata_sdk/transport/utils.py
+++ b/dev-tools/airavata-python-sdk/airavata_sdk/transport/utils.py
@@ -131,52 +131,52 @@ def initialize_api_client_pool(
     port=settings.API_SERVER_PORT,
     secure=settings.API_SERVER_SECURE,
 ) -> Airavata.Client:
-  return ThriftClient(Airavata.Client, host, port, secure).client
+  return ThriftClient(Airavata.Client, host, port, secure, service_name="Airavata").client
 
 
 def initialize_group_manager_client(
-    host=settings.PROFILE_SERVICE_HOST,
-    port=settings.PROFILE_SERVICE_PORT,
-    secure=settings.PROFILE_SERVICE_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> GroupManagerService.Client:
   return ThriftClient(GroupManagerService.Client, host, port, secure, GROUP_MANAGER_CPI_NAME).client
 
 
 def initialize_iam_admin_client(
-    host=settings.PROFILE_SERVICE_HOST,
-    port=settings.PROFILE_SERVICE_PORT,
-    secure=settings.PROFILE_SERVICE_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> IamAdminServices.Client:
   return ThriftClient(IamAdminServices.Client, host, port, secure, IAM_ADMIN_SERVICES_CPI_NAME).client
 
 
 def initialize_tenant_profile_client(
-    host=settings.PROFILE_SERVICE_HOST,
-    port=settings.PROFILE_SERVICE_PORT,
-    secure=settings.PROFILE_SERVICE_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> TenantProfileService.Client:
   return ThriftClient(TenantProfileService.Client, host, port, secure, TENANT_PROFILE_CPI_NAME).client
 
 
 def initialize_user_profile_client(
-    host=settings.PROFILE_SERVICE_HOST,
-    port=settings.PROFILE_SERVICE_PORT,
-    secure=settings.PROFILE_SERVICE_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> UserProfileService.Client:
   return ThriftClient(UserProfileService.Client, host, port, secure, USER_PROFILE_CPI_NAME).client
 
 
 def initialize_sharing_registry_client(
-    host=settings.SHARING_API_HOST,
-    port=settings.SHARING_API_PORT,
-    secure=settings.SHARING_API_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> SharingRegistryService.Client:
-  return ThriftClient(SharingRegistryService.Client, host, port, secure).client
+  return ThriftClient(SharingRegistryService.Client, host, port, secure, service_name="SharingRegistry").client
 
 
 def initialize_credential_store_client(
-    host=settings.CREDENTIAL_STORE_API_HOST,
-    port=settings.CREDENTIAL_STORE_API_PORT,
-    secure=settings.CREDENTIAL_STORE_API_SECURE,
+    host=settings.API_SERVER_HOSTNAME,
+    port=settings.API_SERVER_PORT,
+    secure=settings.API_SERVER_SECURE,
 ) -> CredentialStoreService.Client:
-  return ThriftClient(CredentialStoreService.Client, host, port, secure).client
+  return ThriftClient(CredentialStoreService.Client, host, port, secure, service_name="CredentialStore").client


(airavata) 06/06: fix: remove tests that depend on deleted DatabaseTestCases and SharingRegistryServer

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 1c568090fd730a2b9acfa183381271655434844f
Author: yasithdev <ya...@icloud.com>
AuthorDate: Thu Mar 26 00:04:01 2026 -0500

    fix: remove tests that depend on deleted DatabaseTestCases and SharingRegistryServer
---
 .gitignore                                         |   2 +
 .../airavata/common/utils/ServerSettings.java      |  16 +-
 .../store/impl/util/CredentialStoreJDBCConfig.java |   2 +-
 .../registry/core/utils/AppCatalogJDBCConfig.java  |  10 +-
 .../registry/core/utils/ExpCatalogJDBCConfig.java  |  10 +-
 .../core/utils/ReplicaCatalogJDBCConfig.java       |  10 +-
 .../core/utils/WorkflowCatalogJDBCConfig.java      |  10 +-
 .../profile/commons/utils/JPAConstants.java        |  10 +-
 .../db/utils/SharingRegistryJDBCConfig.java        |  10 +-
 .../migrator/airavata/ConnectionFactory.java       |   8 +-
 .../src/main/resources/airavata-server.properties  |  49 +--
 .../store/cpi/SSHSummaryTest/SSHSummaryTest.java   | 189 ---------
 .../store/store/impl/db/CommunityUserDAOTest.java  | 192 ---------
 .../store/store/impl/db/CredentialsDAOTest.java    | 464 ---------------------
 .../security/userstore/JDBCUserStoreTest.java      |  97 -----
 .../security/userstore/SessionDBUserStoreTest.java |  93 -----
 .../registry/SharingRegistryServiceTest.java       | 432 -------------------
 17 files changed, 51 insertions(+), 1553 deletions(-)

diff --git a/.gitignore b/.gitignore
index 347d0a1289..8f3caafb58 100644
--- a/.gitignore
+++ b/.gitignore
@@ -60,3 +60,5 @@ logs/
 **/generated-sources/
 /distribution
 /vault*
+airavata-api/distribution/
+airavata-api/target/
diff --git a/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java b/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
index e62cac05dd..1d42e17e5d 100644
--- a/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
+++ b/airavata-api/src/main/java/org/apache/airavata/common/utils/ServerSettings.java
@@ -32,17 +32,17 @@ public class ServerSettings extends ApplicationSettings {
     // Zookeeper + curator constants
     public static final String EMBEDDED_ZK = "embedded.zk";
     public static final String ZOOKEEPER_SERVER_CONNECTION = "zookeeper.server.connection";
-    private static final String CREDENTIAL_STORE_DB_URL = "credential.store.jdbc.url";
-    private static final String CREDENTIAL_STORE_DB_USER = "credential.store.jdbc.user";
-    private static final String CREDENTIAL_STORE_DB_PASSWORD = "credential.store.jdbc.password";
-    private static final String CREDENTIAL_STORE_DB_DRIVER = "credential.store.jdbc.driver";
+    private static final String CREDENTIAL_STORE_DB_URL = "airavata.jdbc.url";
+    private static final String CREDENTIAL_STORE_DB_USER = "airavata.jdbc.user";
+    private static final String CREDENTIAL_STORE_DB_PASSWORD = "airavata.jdbc.password";
+    private static final String CREDENTIAL_STORE_DB_DRIVER = "airavata.jdbc.driver";
     private static final java.lang.String SHARING_REGISTRY_PORT = "sharing.registry.server.port";
     private static final java.lang.String SHARING_REGISTRY_HOST = "sharing.registry.server.host";
 
-    private static final String REGISTRY_DB_URL = "registry.jdbc.url";
-    private static final String REGISTRY_DB_USER = "registry.jdbc.user";
-    private static final String REGISTRY_DB_PASSWORD = "registry.jdbc.password";
-    private static final String REGISTRY_DB_DRIVER = "registry.jdbc.driver";
+    private static final String REGISTRY_DB_URL = "airavata.jdbc.url";
+    private static final String REGISTRY_DB_USER = "airavata.jdbc.user";
+    private static final String REGISTRY_DB_PASSWORD = "airavata.jdbc.password";
+    private static final String REGISTRY_DB_DRIVER = "airavata.jdbc.driver";
     private static final String HOST_SCHEDULER = "host.scheduler";
     public static final String JOB_NOTIFICATION_ENABLE = "job.notification.enable";
     public static final String JOB_NOTIFICATION_EMAILIDS = "job.notification.emailids";
diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/store/store/impl/util/CredentialStoreJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/credential/store/store/impl/util/CredentialStoreJDBCConfig.java
index 8e6e7990d8..0f56134dee 100644
--- a/airavata-api/src/main/java/org/apache/airavata/credential/store/store/impl/util/CredentialStoreJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/credential/store/store/impl/util/CredentialStoreJDBCConfig.java
@@ -64,7 +64,7 @@ public class CredentialStoreJDBCConfig implements JDBCConfig {
     @Override
     public String getValidationQuery() {
         try {
-            return ServerSettings.getSetting("credential.store.jdbc.validationQuery");
+            return ServerSettings.getSetting("airavata.jdbc.validationQuery");
         } catch (ApplicationSettingsException e) {
             throw new RuntimeException(e);
         }
diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/AppCatalogJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/AppCatalogJDBCConfig.java
index cf55a88090..20e98c3659 100644
--- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/AppCatalogJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/AppCatalogJDBCConfig.java
@@ -24,11 +24,11 @@ import org.apache.airavata.common.utils.JDBCConfig;
 import org.apache.airavata.common.utils.ServerSettings;
 
 public class AppCatalogJDBCConfig implements JDBCConfig {
-    private static final String APPCATALOG_JDBC_DRIVER = "appcatalog.jdbc.driver";
-    private static final String APPCATALOG_JDBC_URL = "appcatalog.jdbc.url";
-    private static final String APPCATALOG_JDBC_USER = "appcatalog.jdbc.user";
-    private static final String APPCATALOG_JDBC_PWD = "appcatalog.jdbc.password";
-    private static final String APPCATALOG_JDBC_VALIDATION_QUERY = "appcatalog.validationQuery";
+    private static final String APPCATALOG_JDBC_DRIVER = "airavata.jdbc.driver";
+    private static final String APPCATALOG_JDBC_URL = "airavata.jdbc.url";
+    private static final String APPCATALOG_JDBC_USER = "airavata.jdbc.user";
+    private static final String APPCATALOG_JDBC_PWD = "airavata.jdbc.password";
+    private static final String APPCATALOG_JDBC_VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 
     @Override
     public String getURL() {
diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ExpCatalogJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ExpCatalogJDBCConfig.java
index 4931dfddd3..3a35f933c7 100644
--- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ExpCatalogJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ExpCatalogJDBCConfig.java
@@ -24,11 +24,11 @@ import org.apache.airavata.common.utils.JDBCConfig;
 import org.apache.airavata.common.utils.ServerSettings;
 
 public class ExpCatalogJDBCConfig implements JDBCConfig {
-    private static final String EXPCATALOG_JDBC_DRIVER = "registry.jdbc.driver";
-    private static final String EXPCATALOG_JDBC_URL = "registry.jdbc.url";
-    private static final String EXPCATALOG_JDBC_USER = "registry.jdbc.user";
-    private static final String EXPCATALOG_JDBC_PWD = "registry.jdbc.password";
-    private static final String EXPCATALOG_VALIDATION_QUERY = "validationQuery";
+    private static final String EXPCATALOG_JDBC_DRIVER = "airavata.jdbc.driver";
+    private static final String EXPCATALOG_JDBC_URL = "airavata.jdbc.url";
+    private static final String EXPCATALOG_JDBC_USER = "airavata.jdbc.user";
+    private static final String EXPCATALOG_JDBC_PWD = "airavata.jdbc.password";
+    private static final String EXPCATALOG_VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 
     @Override
     public String getURL() {
diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ReplicaCatalogJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ReplicaCatalogJDBCConfig.java
index b4e66c0aa5..41d90c09cd 100644
--- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ReplicaCatalogJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/ReplicaCatalogJDBCConfig.java
@@ -24,11 +24,11 @@ import org.apache.airavata.common.utils.JDBCConfig;
 import org.apache.airavata.common.utils.ServerSettings;
 
 public class ReplicaCatalogJDBCConfig implements JDBCConfig {
-    private static final String REPLICA_CATALOG_JDBC_DRIVER = "replicacatalog.jdbc.driver";
-    private static final String REPLICA_CATALOG_JDBC_URL = "replicacatalog.jdbc.url";
-    private static final String REPLICA_CATALOG_JDBC_USER = "replicacatalog.jdbc.user";
-    private static final String REPLICA_CATALOG_JDBC_PASSWORD = "replicacatalog.jdbc.password";
-    private static final String REPLICA_CATALOG_VALIDATION_QUERY = "replicacatalog.validationQuery";
+    private static final String REPLICA_CATALOG_JDBC_DRIVER = "airavata.jdbc.driver";
+    private static final String REPLICA_CATALOG_JDBC_URL = "airavata.jdbc.url";
+    private static final String REPLICA_CATALOG_JDBC_USER = "airavata.jdbc.user";
+    private static final String REPLICA_CATALOG_JDBC_PASSWORD = "airavata.jdbc.password";
+    private static final String REPLICA_CATALOG_VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 
     @Override
     public String getURL() {
diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/WorkflowCatalogJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/WorkflowCatalogJDBCConfig.java
index 4247e28850..4baa253d08 100644
--- a/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/WorkflowCatalogJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/registry/core/utils/WorkflowCatalogJDBCConfig.java
@@ -24,11 +24,11 @@ import org.apache.airavata.common.utils.JDBCConfig;
 import org.apache.airavata.common.utils.ServerSettings;
 
 public class WorkflowCatalogJDBCConfig implements JDBCConfig {
-    private static final String WORKFLOW_CATALOG_JDBC_DRIVER = "workflowcatalog.jdbc.driver";
-    private static final String WORKFLOW_CATALOG_JDBC_URL = "workflowcatalog.jdbc.url";
-    private static final String WORKFLOW_CATALOG_JDBC_USER = "workflowcatalog.jdbc.user";
-    private static final String WORKFLOW_CATALOG_JDBC_PASSWORD = "workflowcatalog.jdbc.password";
-    private static final String WORKFLOW_CATALOG_VALIDATION_QUERY = "workflowcatalog.validationQuery";
+    private static final String WORKFLOW_CATALOG_JDBC_DRIVER = "airavata.jdbc.driver";
+    private static final String WORKFLOW_CATALOG_JDBC_URL = "airavata.jdbc.url";
+    private static final String WORKFLOW_CATALOG_JDBC_USER = "airavata.jdbc.user";
+    private static final String WORKFLOW_CATALOG_JDBC_PASSWORD = "airavata.jdbc.password";
+    private static final String WORKFLOW_CATALOG_VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 
     @Override
     public String getURL() {
diff --git a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAConstants.java b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAConstants.java
index 2663b9f902..608a86b54b 100644
--- a/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAConstants.java
+++ b/airavata-api/src/main/java/org/apache/airavata/service/profile/commons/utils/JPAConstants.java
@@ -20,9 +20,9 @@
 package org.apache.airavata.service.profile.commons.utils;
 
 public class JPAConstants {
-    public static final String KEY_JDBC_URL = "profile.service.jdbc.url";
-    public static final String KEY_JDBC_USER = "profile.service.jdbc.user";
-    public static final String KEY_JDBC_PASSWORD = "profile.service.jdbc.password";
-    public static final String KEY_JDBC_DRIVER = "profile.service.jdbc.driver";
-    public static final String VALIDATION_QUERY = "profile.service.validationQuery";
+    public static final String KEY_JDBC_URL = "airavata.jdbc.url";
+    public static final String KEY_JDBC_USER = "airavata.jdbc.user";
+    public static final String KEY_JDBC_PASSWORD = "airavata.jdbc.password";
+    public static final String KEY_JDBC_DRIVER = "airavata.jdbc.driver";
+    public static final String VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 }
diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/SharingRegistryJDBCConfig.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/SharingRegistryJDBCConfig.java
index 80cc9826fc..27bb653991 100644
--- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/SharingRegistryJDBCConfig.java
+++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/db/utils/SharingRegistryJDBCConfig.java
@@ -25,11 +25,11 @@ import org.apache.airavata.common.utils.ServerSettings;
 
 public class SharingRegistryJDBCConfig implements JDBCConfig {
 
-    private static final String SHARING_REG_JDBC_DRIVER = "sharingcatalog.jdbc.driver";
-    private static final String SHARING_REG_JDBC_URL = "sharingcatalog.jdbc.url";
-    private static final String SHARING_REG_JDBC_USER = "sharingcatalog.jdbc.user";
-    private static final String SHARING_REG_JDBC_PWD = "sharingcatalog.jdbc.password";
-    private static final String SHARING_REG_VALIDATION_QUERY = "sharingcatalog.validationQuery";
+    private static final String SHARING_REG_JDBC_DRIVER = "airavata.jdbc.driver";
+    private static final String SHARING_REG_JDBC_URL = "airavata.jdbc.url";
+    private static final String SHARING_REG_JDBC_USER = "airavata.jdbc.user";
+    private static final String SHARING_REG_JDBC_PWD = "airavata.jdbc.password";
+    private static final String SHARING_REG_VALIDATION_QUERY = "airavata.jdbc.validationQuery";
 
     @Override
     public String getURL() {
diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/ConnectionFactory.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/ConnectionFactory.java
index 9c05a05faf..d954870a09 100644
--- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/ConnectionFactory.java
+++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/migrator/airavata/ConnectionFactory.java
@@ -33,10 +33,10 @@ public class ConnectionFactory {
     // static reference to itself
     private static ConnectionFactory instance;
 
-    private static final String REGISTRY_DB_URL = "registry.jdbc.url";
-    private static final String REGISTRY_DB_USER = "registry.jdbc.user";
-    private static final String REGISTRY_DB_PASSWORD = "registry.jdbc.password";
-    private static final String REGISTRY_DB_DRIVER = "registry.jdbc.driver";
+    private static final String REGISTRY_DB_URL = "airavata.jdbc.url";
+    private static final String REGISTRY_DB_USER = "airavata.jdbc.user";
+    private static final String REGISTRY_DB_PASSWORD = "airavata.jdbc.password";
+    private static final String REGISTRY_DB_DRIVER = "airavata.jdbc.driver";
 
     private static Connection expCatConnection;
 
diff --git a/airavata-api/src/main/resources/airavata-server.properties b/airavata-api/src/main/resources/airavata-server.properties
index f1b5b3b1a0..7be72262d2 100644
--- a/airavata-api/src/main/resources/airavata-server.properties
+++ b/airavata-api/src/main/resources/airavata-server.properties
@@ -26,22 +26,16 @@ apiserver.host=airavata.localhost
 apiserver.port=8930
 apiserver.class=org.apache.airavata.api.server.AiravataAPIServer
 
-appcatalog.jdbc.driver=org.mariadb.jdbc.Driver
-appcatalog.jdbc.password=123456
-appcatalog.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-appcatalog.jdbc.user=airavata
-appcatalog.validationQuery=SELECT 1
+# Unified Database Configuration
+airavata.jdbc.driver=org.mariadb.jdbc.Driver
+airavata.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
+airavata.jdbc.user=airavata
+airavata.jdbc.password=123456
+airavata.jdbc.validationQuery=SELECT 1
 
 cluster.status.monitoring.enable=false
 cluster.status.monitoring.repeat.time=18000
 
-credential.store.jdbc.driver=org.mariadb.jdbc.Driver
-credential.store.jdbc.password=123456
-credential.store.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-credential.store.jdbc.user=airavata
-credential.store.jdbc.validationQuery=SELECT 1
-credential.store.server.host=airavata.localhost
-credential.store.server.port=8960
 credential.store.class=org.apache.airavata.credential.store.server.CredentialStoreServer
 
 data.analyzer.job.scanning.enable=false
@@ -126,13 +120,8 @@ pre.workflow.manager.monitoring.port=9093
 pre.workflow.manager.name=AiravataPreWM
 
 profile_service.class=org.apache.airavata.service.profile.server.ProfileServiceServer
-profile.service.jdbc.driver=org.mariadb.jdbc.Driver
-profile.service.jdbc.password=123456
-profile.service.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-profile.service.jdbc.user=airavata
 profile.service.server.host=airavata.localhost
 profile.service.server.port=8962
-profile.service.validationQuery=SELECT 1
 
 # RabbitMQ Settings
 rabbitmq.broker.url=amqp://airavata:airavata@airavata.localhost:5672
@@ -145,30 +134,9 @@ prefetch.count=200
 realtime.monitor.broker.consumer.group=monitor
 realtime.monitor.broker.topic=helix-airavata-mq
 
-registry.jdbc.driver=org.mariadb.jdbc.Driver
-registry.jdbc.password=123456
-registry.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-registry.jdbc.user=airavata
-
-regserver.server.host=airavata.localhost
-regserver.server.min.threads=50
-regserver.server.port=8970
 regserver=org.apache.airavata.registry.api.service.RegistryAPIServer
 
-replicacatalog.jdbc.driver=org.mariadb.jdbc.Driver
-replicacatalog.jdbc.password=123456
-replicacatalog.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-replicacatalog.jdbc.user=airavata
-replicacatalog.validationQuery=SELECT 1
-
 sharing_server=org.apache.airavata.sharing.registry.server.SharingRegistryServer
-sharing.registry.server.host=airavata.localhost
-sharing.registry.server.port=7878
-sharingcatalog.jdbc.driver=org.mariadb.jdbc.Driver
-sharingcatalog.jdbc.password=123456
-sharingcatalog.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-sharingcatalog.jdbc.user=airavata
-sharingcatalog.validationQuery=SELECT 1
 
 super.tenant.gatewayId=default
 
@@ -189,11 +157,6 @@ security.manager.class=org.apache.airavata.service.security.KeyCloakSecurityMana
 
 validationQuery=SELECT 1
 
-workflowcatalog.jdbc.driver=org.mariadb.jdbc.Driver
-workflowcatalog.jdbc.password=123456
-workflowcatalog.jdbc.url=jdbc:mariadb://airavata.localhost:13306/airavata
-workflowcatalog.jdbc.user=airavata
-workflowcatalog.validationQuery=SELECT 1
 
 zookeeper.server.connection=airavata.localhost:2181
 StrictHostKeyChecking=no
\ No newline at end of file
diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java
deleted file mode 100644
index b5ed5f14ce..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/credential/store/cpi/SSHSummaryTest/SSHSummaryTest.java
+++ /dev/null
@@ -1,189 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.credential.store.cpi.SSHSummaryTest;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.File;
-import java.io.FileInputStream;
-import java.security.KeyStore;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-import java.sql.Connection;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.credential.impl.ssh.SSHCredential;
-import org.apache.airavata.credential.store.store.impl.SSHCredentialWriter;
-import org.apache.airavata.credential.store.store.impl.db.CredentialsDAO;
-import org.apache.airavata.credential.store.util.TokenGenerator;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Created by abhandar on 10/24/16.
- */
-public class SSHSummaryTest extends DatabaseTestCases {
-    private static final Logger logger = LoggerFactory.getLogger(SSHSummaryTest.class);
-
-    private CredentialsDAO credentialsDAO;
-
-    private X509Certificate[] x509Certificates;
-    private PrivateKey privateKey;
-
-    @BeforeAll
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-
-        waitTillServerStarts();
-
-        /*
-         * String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + "        GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
-         * "        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + "        CREDENTIAL BLOB NOT NULL,\n" +
-         * "        PRIVATE_KEY BLOB NOT NULL,\n" + "        NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
-         * "        NOT_AFTER VARCHAR(256) NOT NULL,\n" + "        LIFETIME INTEGER NOT NULL,\n" +
-         * "        REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
-         * "        REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
-         * "        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
-         */
-        // Adding description field as per pull request https://github.com/apache/airavata/pull/54
-        String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n"
-                + "        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
-                + "        TOKEN_ID VARCHAR(256) NOT NULL,\n"
-                + // Actual token used to identify the credential
-                "        CREDENTIAL BLOB NOT NULL,\n"
-                + "        PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
-                + "        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n"
-                + "        DESCRIPTION VARCHAR(500),\n"
-                + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
-
-        String dropTable = "drop table CREDENTIALS";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        executeSQL(createTable);
-    }
-
-    @AfterAll
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @BeforeEach
-    public void setUp() throws Exception {
-
-        credentialsDAO = new CredentialsDAO();
-
-        x509Certificates = new X509Certificate[1];
-
-        // Cleanup tables;
-        Connection connection = getConnection();
-
-        try {
-            DBUtil.truncate("credentials", connection);
-        } finally {
-            connection.close();
-        }
-
-        initializeKeys();
-    }
-
-    private void initializeKeys() throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        char[] password = "password".toCharArray();
-
-        String baseDirectory = System.getProperty("credential.module.directory");
-
-        String keyStorePath =
-                "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.p12";
-
-        if (baseDirectory != null) {
-            keyStorePath = baseDirectory + File.separator + keyStorePath;
-        } else {
-            keyStorePath = "modules" + File.separator + "credential-store" + File.separator + keyStorePath;
-        }
-
-        File keyStoreFile = new File(keyStorePath);
-        if (!keyStoreFile.exists()) {
-            logger.error("Unable to read keystore file " + keyStoreFile);
-            throw new RuntimeException("Unable to read keystore file " + keyStoreFile);
-        }
-
-        java.io.FileInputStream fis = null;
-        try {
-            fis = new java.io.FileInputStream(keyStorePath);
-            ks.load(fis, password);
-        } finally {
-            if (fis != null) {
-                fis.close();
-            }
-        }
-
-        fis.close();
-
-        privateKey = (PrivateKey) ks.getKey("selfsigned", password);
-        x509Certificates[0] = (X509Certificate) ks.getCertificate("selfsigned");
-    }
-
-    //    @Test Change the properties in ServerProperties file and give the correct path to run the test
-    public void testSSHSummary() throws Exception {
-        try {
-            String jdbcURL = ServerSettings.getCredentialStoreDBURL();
-            String jdbcDriver = ServerSettings.getCredentialStoreDBDriver();
-            String userName = ServerSettings.getCredentialStoreDBUser();
-            String password = ServerSettings.getCredentialStoreDBPassword();
-            String gatewayId = "phasta";
-            String privateKeyPath = "/home/abhandar/Documents/Airavata/keys/id_rsa_airavata";
-            String pubKeyPath = "/home/abhandar/Documents/Airavata/keys/id_rsa_airavata.pub";
-            DBUtil dbUtil = new DBUtil(jdbcURL, userName, password, jdbcDriver);
-            SSHCredentialWriter writer = new SSHCredentialWriter(dbUtil);
-            SSHCredential sshCredential = new SSHCredential();
-            sshCredential.setGateway(gatewayId);
-            String token = TokenGenerator.generateToken(gatewayId, null);
-            sshCredential.setToken(token);
-            sshCredential.setPortalUserName("phasta");
-            sshCredential.setDescription("dummy creds for testing");
-            FileInputStream privateKeyStream = new FileInputStream(privateKeyPath);
-            File filePri = new File(privateKeyPath);
-            byte[] bFilePri = new byte[(int) filePri.length()];
-            privateKeyStream.read(bFilePri);
-            FileInputStream pubKeyStream = new FileInputStream(pubKeyPath);
-            File filePub = new File(pubKeyPath);
-            byte[] bFilePub = new byte[(int) filePub.length()];
-            pubKeyStream.read(bFilePub);
-            privateKeyStream.close();
-            pubKeyStream.close();
-            sshCredential.setPrivateKey(bFilePri);
-            sshCredential.setPublicKey(bFilePub);
-            sshCredential.setPassphrase("ultrascan");
-            writer.writeCredentials(sshCredential);
-            assertEquals(token, sshCredential.getToken());
-        } catch (Exception ex) {
-            ex.printStackTrace();
-        }
-    }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
deleted file mode 100644
index 080e5b81e7..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CommunityUserDAOTest.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.credential.store.store.impl.db;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.sql.Connection;
-import java.util.List;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.junit.jupiter.api.*;
-
-/**
- * Test for community user DAO.
- */
-public class CommunityUserDAOTest extends DatabaseTestCases {
-
-    private CommunityUserDAO communityUserDAO;
-
-    @BeforeAll
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-        waitTillServerStarts();
-        String createTable = "CREATE TABLE COMMUNITY_USER\n" + "                (\n"
-                + "                        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
-                + "                        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n"
-                + "                        TOKEN_ID VARCHAR(256) NOT NULL,\n"
-                + "                        COMMUNITY_USER_EMAIL VARCHAR(256) NOT NULL,\n"
-                + "                        PRIMARY KEY (GATEWAY_ID, COMMUNITY_USER_NAME, TOKEN_ID)\n"
-                + "                )";
-        String dropTable = "drop table COMMUNITY_USER";
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-        executeSQL(createTable);
-    }
-
-    @AfterAll
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @BeforeEach
-    public void setUp() throws Exception {
-        communityUserDAO = new CommunityUserDAO();
-        Connection connection = getDbUtil().getConnection();
-        try {
-            DBUtil.truncate("community_user", connection);
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testAddCommunityUser() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNotNull(user);
-            assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce2", connection);
-            assertNotNull(user);
-            assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUserByToken("gw1", "Token1", connection);
-            assertNotNull(user);
-            assertEquals("ogce", user.getUserName());
-            assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-            user = communityUserDAO.getCommunityUserByToken("gw1", "Token2", connection);
-            assertNotNull(user);
-            assertEquals("ogce2", user.getUserName());
-            assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testDeleteCommunityUser() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNotNull(user);
-
-            communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.deleteCommunityUser(communityUser, connection);
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNull(user);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testDeleteCommunityUserByToken() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNotNull(user);
-
-            communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.deleteCommunityUserByToken(communityUser, "Token1", connection);
-
-            user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNull(user);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetCommunityUsers() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-            communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-            CommunityUser user = communityUserDAO.getCommunityUser("gw1", "ogce", connection);
-            assertNotNull(user);
-            assertEquals("ogce@sciencegateway.org", user.getUserEmail());
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetCommunityUsersForGateway() throws Exception {
-
-        Connection connection = getConnection();
-
-        CommunityUser communityUser = new CommunityUser("gw1", "ogce", "ogce@sciencegateway.org");
-        communityUserDAO.addCommunityUser(communityUser, "Token1", connection);
-
-        communityUser = new CommunityUser("gw1", "ogce2", "ogce@sciencegateway.org");
-        communityUserDAO.addCommunityUser(communityUser, "Token2", connection);
-
-        List<CommunityUser> users = communityUserDAO.getCommunityUsers("gw1", connection);
-        assertNotNull(users);
-        assertEquals(2, users.size());
-
-        assertEquals(users.get(0).getUserName(), "ogce");
-        assertEquals(users.get(1).getUserName(), "ogce2");
-    }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java b/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
deleted file mode 100644
index 7dea307aa5..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/credential/store/store/impl/db/CredentialsDAOTest.java
+++ /dev/null
@@ -1,464 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.credential.store.store.impl.db;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.File;
-import java.net.URI;
-import java.net.URISyntaxException;
-import java.security.KeyStore;
-import java.security.PrivateKey;
-import java.security.cert.X509Certificate;
-import java.sql.Connection;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.airavata.common.utils.DBUtil;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.common.utils.KeyStorePasswordCallback;
-import org.apache.airavata.credential.store.credential.CommunityUser;
-import org.apache.airavata.credential.store.credential.Credential;
-import org.apache.airavata.credential.store.credential.CredentialOwnerType;
-import org.apache.airavata.credential.store.credential.impl.certificate.CertificateCredential;
-import org.apache.airavata.credential.store.store.CredentialStoreException;
-import org.junit.jupiter.api.AfterAll;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.BeforeEach;
-import org.junit.jupiter.api.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Test class for credential class
- */
-public class CredentialsDAOTest extends DatabaseTestCases {
-
-    private static final Logger logger = LoggerFactory.getLogger(CredentialsDAOTest.class);
-
-    private CredentialsDAO credentialsDAO;
-
-    private X509Certificate[] x509Certificates;
-    private PrivateKey privateKey;
-
-    @BeforeAll
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-
-        waitTillServerStarts();
-
-        /*
-         * String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n" + "        GATEWAY_NAME VARCHAR(256) NOT NULL,\n" +
-         * "        COMMUNITY_USER_NAME VARCHAR(256) NOT NULL,\n" + "        CREDENTIAL BLOB NOT NULL,\n" +
-         * "        PRIVATE_KEY BLOB NOT NULL,\n" + "        NOT_BEFORE VARCHAR(256) NOT NULL,\n" +
-         * "        NOT_AFTER VARCHAR(256) NOT NULL,\n" + "        LIFETIME INTEGER NOT NULL,\n" +
-         * "        REQUESTING_PORTAL_USER_NAME VARCHAR(256) NOT NULL,\n" +
-         * "        REQUESTED_TIME TIMESTAMP DEFAULT '0000-00-00 00:00:00',\n" +
-         * "        PRIMARY KEY (GATEWAY_NAME, COMMUNITY_USER_NAME)\n" + ")";
-         */
-        // Adding description field as per pull request https://github.com/apache/airavata/pull/54
-        String createTable = "CREATE TABLE CREDENTIALS\n" + "(\n"
-                + "        GATEWAY_ID VARCHAR(256) NOT NULL,\n"
-                + "        TOKEN_ID VARCHAR(256) NOT NULL,\n"
-                + // Actual token used to identify the credential
-                "        CREDENTIAL BLOB NOT NULL,\n"
-                + "        PORTAL_USER_ID VARCHAR(256) NOT NULL,\n"
-                + "        TIME_PERSISTED TIMESTAMP DEFAULT CURRENT_TIMESTAMP,\n"
-                + "        DESCRIPTION VARCHAR(500),\n"
-                + "        CREDENTIAL_OWNER_TYPE VARCHAR(10) DEFAULT 'GATEWAY' NOT NULL,\n"
-                + "        PRIMARY KEY (GATEWAY_ID, TOKEN_ID)\n" + ")";
-
-        String dropTable = "drop table CREDENTIALS";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        executeSQL(createTable);
-    }
-
-    @AfterAll
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @BeforeEach
-    public void setUp() throws Exception {
-
-        credentialsDAO = new CredentialsDAO();
-
-        x509Certificates = new X509Certificate[1];
-
-        // Cleanup tables;
-        Connection connection = getConnection();
-
-        try {
-            DBUtil.truncate("credentials", connection);
-        } finally {
-            connection.close();
-        }
-
-        initializeKeys();
-    }
-
-    private void initializeKeys() throws Exception {
-        KeyStore ks = KeyStore.getInstance("JKS");
-        char[] password = "password".toCharArray();
-
-        String baseDirectory = System.getProperty("credential.module.directory");
-
-        String keyStorePath =
-                "src" + File.separator + "test" + File.separator + "resources" + File.separator + "airavata.p12";
-
-        if (baseDirectory != null) {
-            keyStorePath = baseDirectory + File.separator + keyStorePath;
-        } else {
-            keyStorePath = "modules" + File.separator + "credential-store" + File.separator + keyStorePath;
-        }
-
-        File keyStoreFile = new File(keyStorePath);
-        if (!keyStoreFile.exists()) {
-            logger.error("Unable to read keystore file " + keyStoreFile);
-            throw new RuntimeException("Unable to read keystore file " + keyStoreFile);
-        }
-
-        java.io.FileInputStream fis = null;
-        try {
-            fis = new java.io.FileInputStream(keyStorePath);
-            ks.load(fis, password);
-        } finally {
-            if (fis != null) {
-                fis.close();
-            }
-        }
-
-        privateKey = (PrivateKey) ks.getKey("selfsigned", password);
-        x509Certificates[0] = (X509Certificate) ks.getCertificate("selfsigned");
-    }
-
-    @Test
-    public void testKeyReading() throws Exception {
-        initializeKeys();
-        System.out.println(privateKey.getAlgorithm());
-        System.out.println(x509Certificates[0].getIssuerDN());
-
-        assertNotNull(privateKey);
-        assertNotNull(x509Certificates);
-    }
-
-    private CommunityUser getCommunityUser(String gateway, String name) {
-        return new CommunityUser(gateway, name, "amila@sciencegateway.org");
-    }
-
-    private void addTestCredentials() throws Exception {
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential = getTestCredentialObject();
-            credentialsDAO.addCredentials(
-                    certificateCredential.getCommunityUser().getGatewayName(), certificateCredential, connection);
-            certificateCredential.setToken("tom2");
-            credentialsDAO.addCredentials(
-                    certificateCredential.getCommunityUser().getGatewayName(), certificateCredential, connection);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    public CertificateCredential getTestCredentialObject() {
-
-        CertificateCredential certificateCredential = new CertificateCredential();
-        certificateCredential.setToken("tom");
-        certificateCredential.setCertificates(x509Certificates);
-        certificateCredential.setPrivateKey(privateKey);
-        certificateCredential.setCommunityUser(getCommunityUser("gw1", "tom"));
-        certificateCredential.setLifeTime(1000);
-        certificateCredential.setPortalUserName("jerry");
-        certificateCredential.setNotBefore("13 OCT 2012 5:34:23");
-        certificateCredential.setNotAfter("14 OCT 2012 5:34:23");
-        certificateCredential.setCredentialOwnerType(CredentialOwnerType.GATEWAY);
-
-        return certificateCredential;
-    }
-
-    @Test
-    public void testSerialization() throws CredentialStoreException {
-
-        CertificateCredential certificateCredential = getTestCredentialObject();
-
-        CredentialsDAO credentialsDAO1 = new CredentialsDAO();
-
-        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
-        CertificateCredential readCertificateCredential =
-                (CertificateCredential) credentialsDAO1.convertByteArrayToObject(array);
-
-        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
-        assertEquals(
-                certificateCredential.getCertificateRequestedTime(),
-                readCertificateCredential.getCertificateRequestedTime());
-        assertEquals(
-                certificateCredential.getCommunityUser().getGatewayName(),
-                readCertificateCredential.getCommunityUser().getGatewayName());
-        assertEquals(
-                certificateCredential.getCommunityUser().getUserEmail(),
-                readCertificateCredential.getCommunityUser().getUserEmail());
-        assertEquals(
-                certificateCredential.getCommunityUser().getUserName(),
-                readCertificateCredential.getCommunityUser().getUserName());
-        assertEquals(certificateCredential.getLifeTime(), readCertificateCredential.getLifeTime());
-        assertEquals(certificateCredential.getNotAfter(), readCertificateCredential.getNotAfter());
-        assertEquals(certificateCredential.getNotBefore(), readCertificateCredential.getNotBefore());
-        assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
-        assertEquals(
-                certificateCredential.getCredentialOwnerType(), readCertificateCredential.getCredentialOwnerType());
-
-        PrivateKey newKey = readCertificateCredential.getPrivateKey();
-
-        assertNotNull(newKey);
-        assertEquals(privateKey.getClass(), newKey.getClass());
-
-        assertEquals(privateKey.getFormat(), newKey.getFormat());
-        assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
-        assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
-    }
-
-    @Test
-    public void testSerializationWithEncryption() throws CredentialStoreException, URISyntaxException {
-
-        URI uri = this.getClass().getClassLoader().getResource("airavata.p12").toURI();
-        String secretKeyAlias = "mykey";
-
-        assert uri != null;
-
-        CertificateCredential certificateCredential = getTestCredentialObject();
-
-        CredentialsDAO credentialsDAO1 =
-                new CredentialsDAO(uri.getPath(), secretKeyAlias, new TestACSKeyStoreCallback());
-
-        byte[] array = credentialsDAO1.convertObjectToByteArray(certificateCredential);
-        CertificateCredential readCertificateCredential =
-                (CertificateCredential) credentialsDAO1.convertByteArrayToObject(array);
-
-        checkEquality(certificateCredential.getCertificates(), readCertificateCredential.getCertificates());
-        assertEquals(
-                certificateCredential.getCertificateRequestedTime(),
-                readCertificateCredential.getCertificateRequestedTime());
-        assertEquals(
-                certificateCredential.getCommunityUser().getGatewayName(),
-                readCertificateCredential.getCommunityUser().getGatewayName());
-        assertEquals(
-                certificateCredential.getCommunityUser().getUserEmail(),
-                readCertificateCredential.getCommunityUser().getUserEmail());
-        assertEquals(
-                certificateCredential.getCommunityUser().getUserName(),
-                readCertificateCredential.getCommunityUser().getUserName());
-        assertEquals(certificateCredential.getLifeTime(), readCertificateCredential.getLifeTime());
-        assertEquals(certificateCredential.getNotAfter(), readCertificateCredential.getNotAfter());
-        assertEquals(certificateCredential.getNotBefore(), readCertificateCredential.getNotBefore());
-        assertEquals(certificateCredential.getPortalUserName(), readCertificateCredential.getPortalUserName());
-        assertEquals(
-                certificateCredential.getCredentialOwnerType(), readCertificateCredential.getCredentialOwnerType());
-
-        PrivateKey newKey = readCertificateCredential.getPrivateKey();
-
-        assertNotNull(newKey);
-        assertEquals(privateKey.getClass(), newKey.getClass());
-
-        assertEquals(privateKey.getFormat(), newKey.getFormat());
-        assertEquals(privateKey.getAlgorithm(), newKey.getAlgorithm());
-        assertTrue(Arrays.equals(privateKey.getEncoded(), newKey.getEncoded()));
-    }
-
-    private class TestACSKeyStoreCallback implements KeyStorePasswordCallback {
-
-        @Override
-        public char[] getStorePassword() {
-            return "airavata".toCharArray();
-        }
-
-        @Override
-        public char[] getSecretKeyPassPhrase(String keyAlias) {
-            if (keyAlias.equals("mykey")) {
-                return "airavatasecretkey".toCharArray();
-            }
-
-            return null;
-        }
-    }
-
-    private void checkEquality(X509Certificate[] certificates1, X509Certificate[] certificates2) {
-
-        int i = 0;
-
-        for (X509Certificate certificate : certificates1) {
-            assertEquals(certificate, certificates2[i]);
-        }
-
-        assertEquals(certificates1.length, certificates2.length);
-    }
-
-    @Test
-    public void testAddCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential =
-                    (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-            // Test get gateway name
-            String gateway = credentialsDAO.getGatewayID("tom", connection);
-            assertNotNull(certificateCredential);
-            assertEquals("jerry", certificateCredential.getPortalUserName());
-            assertEquals("gw1", gateway);
-            checkEquality(x509Certificates, certificateCredential.getCertificates());
-            assertEquals(
-                    privateKey.getFormat(),
-                    certificateCredential.getPrivateKey().getFormat());
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testDeleteCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CertificateCredential certificateCredential =
-                    (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-            assertNotNull(certificateCredential);
-
-            credentialsDAO.deleteCredentials("gw1", "tom", connection);
-
-            certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-            assertNull(certificateCredential);
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testUpdateCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            CommunityUser communityUser = getCommunityUser("gw1", "tom");
-            CertificateCredential certificateCredential = new CertificateCredential();
-            certificateCredential.setToken("tom");
-            certificateCredential.setCommunityUser(communityUser);
-            certificateCredential.setCertificates(x509Certificates);
-            // certificateCredential.setPrivateKey(privateKey);
-            certificateCredential.setPortalUserName("test2");
-            certificateCredential.setLifeTime(50);
-            certificateCredential.setNotBefore("15 OCT 2012 5:34:23");
-            certificateCredential.setNotAfter("16 OCT 2012 5:34:23");
-            certificateCredential.setCredentialOwnerType(CredentialOwnerType.USER);
-
-            credentialsDAO.updateCredentials(communityUser.getGatewayName(), certificateCredential, connection);
-
-            certificateCredential = (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-
-            assertEquals(
-                    "CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
-                    certificateCredential.getCertificates()[0].getIssuerDN().toString());
-            // Assertions.assertNotNull(certificateCredential.getPrivateKey());
-            assertEquals("test2", certificateCredential.getPortalUserName());
-            assertEquals(CredentialOwnerType.USER, certificateCredential.getCredentialOwnerType());
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-
-            CertificateCredential certificateCredential =
-                    (CertificateCredential) credentialsDAO.getCredential("gw1", "tom", connection);
-            assertEquals(
-                    "CN=Airavata Project, OU=IU, O=Indiana University, L=Bloomington, ST=IN, C=US",
-                    certificateCredential.getCertificates()[0].getIssuerDN().toString());
-            // Assertions.assertNotNull(certificateCredential.getPrivateKey());
-
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetGatewayCredentials() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            List<Credential> list = credentialsDAO.getCredentials("gw1", connection);
-
-            assertEquals(2, list.size());
-        } finally {
-            connection.close();
-        }
-    }
-
-    @Test
-    public void testGetGatewayCredentialsForAccessibleTokenIds() throws Exception {
-
-        addTestCredentials();
-
-        Connection connection = getConnection();
-
-        try {
-            List<Credential> list = credentialsDAO.getCredentials("gw1", Arrays.asList("tom"), connection);
-
-            assertEquals(1, list.size());
-            list = credentialsDAO.getCredentials("gw1", Arrays.asList("tom", "tom2"), connection);
-            assertEquals(2, list.size());
-            list = credentialsDAO.getCredentials("gw1", Arrays.asList("tom2"), connection);
-            assertEquals(1, list.size());
-            list = credentialsDAO.getCredentials("gw1", Arrays.asList("non-existent-token-id"), connection);
-            assertEquals(0, list.size());
-            list = credentialsDAO.getCredentials("gw1", Arrays.asList(), connection);
-            assertEquals(0, list.size());
-            list = credentialsDAO.getCredentials("gw1", null, connection);
-            assertEquals(0, list.size());
-        } finally {
-            connection.close();
-        }
-    }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java b/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java
deleted file mode 100644
index d56869ac63..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/security/userstore/JDBCUserStoreTest.java
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.security.userstore;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.apache.airavata.security.UserStore;
-import org.junit.jupiter.api.*;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * Test class for JDBC user store.
- */
-public class JDBCUserStoreTest extends DatabaseTestCases {
-
-    /**
-     * <specificConfigurations>
-     * <database>
-     * <!--jdbcUrl>jdbc:h2:modules/commons/airavata-registry-rest/src/test/resources/testdb/test</jdbcUrl-->
-     * <jdbcUrl>jdbc:h2:src/test/resources/testdb/test</jdbcUrl>
-     * <userName>sa</userName>
-     * <password>sa</password>
-     * <databaseDriver>org.h2.Driver</databaseDriver>
-     * <userTableName>AIRAVATA_USER</userTableName>
-     * <userNameColumnName>USERID</userNameColumnName>
-     * <passwordColumnName>PASSWORD</passwordColumnName>
-     * </database>
-     * </specificConfigurations>
-     * @throws Exception
-     */
-    @BeforeAll
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-
-        waitTillServerStarts();
-
-        String dropTable = "drop table AIRAVATA_USER";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        String createTable = "create table AIRAVATA_USER ( USERID varchar(255), PASSWORD varchar(255) )";
-        executeSQL(createTable);
-
-        String insertSQL = "INSERT INTO AIRAVATA_USER VALUES('amilaj', 'secret')";
-        executeSQL(insertSQL);
-    }
-
-    @AfterAll
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @BeforeEach
-    public void setUp() throws Exception {}
-
-    @Test
-    public void testAuthenticate() throws Exception {
-
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-        Document doc = dBuilder.parse(this.getClass().getClassLoader().getResourceAsStream("jdbc-authenticator.xml"));
-        doc.getDocumentElement().normalize();
-
-        NodeList configurations = doc.getElementsByTagName("specificConfigurations");
-        UserStore userStore = new JDBCUserStore();
-        userStore.configure(configurations.item(0));
-
-        assertTrue(userStore.authenticate("amilaj", "secret"));
-        assertFalse(userStore.authenticate("amilaj", "1secret"));
-        assertFalse(userStore.authenticate("lahiru", "1234"));
-    }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java b/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java
deleted file mode 100644
index aa3b448051..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/security/userstore/SessionDBUserStoreTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.security.userstore;
-
-import static org.junit.jupiter.api.Assertions.*;
-
-import java.io.InputStream;
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import org.apache.airavata.common.utils.DatabaseTestCases;
-import org.apache.airavata.common.utils.DerbyUtil;
-import org.junit.jupiter.api.*;
-import org.w3c.dom.Document;
-import org.w3c.dom.NodeList;
-
-/**
- * Test class for session DB authenticator.
- */
-public class SessionDBUserStoreTest extends DatabaseTestCases {
-
-    @BeforeAll
-    public static void setUpDatabase() throws Exception {
-        DerbyUtil.startDerbyInServerMode(getHostAddress(), getPort(), getUserName(), getPassword());
-
-        waitTillServerStarts();
-
-        String dropTable = "drop table Persons";
-
-        try {
-            executeSQL(dropTable);
-        } catch (Exception e) {
-        }
-
-        String createTable = "create table Persons ( sessionId varchar(255) )";
-        executeSQL(createTable);
-
-        String insertSQL = "INSERT INTO Persons VALUES('1234')";
-        executeSQL(insertSQL);
-    }
-
-    @AfterAll
-    public static void shutDownDatabase() throws Exception {
-        DerbyUtil.stopDerbyServer();
-    }
-
-    @BeforeEach
-    public void setUp() throws Exception {
-
-        loadConfigurations();
-    }
-
-    private SessionDBUserStore sessionDBUserStore = new SessionDBUserStore();
-
-    private InputStream configurationFileStream =
-            this.getClass().getClassLoader().getResourceAsStream("session-authenticator.xml");
-
-    private void loadConfigurations() throws Exception {
-        DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
-        DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
-        Document doc = dBuilder.parse(configurationFileStream);
-        doc.getDocumentElement().normalize();
-
-        NodeList specificConfigurations = doc.getElementsByTagName("specificConfigurations");
-        sessionDBUserStore.configure(specificConfigurations.item(0));
-    }
-
-    @Test
-    public void testAuthenticate() throws Exception {
-        assertTrue(sessionDBUserStore.authenticate("1234"));
-    }
-
-    @Test
-    public void testAuthenticateFailure() throws Exception {
-        assertFalse(sessionDBUserStore.authenticate("12345"));
-    }
-}
diff --git a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java b/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
deleted file mode 100644
index 650bee7430..0000000000
--- a/airavata-api/src/test/java/org/apache/airavata/sharing/registry/SharingRegistryServiceTest.java
+++ /dev/null
@@ -1,432 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.sharing.registry;
-
-import java.util.ArrayList;
-import java.util.List;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.sharing.registry.models.*;
-import org.apache.airavata.sharing.registry.server.SharingRegistryServer;
-import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
-import org.apache.thrift.TException;
-import org.apache.thrift.protocol.TBinaryProtocol;
-import org.apache.thrift.protocol.TProtocol;
-import org.apache.thrift.transport.TSSLTransportFactory;
-import org.apache.thrift.transport.TSocket;
-import org.apache.thrift.transport.TTransport;
-import org.junit.jupiter.api.Assertions;
-import org.junit.jupiter.api.BeforeAll;
-import org.junit.jupiter.api.Test;
-
-public class SharingRegistryServiceTest {
-
-    @BeforeAll
-    public static void setUp() throws Exception {
-        SharingRegistryServer server = new SharingRegistryServer();
-        server.setTestMode(true);
-        server.start();
-        Thread.sleep(1000 * 2);
-    }
-
-    @Test
-    public void test() throws TException, InterruptedException, ApplicationSettingsException {
-        String serverHost = "localhost";
-        int serverPort = 7878;
-        TTransport transport;
-
-        SharingRegistryService.Client sharingServiceClient;
-        if (!ServerSettings.isTLSEnabled()) {
-            transport = new TSocket(serverHost, serverPort);
-            transport.open();
-        } else {
-            TSSLTransportFactory.TSSLTransportParameters params = new TSSLTransportFactory.TSSLTransportParameters();
-            params.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
-            transport = TSSLTransportFactory.getClientSocket(serverHost, serverPort, 10000, params);
-        }
-
-        TProtocol protocol = new TBinaryProtocol(transport);
-        sharingServiceClient = new SharingRegistryService.Client(protocol);
-
-        Domain domain = new Domain();
-        // has to be one word
-        domain.setName("test-domain" + Math.random());
-        // optional
-        domain.setDescription("test domain description");
-
-        String domainId = sharingServiceClient.createDomain(domain);
-        Assertions.assertTrue(sharingServiceClient.isDomainExists(domainId));
-
-        User user1 = new User();
-        // required
-        user1.setUserId("test-user-1");
-        // required
-        user1.setUserName("test-user-1");
-        // required
-        user1.setDomainId(domainId);
-        // required
-        user1.setFirstName("John");
-        // required
-        user1.setLastName("Doe");
-        // required
-        user1.setEmail("john.doe@abc.com");
-        // optional - this should be bytes of the users image icon
-        // byte[] icon1 = new byte[10];
-        // user1.setIcon(icon1);
-
-        sharingServiceClient.createUser(user1);
-        Assertions.assertTrue(sharingServiceClient.isUserExists(domainId, "test-user-1"));
-
-        User user2 = new User();
-        // required
-        user2.setUserId("test-user-2");
-        // required
-        user2.setUserName("test-user-2");
-        // required
-        user2.setDomainId(domainId);
-        // required
-        user2.setFirstName("John");
-        // required
-        user2.setLastName("Doe");
-        // required
-        user2.setEmail("john.doe@abc.com");
-        // optional - this should be bytes of the users image icon
-        // byte[] icon2 = new byte[10];
-        // user2.setIcon(icon2);
-
-        sharingServiceClient.createUser(user2);
-
-        User user3 = new User();
-        // required
-        user3.setUserId("test-user-3");
-        // required
-        user3.setUserName("test-user-3");
-        // required
-        user3.setDomainId(domainId);
-        // required
-        user3.setFirstName("John");
-        // required
-        user3.setLastName("Doe");
-        // required
-        user3.setEmail("john.doe@abc.com");
-        // optional - this should be bytes of the users image icon
-        // byte[] icon3 = new byte[10];
-        // user3.setIcon(icon3);
-
-        sharingServiceClient.createUser(user3);
-
-        User user7 = new User();
-        // required
-        user7.setUserId("test-user-7");
-        // required
-        user7.setUserName("test-user-7");
-        // required
-        user7.setDomainId(domainId);
-        // required
-        user7.setFirstName("John");
-        // required
-        user7.setLastName("Doe");
-        // required
-        user7.setEmail("john.doe@abc.com");
-        // optional - this should be bytes of the users image icon
-        // byte[] icon3 = new byte[10];
-        // user3.setIcon(icon3);
-
-        sharingServiceClient.createUser(user7);
-
-        // Test updates to user and how it affects the user's SINGLE_USER group
-        UserGroup singleUserGroupUser7 = sharingServiceClient.getGroup(domainId, user7.getUserId());
-        Assertions.assertEquals(GroupCardinality.SINGLE_USER, singleUserGroupUser7.getGroupCardinality());
-        user7.setFirstName("Johnny");
-        sharingServiceClient.updatedUser(user7);
-        User updatedUser7 = sharingServiceClient.getUser(domainId, user7.getUserId());
-        Assertions.assertEquals("Johnny", updatedUser7.getFirstName());
-        singleUserGroupUser7 = sharingServiceClient.getGroup(domainId, user7.getUserId());
-        Assertions.assertEquals(GroupCardinality.SINGLE_USER, singleUserGroupUser7.getGroupCardinality());
-
-        UserGroup userGroup1 = new UserGroup();
-        // required
-        userGroup1.setGroupId("test-group-1");
-        // required
-        userGroup1.setDomainId(domainId);
-        // required
-        userGroup1.setName("test-group-1");
-        // optional
-        userGroup1.setDescription("test group description");
-        // required
-        userGroup1.setOwnerId("test-user-1");
-        // required
-        userGroup1.setGroupType(GroupType.USER_LEVEL_GROUP);
-
-        sharingServiceClient.createGroup(userGroup1);
-        userGroup1.setDescription("updated description");
-        sharingServiceClient.updateGroup(userGroup1);
-        Assertions.assertEquals(
-                "updated description",
-                sharingServiceClient.getGroup(domainId, userGroup1.getGroupId()).getDescription());
-        Assertions.assertTrue(sharingServiceClient.isGroupExists(domainId, "test-group-1"));
-
-        UserGroup userGroup2 = new UserGroup();
-        // required
-        userGroup2.setGroupId("test-group-2");
-        // required
-        userGroup2.setDomainId(domainId);
-        // required
-        userGroup2.setName("test-group-2");
-        // optional
-        userGroup2.setDescription("test group description");
-        // required
-        userGroup2.setOwnerId("test-user-2");
-        // required
-        userGroup2.setGroupType(GroupType.USER_LEVEL_GROUP);
-
-        sharingServiceClient.createGroup(userGroup2);
-
-        sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-3"), "test-group-2");
-
-        sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-7"), "test-group-1");
-
-        sharingServiceClient.addChildGroupsToParentGroup(domainId, List.of("test-group-2"), "test-group-1");
-
-        // Group roles
-        Assertions.assertTrue(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-1"));
-
-        // user has admin access
-        Assertions.assertTrue(sharingServiceClient.addGroupAdmins(domainId, "test-group-1", List.of("test-user-7")));
-        Assertions.assertTrue(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-7"));
-
-        UserGroup getGroup = sharingServiceClient.getGroup(domainId, "test-group-1");
-        Assertions.assertEquals(1, getGroup.getGroupAdmins().size());
-
-        Assertions.assertTrue(sharingServiceClient.removeGroupAdmins(domainId, "test-group-1", List.of("test-user-7")));
-        Assertions.assertFalse(sharingServiceClient.hasAdminAccess(domainId, "test-group-1", "test-user-7"));
-
-        // transfer group ownership
-        sharingServiceClient.addUsersToGroup(domainId, List.of("test-user-2"), "test-group-1");
-        Assertions.assertTrue(sharingServiceClient.transferGroupOwnership(domainId, "test-group-1", "test-user-2"));
-        Assertions.assertTrue(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-2"));
-        Assertions.assertTrue(sharingServiceClient.transferGroupOwnership(domainId, "test-group-1", "test-user-1"));
-        Assertions.assertFalse(sharingServiceClient.hasOwnerAccess(domainId, "test-group-1", "test-user-2"));
-
-        PermissionType permissionType1 = new PermissionType();
-        // required
-        permissionType1.setPermissionTypeId("READ");
-        // required
-        permissionType1.setDomainId(domainId);
-        // required
-        permissionType1.setName("READ");
-        // optional
-        permissionType1.setDescription("READ description");
-        sharingServiceClient.createPermissionType(permissionType1);
-        Assertions.assertTrue(sharingServiceClient.isPermissionExists(domainId, "READ"));
-
-        PermissionType permissionType2 = new PermissionType();
-        permissionType2.setPermissionTypeId("WRITE");
-        permissionType2.setDomainId(domainId);
-        permissionType2.setName("WRITE");
-        permissionType2.setDescription("WRITE description");
-        sharingServiceClient.createPermissionType(permissionType2);
-
-        PermissionType permissionType3 = new PermissionType();
-        permissionType3.setPermissionTypeId("CLONE");
-        permissionType3.setDomainId(domainId);
-        permissionType3.setName("CLONE");
-        permissionType3.setDescription("CLONE description");
-        sharingServiceClient.createPermissionType(permissionType3);
-
-        EntityType entityType1 = new EntityType();
-        // required
-        entityType1.setEntityTypeId("PROJECT");
-        // required
-        entityType1.setDomainId(domainId);
-        // required
-        entityType1.setName("PROJECT");
-        // optional
-        entityType1.setDescription("PROJECT entity type description");
-        sharingServiceClient.createEntityType(entityType1);
-        Assertions.assertTrue(sharingServiceClient.isEntityTypeExists(domainId, "PROJECT"));
-
-        EntityType entityType2 = new EntityType();
-        entityType2.setEntityTypeId("EXPERIMENT");
-        entityType2.setDomainId(domainId);
-        entityType2.setName("EXPERIMENT");
-        entityType2.setDescription("EXPERIMENT entity type");
-        sharingServiceClient.createEntityType(entityType2);
-
-        EntityType entityType3 = new EntityType();
-        entityType3.setEntityTypeId("FILE");
-        entityType3.setDomainId(domainId);
-        entityType3.setName("FILE");
-        entityType3.setDescription("FILE entity type");
-        sharingServiceClient.createEntityType(entityType3);
-
-        // Creating entities
-        Entity entity1 = new Entity();
-        // required
-        entity1.setEntityId("test-project-1");
-        // required
-        entity1.setDomainId(domainId);
-        // required
-        entity1.setEntityTypeId("PROJECT");
-        // required
-        entity1.setOwnerId("test-user-1");
-        // required
-        entity1.setName("test-project-1");
-        // optional
-        entity1.setDescription("test project 1 description");
-        // optional
-        entity1.setFullText("test project 1 stampede gaussian seagrid");
-        // optional - If not set this will be default to current system time
-        entity1.setOriginalEntityCreationTime(System.currentTimeMillis());
-        sharingServiceClient.createEntity(entity1);
-        Assertions.assertTrue(sharingServiceClient.isEntityExists(domainId, "test-project-1"));
-
-        Entity entity2 = new Entity();
-        entity2.setEntityId("test-experiment-1");
-        entity2.setDomainId(domainId);
-        entity2.setEntityTypeId("EXPERIMENT");
-        entity2.setOwnerId("test-user-1");
-        entity2.setName("test-experiment-1");
-        entity2.setDescription("test experiment 1 description");
-        entity2.setParentEntityId("test-project-1");
-        entity2.setFullText("test experiment 1 benzene");
-        sharingServiceClient.createEntity(entity2);
-
-        Entity entity3 = new Entity();
-        entity3.setEntityId("test-experiment-2");
-        entity3.setDomainId(domainId);
-        entity3.setEntityTypeId("EXPERIMENT");
-        entity3.setOwnerId("test-user-1");
-        entity3.setName("test-experiment-2");
-        entity3.setDescription("test experiment 2 description");
-        entity3.setParentEntityId("test-project-1");
-        entity3.setFullText("test experiment 1 3-methyl 1-butanol stampede");
-        sharingServiceClient.createEntity(entity3);
-
-        Entity entity4 = new Entity();
-        entity4.setEntityId("test-file-1");
-        entity4.setDomainId(domainId);
-        entity4.setEntityTypeId("FILE");
-        entity4.setOwnerId("test-user-1");
-        entity4.setName("test-file-1");
-        entity4.setDescription("test file 1 description");
-        entity4.setParentEntityId("test-experiment-2");
-        entity4.setFullText("test input file 1 for experiment 2");
-        sharingServiceClient.createEntity(entity4);
-
-        Assertions.assertEquals(
-                0, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount());
-        sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE", true);
-        Assertions.assertEquals(
-                1, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount());
-        ArrayList<SearchCriteria> filters = new ArrayList<>();
-        SearchCriteria searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchField(EntitySearchField.SHARED_COUNT);
-        searchCriteria.setValue("1");
-        searchCriteria.setSearchCondition(SearchCondition.GTE);
-        filters.add(searchCriteria);
-        Assertions.assertEquals(
-                1,
-                sharingServiceClient
-                        .searchEntities(domainId, "test-user-2", filters, 0, -1)
-                        .size());
-
-        sharingServiceClient.revokeEntitySharingFromUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE");
-        Assertions.assertEquals(
-                0, sharingServiceClient.getEntity(domainId, "test-project-1").getSharedCount());
-        sharingServiceClient.shareEntityWithUsers(domainId, "test-project-1", List.of("test-user-2"), "WRITE", true);
-
-        sharingServiceClient.shareEntityWithGroups(
-                domainId, "test-experiment-2", List.of("test-group-2"), "READ", true);
-        sharingServiceClient.shareEntityWithGroups(
-                domainId, "test-experiment-2", List.of("test-group-2"), "CLONE", false);
-
-        // true
-        Assertions.assertTrue(sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-project-1", "WRITE"));
-        // true
-        Assertions.assertTrue(
-                sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-experiment-1", "WRITE"));
-        // true
-        Assertions.assertTrue(
-                sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-experiment-2", "WRITE"));
-
-        // false
-        Assertions.assertFalse(
-                sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-experiment-1", "READ"));
-        // true
-        Assertions.assertTrue(sharingServiceClient.userHasAccess(domainId, "test-user-2", "test-experiment-2", "READ"));
-
-        // false
-        Assertions.assertFalse(sharingServiceClient.userHasAccess(domainId, "test-user-3", "test-project-1", "READ"));
-        // true
-        Assertions.assertTrue(sharingServiceClient.userHasAccess(domainId, "test-user-3", "test-experiment-2", "READ"));
-        // false
-        Assertions.assertFalse(
-                sharingServiceClient.userHasAccess(domainId, "test-user-3", "test-experiment-2", "WRITE"));
-
-        // true
-        Assertions.assertTrue(
-                (sharingServiceClient.userHasAccess(domainId, "test-user-3", "test-experiment-2", "CLONE")));
-        // false
-        Assertions.assertFalse((sharingServiceClient.userHasAccess(domainId, "test-user-3", "test-file-1", "CLONE")));
-
-        filters = new ArrayList<>();
-        searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchCondition(SearchCondition.FULL_TEXT);
-        searchCriteria.setValue("experiment");
-        searchCriteria.setSearchField(EntitySearchField.FULL_TEXT);
-        filters.add(searchCriteria);
-
-        searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchCondition(SearchCondition.EQUAL);
-        searchCriteria.setValue("EXPERIMENT");
-        searchCriteria.setSearchField(EntitySearchField.ENTITY_TYPE_ID);
-        filters.add(searchCriteria);
-
-        searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchCondition(SearchCondition.EQUAL);
-        searchCriteria.setValue("READ");
-        searchCriteria.setSearchField(EntitySearchField.PERMISSION_TYPE_ID);
-        filters.add(searchCriteria);
-
-        Assertions.assertEquals(
-                1,
-                sharingServiceClient
-                        .searchEntities(domainId, "test-user-2", filters, 0, -1)
-                        .size());
-        Entity persistedEntity = sharingServiceClient
-                .searchEntities(domainId, "test-user-2", filters, 0, -1)
-                .get(0);
-        Assertions.assertEquals(entity3.getName(), persistedEntity.getName());
-        Assertions.assertEquals(entity3.getDescription(), persistedEntity.getDescription());
-        Assertions.assertEquals(entity3.getFullText(), persistedEntity.getFullText());
-
-        searchCriteria = new SearchCriteria();
-        searchCriteria.setSearchCondition(SearchCondition.NOT);
-        searchCriteria.setValue("test-user-1");
-        searchCriteria.setSearchField(EntitySearchField.OWNER_ID);
-        filters.add(searchCriteria);
-        Assertions.assertEquals(
-                0,
-                sharingServiceClient
-                        .searchEntities(domainId, "test-user-2", filters, 0, -1)
-                        .size());
-    }
-}


(airavata) 04/06: refactor: remove old per-service server classes and startup scripts

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 15293bbb0b6ef6ab6d0eed0a58551c1b71d99144
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Mar 25 23:53:53 2026 -0500

    refactor: remove old per-service server classes and startup scripts
    
    Delete ServerMain, RegistryAPIServer, SharingRegistryServer,
    CredentialStoreServer, AiravataAPIServer and the nine per-service shell
    scripts (orchestrator, controller, participant, sharing-registry, etc.)
    now that AiravataUnifiedServer consolidates all Thrift services in a
    single JVM.
    
    Add airavata.sh as the single entry-point startup script.
    
    Fix SharingServiceDBEventHandler to inline the two string constants that
    were imported from the deleted SharingRegistryServer class.
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../airavata/api/server/AiravataAPIServer.java     | 200 ----------
 .../store/server/CredentialStoreServer.java        | 148 -------
 .../registry/api/service/RegistryAPIServer.java    | 192 ----------
 .../org/apache/airavata/server/ServerMain.java     | 425 ---------------------
 .../messaging/SharingServiceDBEventHandler.java    |   5 +-
 .../sharing/registry/server/ServerMain.java        | 106 -----
 .../registry/server/SharingRegistryServer.java     | 183 ---------
 .../main/resources/distribution/bin/airavata.sh    |   5 +
 .../main/resources/distribution/bin/controller.sh  |  26 --
 .../resources/distribution/bin/email-monitor.sh    |  26 --
 .../resources/distribution/bin/orchestrator.sh     |  54 ---
 .../main/resources/distribution/bin/parser-wm.sh   |  26 --
 .../main/resources/distribution/bin/participant.sh |  26 --
 .../src/main/resources/distribution/bin/post-wm.sh |  26 --
 .../src/main/resources/distribution/bin/pre-wm.sh  |  26 --
 .../resources/distribution/bin/realtime-monitor.sh |  26 --
 .../resources/distribution/bin/sharing-registry.sh |  26 --
 17 files changed, 7 insertions(+), 1519 deletions(-)

diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
deleted file mode 100644
index 928d722d69..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataAPIServer.java
+++ /dev/null
@@ -1,200 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.api.server;
-
-import com.google.inject.Guice;
-import com.google.inject.Injector;
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import java.net.UnknownHostException;
-import org.apache.airavata.api.Airavata;
-import org.apache.airavata.api.server.handler.AiravataServerHandler;
-import org.apache.airavata.api.server.util.Constants;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.model.error.AiravataErrorType;
-import org.apache.airavata.model.error.AiravataSystemException;
-import org.apache.airavata.service.security.interceptor.SecurityModule;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TSSLTransportFactory;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class AiravataAPIServer implements IServer {
-
-    private static final Logger logger = LoggerFactory.getLogger(AiravataAPIServer.class);
-    private static final String SERVER_NAME = "Airavata API Server";
-    private static final String SERVER_VERSION = "1.0";
-
-    private ServerStatus status;
-
-    private TServer server, TLSServer;
-
-    public AiravataAPIServer() {
-        setStatus(ServerStatus.STOPPED);
-    }
-
-    public void startAiravataServer(Airavata.Processor<Airavata.Iface> airavataAPIServer)
-            throws AiravataSystemException {
-        try {
-            final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST, null);
-            final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT, "8930"));
-
-            if (!ServerSettings.isTLSEnabled()) {
-                TServerTransport serverTransport;
-                if (serverHost == null) {
-                    serverTransport = new TServerSocket(serverPort);
-                } else {
-                    InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
-                    serverTransport = new TServerSocket(inetSocketAddress);
-                }
-                TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
-                options.minWorkerThreads =
-                        Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50"));
-                server = new TThreadPoolServer(options.processor(airavataAPIServer));
-                new Thread(() -> {
-                            server.serve();
-                            setStatus(ServerStatus.STOPPED);
-                            logger.info("Airavata API Server Stopped.");
-                        })
-                        .start();
-                new Thread(() -> {
-                            while (!server.isServing()) {
-                                try {
-                                    Thread.sleep(500);
-                                } catch (InterruptedException e) {
-                                    break;
-                                }
-                            }
-                            if (server.isServing()) {
-                                setStatus(ServerStatus.STARTED);
-                                logger.info("Starting Airavata API Server on Port " + serverPort);
-                                logger.info("Listening to Airavata Clients ....");
-                            }
-                        })
-                        .start();
-                logger.info("Started API Server ....");
-            } else {
-                var TLSParams = new TSSLTransportFactory.TSSLTransportParameters();
-                TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
-                var TLSServerTransport = TSSLTransportFactory.getServerSocket(
-                        serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams);
-                TThreadPoolServer.Args settings = new TThreadPoolServer.Args(TLSServerTransport);
-                settings.minWorkerThreads =
-                        Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50"));
-                TLSServer = new TThreadPoolServer(settings.processor(airavataAPIServer));
-                new Thread(() -> {
-                            TLSServer.serve();
-                            setStatus(ServerStatus.STOPPED);
-                            logger.info("Airavata API Server over TLS Stopped.");
-                        })
-                        .start();
-                new Thread(() -> {
-                            while (!TLSServer.isServing()) {
-                                try {
-                                    Thread.sleep(500);
-                                } catch (InterruptedException e) {
-                                    break;
-                                }
-                            }
-                            if (TLSServer.isServing()) {
-                                setStatus(ServerStatus.STARTED);
-                            }
-                        })
-                        .start();
-                logger.info("API server started over TLS on Port: " + serverPort + " ...");
-            }
-
-        } catch (TTransportException | ApplicationSettingsException | UnknownHostException e) {
-            logger.error("Failed to start API server ...", e);
-            setStatus(ServerStatus.FAILED);
-            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
-        }
-    }
-
-    public static void main(String[] args) {
-        try {
-            AiravataAPIServer server = new AiravataAPIServer();
-            server.start();
-        } catch (Exception e) {
-            logger.error("Error while initializing Airavata API server", e);
-        }
-    }
-
-    @Override
-    public void start() throws Exception {
-        setStatus(ServerStatus.STARTING);
-        // Obtain a AiravataServerHandl
-        // er object from Guice which is wrapped with interception logic.
-        Injector injector = Guice.createInjector(new SecurityModule());
-        Airavata.Processor<Airavata.Iface> airavataAPIServer =
-                new Airavata.Processor<Airavata.Iface>(injector.getInstance(AiravataServerHandler.class));
-        startAiravataServer(airavataAPIServer);
-    }
-
-    @Override
-    public void stop() throws Exception {
-        if ((!ServerSettings.isTLSEnabled()) && server.isServing()) {
-            setStatus(ServerStatus.STOPING);
-            server.stop();
-        }
-        // stop the Airavata API server hosted over TLS.
-        if ((ServerSettings.isTLSEnabled()) && TLSServer.isServing()) {
-            TLSServer.stop();
-        }
-    }
-
-    @Override
-    public void restart() throws Exception {
-        stop();
-        start();
-    }
-
-    @Override
-    public void configure() throws Exception {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public ServerStatus getStatus() throws Exception {
-        return status;
-    }
-
-    private void setStatus(ServerStatus stat) {
-        status = stat;
-        status.updateTime();
-    }
-
-    @Override
-    public String getName() {
-        return SERVER_NAME;
-    }
-
-    @Override
-    public String getVersion() {
-        return SERVER_VERSION;
-    }
-}
diff --git a/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java b/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
deleted file mode 100644
index 24994de8b5..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/credential/store/server/CredentialStoreServer.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.credential.store.server;
-
-import java.net.InetSocketAddress;
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.credential.store.cpi.CredentialStoreService;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CredentialStoreServer implements IServer {
-    private static final Logger logger = LoggerFactory.getLogger(CredentialStoreServer.class);
-    private static final String SERVER_NAME = "Credential Store Server";
-    private static final String SERVER_VERSION = "1.0";
-
-    private IServer.ServerStatus status;
-    private TServer server;
-
-    public CredentialStoreServer() {
-        setStatus(IServer.ServerStatus.STOPPED);
-    }
-
-    @Override
-    public String getName() {
-        return SERVER_NAME;
-    }
-
-    @Override
-    public String getVersion() {
-        return SERVER_VERSION;
-    }
-
-    @Override
-    public void start() throws Exception {
-        try {
-            setStatus(ServerStatus.STARTING);
-            final int serverPort = Integer.parseInt(ServerSettings.getCredentialStoreServerPort());
-            final String serverHost = ServerSettings.getCredentialStoreServerHost();
-            CredentialStoreService.Processor processor =
-                    new CredentialStoreService.Processor(new CredentialStoreServerHandler());
-
-            TServerTransport serverTransport;
-
-            if (serverHost == null) {
-                serverTransport = new TServerSocket(serverPort);
-            } else {
-                InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
-                serverTransport = new TServerSocket(inetSocketAddress);
-            }
-            TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
-            options.minWorkerThreads = 30;
-            server = new TThreadPoolServer(options.processor(processor));
-
-            new Thread() {
-                public void run() {
-                    server.serve();
-                    setStatus(ServerStatus.STOPPED);
-                    logger.info("Credential store Server Stopped.");
-                }
-            }.start();
-            new Thread() {
-                public void run() {
-                    while (!server.isServing()) {
-                        try {
-                            Thread.sleep(500);
-                        } catch (InterruptedException e) {
-                            break;
-                        }
-                    }
-                    if (server.isServing()) {
-                        setStatus(ServerStatus.STARTED);
-                        logger.info("Starting Credential store Server on Port " + serverPort);
-                        logger.info("Listening to Credential store clients ....");
-                    }
-                }
-            }.start();
-        } catch (TTransportException e) {
-            setStatus(ServerStatus.FAILED);
-            throw new Exception("Error while starting the credential store service", e);
-        }
-    }
-
-    public static void main(String[] args) {
-        try {
-            new CredentialStoreServer().start();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public void stop() throws Exception {
-        if (server != null && server.isServing()) {
-            setStatus(ServerStatus.STOPING);
-            server.stop();
-        }
-    }
-
-    @Override
-    public void restart() throws Exception {
-        stop();
-        start();
-    }
-
-    @Override
-    public void configure() throws Exception {}
-
-    @Override
-    public ServerStatus getStatus() throws Exception {
-        return status;
-    }
-
-    private void setStatus(IServer.ServerStatus stat) {
-        status = stat;
-        status.updateTime();
-    }
-
-    public TServer getServer() {
-        return server;
-    }
-
-    public void setServer(TServer server) {
-        this.server = server;
-    }
-}
diff --git a/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java b/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
deleted file mode 100644
index b68e353290..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/registry/api/service/RegistryAPIServer.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.registry.api.service;
-
-import java.net.InetSocketAddress;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.airavata.common.utils.DBInitConfig;
-import org.apache.airavata.common.utils.DBInitializer;
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.registry.api.RegistryService;
-import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
-import org.apache.airavata.registry.api.service.messaging.RegistryServiceDBEventMessagingFactory;
-import org.apache.airavata.registry.api.service.util.Constants;
-import org.apache.airavata.registry.core.utils.AppCatalogDBInitConfig;
-import org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig;
-import org.apache.airavata.registry.core.utils.ReplicaCatalogDBInitConfig;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class RegistryAPIServer implements IServer {
-    private static final Logger logger = LoggerFactory.getLogger(RegistryAPIServer.class);
-
-    private static final String SERVER_NAME = "Registry API Server";
-    private static final String SERVER_VERSION = "1.0";
-
-    private ServerStatus status;
-
-    private TServer server;
-
-    private List<DBInitConfig> dbInitConfigs =
-            Arrays.asList(new ExpCatalogDBInitConfig(), new AppCatalogDBInitConfig(), new ReplicaCatalogDBInitConfig());
-
-    public RegistryAPIServer() {
-        setStatus(ServerStatus.STOPPED);
-    }
-
-    public void StartRegistryServer(RegistryService.Processor<RegistryServerHandler> orchestratorServerHandlerProcessor)
-            throws Exception {
-
-        logger.info("Initializing databases...");
-        for (DBInitConfig dbInitConfig : dbInitConfigs) {
-            DBInitializer.initializeDB(dbInitConfig);
-        }
-        logger.info("Databases initialized successfully");
-
-        final int serverPort = Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_PORT, "8960"));
-        try {
-            final String serverHost = ServerSettings.getSetting(Constants.REGISTRY_SERVER_HOST, null);
-            TServerTransport serverTransport;
-            if (serverHost == null) {
-                serverTransport = new TServerSocket(serverPort);
-            } else {
-                InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
-                serverTransport = new TServerSocket(inetSocketAddress);
-            }
-
-            // thrift server start
-            TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
-            options.minWorkerThreads =
-                    Integer.parseInt(ServerSettings.getSetting(Constants.REGISTRY_SERVER_MIN_THREADS, "30"));
-            server = new TThreadPoolServer(options.processor(orchestratorServerHandlerProcessor));
-            new Thread() {
-                public void run() {
-                    server.serve();
-                    setStatus(ServerStatus.STOPPED);
-                    logger.info("Registry Server Stopped.");
-                }
-            }.start();
-            new Thread() {
-                public void run() {
-                    while (!server.isServing()) {
-                        try {
-                            Thread.sleep(500);
-                        } catch (InterruptedException e) {
-                            break;
-                        }
-                    }
-                    if (server.isServing()) {
-                        setStatus(ServerStatus.STARTED);
-                        logger.info("Started Registry Server on Port " + serverPort + " ...");
-
-                        // start db event handlers
-                        if (!startDatabaseEventHandlers()) {
-                            logger.error("Stopping Registry Server as DB event handlers failed to start!");
-                            server.stop();
-                        }
-                    }
-                }
-            }.start();
-        } catch (TTransportException e) {
-            logger.error(e.getMessage());
-            setStatus(ServerStatus.FAILED);
-            logger.error("Failed to start Registry server on port " + serverPort + " ...");
-        }
-    }
-
-    private boolean startDatabaseEventHandlers() {
-        try {
-            // db-event handlers
-            logger.info("Registring registry service with publishers for db-events.");
-            RegistryServiceDBEventMessagingFactory.registerRegistryServiceWithPublishers(
-                    Constants.DB_EVENT_SUBSCRIBERS);
-
-            logger.info("Starting registry service db-event-handler subscriber.");
-            RegistryServiceDBEventMessagingFactory.getDBEventSubscriber();
-        } catch (Exception ex) {
-            logger.error("Failed to start database event handlers, reason: " + ex.getMessage(), ex);
-            return false;
-        }
-        return true;
-    }
-
-    public static void main(String[] args) {
-        try {
-            new RegistryAPIServer().start();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @Override
-    public void start() throws Exception {
-        setStatus(ServerStatus.STARTING);
-        RegistryService.Processor<RegistryServerHandler> orchestratorService =
-                new RegistryService.Processor<RegistryServerHandler>(new RegistryServerHandler());
-        StartRegistryServer(orchestratorService);
-    }
-
-    @Override
-    public void stop() throws Exception {
-        if (server != null && server.isServing()) {
-            setStatus(ServerStatus.STOPING);
-            server.stop();
-        }
-    }
-
-    @Override
-    public void restart() throws Exception {
-        stop();
-        start();
-    }
-
-    @Override
-    public void configure() throws Exception {
-        // TODO Auto-generated method stub
-
-    }
-
-    @Override
-    public ServerStatus getStatus() throws Exception {
-        return status;
-    }
-
-    private void setStatus(ServerStatus stat) {
-        status = stat;
-        status.updateTime();
-    }
-
-    @Override
-    public String getName() {
-        return SERVER_NAME;
-    }
-
-    @Override
-    public String getVersion() {
-        return SERVER_VERSION;
-    }
-}
diff --git a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java
deleted file mode 100644
index 701d5e4dd6..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/server/ServerMain.java
+++ /dev/null
@@ -1,425 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.server;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-import org.apache.airavata.common.exception.AiravataException;
-import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.*;
-import org.apache.airavata.common.utils.ApplicationSettings.ShutdownStrategy;
-import org.apache.airavata.common.utils.IServer.ServerStatus;
-import org.apache.airavata.common.utils.StringUtil.CommandLineParameters;
-import org.apache.airavata.patform.monitoring.MonitoringServer;
-import org.apache.commons.cli.ParseException;
-import org.apache.zookeeper.server.ServerCnxnFactory;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ServerMain {
-    private static List<IServer> servers;
-    private static final String SERVERS_KEY = "servers";
-    private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
-    private static boolean serversLoaded = false;
-    private static final String stopFileNamePrefix = "server_stop";
-    private static long serverPID = -1;
-    private static final String serverStartedFileNamePrefix = "server_start";
-    private static boolean systemShutDown = false;
-    private static String STOP_COMMAND_STR = "stop";
-
-    private static final String ALL_IN_ONE = "all";
-    private static final String API_ORCH = "api-orch";
-    private static final String EXECUTION = "execution";
-    // server names
-    private static final String API_SERVER = "apiserver.class";
-    private static final String CREDENTIAL_STORE = "credential.store.class";
-    private static final String REGISTRY_SERVER = "regserver";
-    private static final String SHARING_SERVER = "sharing_server";
-    private static final String GFAC_SERVER = "gfac";
-    private static final String ORCHESTRATOR = "orchestrator";
-    private static final String PROFILE_SERVICE = "profile_service.class";
-    private static final String DB_EVENT_MANAGER = "db_event_manager.class";
-
-    private static ServerCnxnFactory cnxnFactory;
-    //	private static boolean shutdownHookCalledBefore=false;
-    static {
-        servers = new ArrayList<IServer>();
-    }
-
-    private static void loadServers(String serverNames) {
-        try {
-            if (serverNames != null) {
-                List<String> serversList = handleServerDependencies(serverNames);
-                for (String serverString : serversList) {
-                    serverString = serverString.trim();
-                    String serverClassName = ServerSettings.getSetting(serverString);
-                    Class<?> classInstance;
-                    try {
-                        classInstance = ServerMain.class.getClassLoader().loadClass(serverClassName);
-                        servers.add((IServer) classInstance.newInstance());
-                    } catch (ClassNotFoundException e) {
-                        logger.error("Error while locating server implementation \"" + serverString + "\"!!!", e);
-                    } catch (InstantiationException e) {
-                        logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e);
-                    } catch (IllegalAccessException e) {
-                        logger.error("Error while initiating server instance \"" + serverString + "\"!!!", e);
-                    } catch (ClassCastException e) {
-                        logger.error("Invalid server \"" + serverString + "\"!!!", e);
-                    }
-                }
-            } else {
-                logger.warn("No server name specify to start, use -h command line option to view help menu ...");
-            }
-        } catch (ApplicationSettingsException e) {
-            logger.error("Error while retrieving server list!!!", e);
-        }
-        serversLoaded = true;
-        Runtime.getRuntime().addShutdownHook(new Thread() {
-            public void run() {
-                setSystemShutDown();
-                stopAllServers();
-            }
-        });
-    }
-
-    private static List<String> handleServerDependencies(String serverNames) {
-        List<String> serverList = new ArrayList<>(Arrays.asList(serverNames.split(",")));
-        if (serverList.indexOf(ALL_IN_ONE) > -1) {
-            serverList.clear();
-            serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything
-            serverList.add(REGISTRY_SERVER); // registry server should start before everything else
-            serverList.add(CREDENTIAL_STORE); // credential store should start before api server
-            serverList.add(SHARING_SERVER);
-            serverList.add(API_SERVER);
-            serverList.add(ORCHESTRATOR);
-            serverList.add(GFAC_SERVER);
-            serverList.add(PROFILE_SERVICE);
-        } else if (serverList.indexOf(API_ORCH) > -1) {
-            serverList.clear();
-            serverList.add(DB_EVENT_MANAGER); // DB Event Manager should start before everything
-            serverList.add(REGISTRY_SERVER); // registry server should start before everything else
-            serverList.add(CREDENTIAL_STORE); // credential store should start before api server
-            serverList.add(SHARING_SERVER);
-            serverList.add(API_SERVER);
-            serverList.add(ORCHESTRATOR);
-            serverList.add(PROFILE_SERVICE);
-        } else if (serverList.indexOf(EXECUTION) > -1) {
-            serverList.clear();
-            serverList.add(GFAC_SERVER);
-        } else {
-            // registry server should start before everything
-            int regPos = serverList.indexOf(REGISTRY_SERVER);
-            if (regPos > 0) {
-                String temp = serverList.get(0);
-                serverList.set(0, serverList.get(regPos));
-                serverList.set(regPos, temp);
-            }
-
-            // credential store should start before api server
-            int credPos = serverList.indexOf(CREDENTIAL_STORE);
-            int apiPos = serverList.indexOf(API_SERVER);
-            if (credPos >= 0 && apiPos >= 0 && (credPos > apiPos)) {
-                String temp = serverList.get(apiPos);
-                serverList.set(apiPos, serverList.get(credPos));
-                serverList.set(credPos, temp);
-            }
-        }
-        return serverList;
-    }
-
-    //	private static void addSecondaryShutdownHook(){
-    //		Runtime.getRuntime().addShutdownHook(new Thread(){
-    //			@Override
-    //			public void run() {
-    //				System.out.print("Graceful shutdown attempt is still active. Do you want to exit instead? (y/n)");
-    //				String command=System.console().readLine().trim().toLowerCase();
-    //				if (command.equals("yes") || command.equals("y")){
-    //					System.exit(1);
-    //				}
-
-    //			}
-    //		});
-    //	}
-
-    public static void main(String[] args) throws IOException, AiravataException, ParseException {
-        ServerSettings.mergeSettingsCommandLineArgs(args);
-        if (ServerSettings.getBooleanSetting("api.server.monitoring.enabled")) {
-            MonitoringServer monitoringServer = new MonitoringServer(
-                    ServerSettings.getSetting("api.server.monitoring.host"),
-                    ServerSettings.getIntSetting("api.server.monitoring.port"));
-            monitoringServer.start();
-
-            Runtime.getRuntime().addShutdownHook(new Thread(monitoringServer::stop));
-        }
-
-        CommandLineParameters commandLineParameters = StringUtil.getCommandLineParser(args);
-        if (commandLineParameters.getArguments().contains(STOP_COMMAND_STR)) {
-            performServerStopRequest(commandLineParameters);
-        } else {
-            performServerStart(args);
-        }
-    }
-
-    private static void performServerStart(String[] args) {
-        setServerStarted();
-        logger.info("Airavata server instance starting...");
-        String serverNames = "all";
-        for (String string : args) {
-            logger.info("Server Arguments: " + string);
-            if (string.startsWith("--servers=")) {
-                serverNames = string.substring("--servers=".length());
-            }
-        }
-        serverNames = ApplicationSettings.getSetting(SERVERS_KEY, serverNames);
-        startAllServers(serverNames);
-        while (!hasStopRequested()) {
-            try {
-                Thread.sleep(2000);
-            } catch (InterruptedException e) {
-                stopAllServers();
-            }
-        }
-        if (hasStopRequested()) {
-            ServerSettings.setStopAllThreads(true);
-            stopAllServers();
-            ShutdownStrategy shutdownStrategy;
-            try {
-                shutdownStrategy = ServerSettings.getShutdownStrategy();
-            } catch (Exception e) {
-                String strategies = "";
-                for (ShutdownStrategy s : ShutdownStrategy.values()) {
-                    strategies += "/" + s.toString();
-                }
-                logger.warn(e.getMessage());
-                logger.warn("Valid shutdown options are : " + strategies.substring(1));
-                shutdownStrategy = ShutdownStrategy.SELF_TERMINATE;
-            }
-            if (shutdownStrategy == ShutdownStrategy.SELF_TERMINATE) {
-                System.exit(0);
-            }
-        }
-    }
-
-    private static void performServerStopRequest(CommandLineParameters commandLineParameters) throws IOException {
-        //		deleteOldStartRecords();
-        String serverIndexOption = "serverIndex";
-        if (commandLineParameters.getParameters().containsKey(serverIndexOption)) {
-            serverPID = Integer.parseInt(commandLineParameters.getParameters().get(serverIndexOption));
-        }
-        if (isServerRunning()) {
-            logger.info("Requesting airavata server" + (serverPID == -1 ? "(s)" : " instance " + serverPID)
-                    + " to stop...");
-            requestStop();
-            while (isServerRunning()) {
-                try {
-                    Thread.sleep(5000);
-                } catch (InterruptedException e) {
-                    logger.error(e.getMessage(), e);
-                }
-            }
-            logger.info("Server" + (serverPID == -1 ? "(s)" : " instance " + serverPID) + " stopped!!!");
-        } else {
-            logger.error("Server" + (serverPID == -1 ? "" : " instance " + serverPID) + " is not running!!!");
-        }
-        if (ServerSettings.isEmbeddedZK()) {
-            cnxnFactory.shutdown();
-        }
-    }
-
-    @SuppressWarnings("resource")
-    private static void requestStop() throws IOException {
-        File file = new File(getServerStopFileName());
-        file.createNewFile();
-        new RandomAccessFile(file, "rw").getChannel().lock();
-        file.deleteOnExit();
-    }
-
-    private static boolean hasStopRequested() {
-        return isSystemShutDown()
-                || new File(getServerStopFileName()).exists()
-                || new File(stopFileNamePrefix).exists();
-    }
-
-    private static String getServerStopFileName() {
-        return stopFileNamePrefix;
-    }
-
-    private static void deleteOldStopRequests() {
-        File[] files = new File(".").listFiles();
-        for (File file : files) {
-            if (file.getName().contains(stopFileNamePrefix)) {
-                file.delete();
-            }
-        }
-    }
-
-    //	private static void deleteOldStartRecords(){
-    //		File[] files = new File(".").listFiles();
-    //		for (File file : files) {
-    //			if (file.getName().contains(serverStartedFileNamePrefix)){
-    //				try {
-    //					new FileOutputStream(file);
-    //					file.delete();
-    //				} catch (Exception e) {
-    //					//file is locked which means there's an active process using it
-    //				}
-    //			}
-    //		}
-    //	}
-
-    private static boolean isServerRunning() {
-        if (serverPID == -1) {
-            String[] files = new File(".").list();
-            for (String file : files) {
-                if (file.contains(serverStartedFileNamePrefix)) {
-                    return true;
-                }
-            }
-            return false;
-        } else {
-            return new File(getServerStartedFileName()).exists();
-        }
-    }
-
-    @SuppressWarnings({"resource"})
-    private static void setServerStarted() {
-        try {
-            serverPID = getPID();
-            deleteOldStopRequests();
-            File serverStartedFile = null;
-            serverStartedFile = new File(getServerStartedFileName());
-            serverStartedFile.createNewFile();
-            serverStartedFile.deleteOnExit();
-            new RandomAccessFile(serverStartedFile, "rw").getChannel().lock();
-        } catch (FileNotFoundException e) {
-            logger.error(e.getMessage(), e);
-        } catch (IOException e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    private static String getServerStartedFileName() {
-        return new File(
-                        new File(System.getenv("AIRAVATA_HOME"), "bin"),
-                        serverStartedFileNamePrefix + "_" + Long.toString(serverPID))
-                .toString();
-    }
-
-    public static void stopAllServers() {
-        // stopping should be done in reverse order of starting the servers
-        for (int i = servers.size() - 1; i >= 0; i--) {
-            try {
-                servers.get(i).stop();
-                waitForServerToStop(servers.get(i), null);
-            } catch (Exception e) {
-                logger.error("Server Stop Error:", e);
-            }
-        }
-    }
-
-    public static void startAllServers(String serversNames) {
-        if (!serversLoaded) {
-            loadServers(serversNames);
-        }
-        for (IServer server : servers) {
-            try {
-                server.configure();
-                server.start();
-                waitForServerToStart(server, null);
-            } catch (Exception e) {
-                logger.error("Server Start Error:", e);
-            }
-        }
-    }
-
-    private static final int SERVER_STATUS_CHANGE_WAIT_INTERVAL = 500;
-
-    private static void waitForServerToStart(IServer server, Integer maxWait) throws Exception {
-        int count = 0;
-        //		if (server.getStatus()==ServerStatus.STARTING) {
-        //			logger.info("Waiting for " + server.getName() + " to start...");
-        //		}
-        while (server.getStatus() == ServerStatus.STARTING && (maxWait == null || count < maxWait)) {
-            Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL);
-            count += SERVER_STATUS_CHANGE_WAIT_INTERVAL;
-        }
-        if (server.getStatus() != ServerStatus.STARTED) {
-            logger.error("The " + server.getName() + " did not start!!!");
-        }
-    }
-
-    private static void waitForServerToStop(IServer server, Integer maxWait) throws Exception {
-        int count = 0;
-        if (server.getStatus() == ServerStatus.STOPING) {
-            logger.info("Waiting for " + server.getName() + " to stop...");
-        }
-        // we are doing hasStopRequested() check because while we are stuck in the loop to stop there could be a
-        // forceStop request
-        while (server.getStatus() == ServerStatus.STOPING && (maxWait == null || count < maxWait)) {
-            Thread.sleep(SERVER_STATUS_CHANGE_WAIT_INTERVAL);
-            count += SERVER_STATUS_CHANGE_WAIT_INTERVAL;
-        }
-        if (server.getStatus() != ServerStatus.STOPPED) {
-            logger.error("Error stopping the " + server.getName() + "!!!");
-        }
-    }
-
-    private static boolean isSystemShutDown() {
-        return systemShutDown;
-    }
-
-    private static void setSystemShutDown() {
-        ServerMain.systemShutDown = true;
-    }
-
-    //	private static int getPID(){
-    //		try {
-    //			java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory
-    //					.getRuntimeMXBean();
-    //			java.lang.reflect.Field jvm = runtime.getClass()
-    //					.getDeclaredField("jvm");
-    //			jvm.setAccessible(true);
-    //			sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm
-    //					.get(runtime);
-    //			java.lang.reflect.Method pid_method = mgmt.getClass()
-    //					.getDeclaredMethod("getProcessId");
-    //			pid_method.setAccessible(true);
-    //
-    //			int pid = (Integer) pid_method.invoke(mgmt);
-    //			return pid;
-    //		} catch (Exception e) {
-    //			return -1;
-    //		}
-    //	}
-
-    // getPID from ProcessHandle JDK 9 and onwards
-    private static long getPID() {
-        try {
-            return ProcessHandle.current().pid();
-        } catch (Exception e) {
-            return -1;
-        }
-    }
-}
diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
index 173e809fe3..34b534fbe8 100644
--- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/messaging/SharingServiceDBEventHandler.java
@@ -38,7 +38,6 @@ import org.apache.airavata.sharing.registry.models.Entity;
 import org.apache.airavata.sharing.registry.models.PermissionType;
 import org.apache.airavata.sharing.registry.models.SharingRegistryException;
 import org.apache.airavata.sharing.registry.models.User;
-import org.apache.airavata.sharing.registry.server.SharingRegistryServer;
 import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
 import org.apache.airavata.sharing.registry.utils.ThriftDataModelConversion;
 import org.apache.thrift.TException;
@@ -57,8 +56,8 @@ public class SharingServiceDBEventHandler implements MessageHandler {
     SharingServiceDBEventHandler() throws ApplicationSettingsException, SharingRegistryException {
         log.info("Starting sharing registry client.....");
         sharingRegistryClient = SharingRegistryServiceClientFactory.createSharingRegistryClient(
-                ServerSettings.getSetting(SharingRegistryServer.SHARING_REG_SERVER_HOST),
-                Integer.parseInt(ServerSettings.getSetting(SharingRegistryServer.SHARING_REG_SERVER_PORT)));
+                ServerSettings.getSetting("sharing.registry.server.host"),
+                Integer.parseInt(ServerSettings.getSetting("sharing.registry.server.port")));
     }
 
     @Override
diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java
deleted file mode 100644
index 85fc301f19..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/ServerMain.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.sharing.registry.server;
-
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.IOException;
-import java.io.RandomAccessFile;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class ServerMain {
-    private static final Logger logger = LoggerFactory.getLogger(ServerMain.class);
-
-    private static long serverPID = -1;
-    private static final String stopFileNamePrefix = "server_stop";
-    private static final String serverStartedFileNamePrefix = "server_start";
-
-    public static void main(String[] args) {
-        try {
-            setServerStarted();
-            new SharingRegistryServer().start();
-        } catch (Exception e) {
-            logger.error(e.getMessage(), e);
-        }
-    }
-
-    @SuppressWarnings({"resource"})
-    private static void setServerStarted() {
-        try {
-            serverPID = getPID();
-            deleteOldStopRequests();
-            File serverStartedFile = null;
-            serverStartedFile = new File(getServerStartedFileName());
-            serverStartedFile.createNewFile();
-            serverStartedFile.deleteOnExit();
-            new RandomAccessFile(serverStartedFile, "rw").getChannel().lock();
-        } catch (FileNotFoundException e) {
-            logger.warn(e.getMessage(), e);
-        } catch (IOException e) {
-            logger.warn(e.getMessage(), e);
-        }
-    }
-
-    private static String getServerStartedFileName() {
-        String SHARING_REGISTRY_HOME = System.getenv("" + "SHARING_REGISTRY_HOME");
-        if (SHARING_REGISTRY_HOME == null) SHARING_REGISTRY_HOME = "/tmp";
-        else SHARING_REGISTRY_HOME = SHARING_REGISTRY_HOME + "/bin";
-        return new File(SHARING_REGISTRY_HOME, serverStartedFileNamePrefix + "_" + Long.toString(serverPID)).toString();
-    }
-
-    //    private static int getPID() {
-    //        try {
-    //            java.lang.management.RuntimeMXBean runtime = java.lang.management.ManagementFactory
-    //                    .getRuntimeMXBean();
-    //            java.lang.reflect.Field jvm = runtime.getClass()
-    //                    .getDeclaredField("jvm");
-    //            jvm.setAccessible(true);
-    //            sun.management.VMManagement mgmt = (sun.management.VMManagement) jvm
-    //                    .get(runtime);
-    //            java.lang.reflect.Method pid_method = mgmt.getClass()
-    //                    .getDeclaredMethod("getProcessId");
-    //            pid_method.setAccessible(true);
-    //
-    //            int pid = (Integer) pid_method.invoke(mgmt);
-    //            return pid;
-    //        } catch (Exception e) {
-    //            return -1;
-    //        }
-    //    }
-
-    // getPID from ProcessHandle JDK 9 and onwards
-    private static long getPID() {
-        try {
-            return ProcessHandle.current().pid();
-        } catch (Exception e) {
-            return -1;
-        }
-    }
-
-    private static void deleteOldStopRequests() {
-        File[] files = new File(".").listFiles();
-        for (File file : files) {
-            if (file.getName().contains(stopFileNamePrefix)) {
-                file.delete();
-            }
-        }
-    }
-}
diff --git a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java b/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
deleted file mode 100644
index f84b3c974f..0000000000
--- a/airavata-api/src/main/java/org/apache/airavata/sharing/registry/server/SharingRegistryServer.java
+++ /dev/null
@@ -1,183 +0,0 @@
-/**
-*
-* Licensed to the Apache Software Foundation (ASF) under one
-* or more contributor license agreements. See the NOTICE file
-* distributed with this work for additional information
-* regarding copyright ownership. The ASF licenses this file
-* to you under the Apache License, Version 2.0 (the
-* "License"); you may not use this file except in compliance
-* with the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing,
-* software distributed under the License is distributed on an
-* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-* KIND, either express or implied. See the License for the
-* specific language governing permissions and limitations
-* under the License.
-*/
-package org.apache.airavata.sharing.registry.server;
-
-import java.net.InetAddress;
-import java.net.InetSocketAddress;
-import org.apache.airavata.common.exception.AiravataException;
-import org.apache.airavata.common.utils.IServer;
-import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.sharing.registry.db.utils.SharingRegistryDBInitConfig;
-import org.apache.airavata.sharing.registry.messaging.SharingServiceDBEventMessagingFactory;
-import org.apache.airavata.sharing.registry.models.SharingRegistryException;
-import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
-import org.apache.airavata.sharing.registry.utils.Constants;
-import org.apache.thrift.server.TServer;
-import org.apache.thrift.server.TThreadPoolServer;
-import org.apache.thrift.transport.TSSLTransportFactory;
-import org.apache.thrift.transport.TServerSocket;
-import org.apache.thrift.transport.TServerTransport;
-import org.apache.thrift.transport.TTransportException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class SharingRegistryServer implements IServer {
-    private static final Logger logger = LoggerFactory.getLogger(SharingRegistryServer.class);
-
-    public static final String SHARING_REG_SERVER_HOST = "sharing.registry.server.host";
-    public static final String SHARING_REG_SERVER_PORT = "sharing.registry.server.port";
-
-    private static final String SERVER_NAME = "Sharing Registry Server";
-    private static final String SERVER_VERSION = "1.0";
-
-    private IServer.ServerStatus status;
-    private TServer server;
-    private boolean testMode = false;
-
-    public SharingRegistryServer() {
-        setStatus(IServer.ServerStatus.STOPPED);
-    }
-
-    @Override
-    public String getName() {
-        return SERVER_NAME;
-    }
-
-    @Override
-    public String getVersion() {
-        return SERVER_VERSION;
-    }
-
-    @Override
-    public void start() throws Exception {
-        try {
-            setStatus(IServer.ServerStatus.STARTING);
-
-            final int serverPort = Integer.parseInt(ServerSettings.getSetting(SHARING_REG_SERVER_PORT));
-            final String serverHost = ServerSettings.getSetting(SHARING_REG_SERVER_HOST);
-            SharingRegistryService.Processor processor = new SharingRegistryService.Processor(
-                    new SharingRegistryServerHandler(createSharingRegistryDBInitConfig()));
-
-            TServerTransport serverTransport;
-            TThreadPoolServer.Args options;
-
-            if (!ServerSettings.isTLSEnabled()) {
-                InetSocketAddress inetSocketAddress = new InetSocketAddress(serverHost, serverPort);
-                serverTransport = new TServerSocket(inetSocketAddress);
-                options = new TThreadPoolServer.Args(serverTransport);
-            } else {
-                TSSLTransportFactory.TSSLTransportParameters TLSParams =
-                        new TSSLTransportFactory.TSSLTransportParameters();
-                TLSParams.requireClientAuth(true);
-                TLSParams.setKeyStore(ServerSettings.getKeyStorePath(), ServerSettings.getKeyStorePassword());
-                TServerSocket TLSServerTransport = TSSLTransportFactory.getServerSocket(
-                        serverPort, ServerSettings.getTLSClientTimeout(), InetAddress.getByName(serverHost), TLSParams);
-                options = new TThreadPoolServer.Args(TLSServerTransport);
-            }
-            options.minWorkerThreads = 30;
-            server = new TThreadPoolServer(options.processor(processor));
-
-            new Thread(() -> {
-                        server.serve();
-                        setStatus(ServerStatus.STOPPED);
-                        logger.info("Sharing Registry Server Stopped.");
-                    })
-                    .start();
-            new Thread(() -> {
-                        while (!server.isServing()) {
-                            try {
-                                Thread.sleep(500);
-                            } catch (InterruptedException e) {
-                                break;
-                            }
-                        }
-                        if (server.isServing()) {
-
-                            try {
-                                logger.info("Register sharing service with DB Event publishers");
-                                SharingServiceDBEventMessagingFactory.registerSharingServiceWithPublishers(
-                                        Constants.PUBLISHERS);
-
-                                logger.info("Start sharing service DB Event subscriber");
-                                SharingServiceDBEventMessagingFactory.getDBEventSubscriber();
-                            } catch (AiravataException | SharingRegistryException e) {
-                                logger.error("Error starting sharing service. Error setting up DB event services.");
-                                server.stop();
-                            }
-                            setStatus(ServerStatus.STARTED);
-                            logger.info("Starting Sharing Registry Server on Port " + serverPort);
-                            logger.info("Listening to Sharing Registry server clients ....");
-                        }
-                    })
-                    .start();
-
-        } catch (TTransportException e) {
-            setStatus(IServer.ServerStatus.FAILED);
-            throw new Exception("Error while starting the Sharing Registry service", e);
-        }
-    }
-
-    @Override
-    public void stop() throws Exception {
-        if (server != null && server.isServing()) {
-            setStatus(IServer.ServerStatus.STOPING);
-            server.stop();
-        }
-    }
-
-    @Override
-    public void restart() throws Exception {
-        stop();
-        start();
-    }
-
-    @Override
-    public void configure() throws Exception {}
-
-    @Override
-    public IServer.ServerStatus getStatus() throws Exception {
-        return status;
-    }
-
-    private void setStatus(IServer.ServerStatus stat) {
-        status = stat;
-        status.updateTime();
-    }
-
-    public TServer getServer() {
-        return server;
-    }
-
-    public void setServer(TServer server) {
-        this.server = server;
-    }
-
-    public void setTestMode(boolean testMode) {
-        this.testMode = testMode;
-    }
-
-    private SharingRegistryDBInitConfig createSharingRegistryDBInitConfig() {
-        SharingRegistryDBInitConfig sharingRegistryDBInitConfig = new SharingRegistryDBInitConfig();
-        if (this.testMode) {
-            sharingRegistryDBInitConfig.setDBInitScriptPrefix("sharing-registry");
-        }
-        return sharingRegistryDBInitConfig;
-    }
-}
diff --git a/airavata-api/src/main/resources/distribution/bin/airavata.sh b/airavata-api/src/main/resources/distribution/bin/airavata.sh
new file mode 100644
index 0000000000..9121bf92cd
--- /dev/null
+++ b/airavata-api/src/main/resources/distribution/bin/airavata.sh
@@ -0,0 +1,5 @@
+#!/bin/bash
+SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
+source "$SCRIPT_DIR/setenv.sh"
+
+run_service "airavata" "org.apache.airavata.api.server.AiravataUnifiedServer" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/controller.sh b/airavata-api/src/main/resources/distribution/bin/controller.sh
deleted file mode 100755
index 4e145cd5ee..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/controller.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="controller"
-MAIN_CLASS="org.apache.airavata.helix.impl.controller.HelixController"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/email-monitor.sh b/airavata-api/src/main/resources/distribution/bin/email-monitor.sh
deleted file mode 100755
index beb11ebbad..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/email-monitor.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="email-monitor"
-MAIN_CLASS="org.apache.airavata.monitor.email.EmailBasedMonitor"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/orchestrator.sh b/airavata-api/src/main/resources/distribution/bin/orchestrator.sh
deleted file mode 100755
index 5e457ac5bc..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/orchestrator.sh
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="orchestrator"
-MAIN_CLASS="org.apache.airavata.server.ServerMain"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-SERVERS=""
-ARGS=()
-while [[ $# -gt 0 ]]; do
-  case $1 in
-  apiserver | gfac | orchestrator | credentialstore | regserver)
-    if [ -z "$SERVERS" ]; then SERVERS="$1"; else SERVERS="$SERVERS,$1"; fi
-    shift
-    ;;
-  all | api-orch | execution)
-    SERVERS="$1"
-    shift
-    ;;
-  *)
-    ARGS+=("$1")
-    shift
-    ;;
-  esac
-done
-CONSTRUCTED_ARGS=()
-if [[ " ${ARGS[*]} " =~ " start " ]]; then
-  if [ -n "$SERVERS" ]; then
-    CONSTRUCTED_ARGS+=("--servers=${SERVERS}")
-  else
-    echo "You should provide at least one server component to start the airavata server. Please use -h option to get more details."
-    exit 1
-  fi
-fi
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "${ARGS[@]}" "${CONSTRUCTED_ARGS[@]}"
diff --git a/airavata-api/src/main/resources/distribution/bin/parser-wm.sh b/airavata-api/src/main/resources/distribution/bin/parser-wm.sh
deleted file mode 100755
index f451c6dabb..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/parser-wm.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="parser-wm"
-MAIN_CLASS="org.apache.airavata.helix.impl.workflow.ParserWorkflowManager"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/participant.sh b/airavata-api/src/main/resources/distribution/bin/participant.sh
deleted file mode 100755
index 2f8730c743..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/participant.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="participant"
-MAIN_CLASS="org.apache.airavata.helix.impl.participant.GlobalParticipant"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/post-wm.sh b/airavata-api/src/main/resources/distribution/bin/post-wm.sh
deleted file mode 100755
index 6d867cdcba..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/post-wm.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="post-wm"
-MAIN_CLASS="org.apache.airavata.helix.impl.workflow.PostWorkflowManager"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/pre-wm.sh b/airavata-api/src/main/resources/distribution/bin/pre-wm.sh
deleted file mode 100755
index c8f1dc3bab..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/pre-wm.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="pre-wm"
-MAIN_CLASS="org.apache.airavata.helix.impl.workflow.PreWorkflowManager"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh b/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh
deleted file mode 100755
index 347fd24a21..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/realtime-monitor.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="realtime-monitor"
-MAIN_CLASS="org.apache.airavata.monitor.realtime.RealtimeMonitor"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"
diff --git a/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh b/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh
deleted file mode 100755
index 9ce01762ae..0000000000
--- a/airavata-api/src/main/resources/distribution/bin/sharing-registry.sh
+++ /dev/null
@@ -1,26 +0,0 @@
-#!/usr/bin/env bash
-
-# Licensed to the Apache Software Foundation (ASF) under one
-# or more contributor license agreements. See the NOTICE file
-# distributed with this work for additional information
-# regarding copyright ownership. The ASF licenses this file
-# to you under the Apache License, Version 2.0 (the
-# "License"); you may not use this file except in compliance
-# with the License. You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing,
-# software distributed under the License is distributed on an
-# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-# KIND, either express or implied. See the License for the
-# specific language governing permissions and limitations
-# under the License.
-
-. $(dirname $0)/setenv.sh
-
-SERVICE_NAME="sharing-registry"
-MAIN_CLASS="org.apache.airavata.sharing.registry.server.ServerMain"
-JAVA_OPTS="-Dairavata.config.dir=${AIRAVATA_HOME}/conf -Dairavata.home=${AIRAVATA_HOME} -Dlog4j.configurationFile=file:${AIRAVATA_HOME}/conf/log4j2.xml"
-
-run_service "$SERVICE_NAME" "$MAIN_CLASS" "$JAVA_OPTS" "$@"


(airavata) 01/06: feat: add AiravataUnifiedServer consolidating all Thrift services

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit bb29ae7c4dae3f873906f1e95fa99ba2962906ab
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Mar 25 23:35:04 2026 -0500

    feat: add AiravataUnifiedServer consolidating all Thrift services
    
    Creates AiravataUnifiedServer.java hosting Airavata, RegistryService,
    SharingRegistry, CredentialStore, and all four profile services on a
    single TMultiplexedProcessor bound to port 8930 (apiserver.port).
    Does not compile until Task 3 adds the AiravataServerHandler constructor
    that accepts in-process handler references.
    
    Co-Authored-By: Claude Sonnet 4.6 <no...@anthropic.com>
---
 .../airavata/api/server/AiravataUnifiedServer.java | 246 +++++++++++++++++++++
 1 file changed, 246 insertions(+)

diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java
new file mode 100644
index 0000000000..f2dc3e045c
--- /dev/null
+++ b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java
@@ -0,0 +1,246 @@
+/**
+*
+* Licensed to the Apache Software Foundation (ASF) under one
+* or more contributor license agreements. See the NOTICE file
+* distributed with this work for additional information
+* regarding copyright ownership. The ASF licenses this file
+* to you under the Apache License, Version 2.0 (the
+* "License"); you may not use this file except in compliance
+* with the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing,
+* software distributed under the License is distributed on an
+* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+* KIND, either express or implied. See the License for the
+* specific language governing permissions and limitations
+* under the License.
+*/
+package org.apache.airavata.api.server;
+
+import java.net.InetSocketAddress;
+import java.util.Arrays;
+import java.util.List;
+import org.apache.airavata.api.Airavata;
+import org.apache.airavata.api.server.handler.AiravataServerHandler;
+import org.apache.airavata.api.server.util.Constants;
+import org.apache.airavata.common.exception.ApplicationSettingsException;
+import org.apache.airavata.common.utils.DBInitConfig;
+import org.apache.airavata.common.utils.DBInitializer;
+import org.apache.airavata.common.utils.IServer;
+import org.apache.airavata.common.utils.ServerSettings;
+import org.apache.airavata.credential.store.cpi.CredentialStoreService;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
+import org.apache.airavata.model.error.AiravataErrorType;
+import org.apache.airavata.model.error.AiravataSystemException;
+import org.apache.airavata.registry.api.RegistryService;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
+import org.apache.airavata.registry.core.utils.AppCatalogDBInitConfig;
+import org.apache.airavata.registry.core.utils.ExpCatalogDBInitConfig;
+import org.apache.airavata.registry.core.utils.ReplicaCatalogDBInitConfig;
+import org.apache.airavata.service.profile.groupmanager.cpi.GroupManagerService;
+import org.apache.airavata.service.profile.groupmanager.cpi.group_manager_cpiConstants;
+import org.apache.airavata.service.profile.handlers.GroupManagerServiceHandler;
+import org.apache.airavata.service.profile.handlers.IamAdminServicesHandler;
+import org.apache.airavata.service.profile.handlers.TenantProfileServiceHandler;
+import org.apache.airavata.service.profile.handlers.UserProfileServiceHandler;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.IamAdminServices;
+import org.apache.airavata.service.profile.iam.admin.services.cpi.iam_admin_services_cpiConstants;
+import org.apache.airavata.service.profile.tenant.cpi.TenantProfileService;
+import org.apache.airavata.service.profile.tenant.cpi.profile_tenant_cpiConstants;
+import org.apache.airavata.service.profile.user.core.utils.UserProfileCatalogDBInitConfig;
+import org.apache.airavata.service.profile.user.cpi.UserProfileService;
+import org.apache.airavata.service.profile.user.cpi.profile_user_cpiConstants;
+import org.apache.airavata.sharing.registry.db.utils.SharingRegistryDBInitConfig;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
+import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
+import org.apache.thrift.TMultiplexedProcessor;
+import org.apache.thrift.server.TServer;
+import org.apache.thrift.server.TThreadPoolServer;
+import org.apache.thrift.transport.TServerSocket;
+import org.apache.thrift.transport.TServerTransport;
+import org.apache.thrift.transport.TTransportException;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Consolidated Thrift server that hosts all Airavata services on a single multiplexed port.
+ *
+ * <p>Services registered on the TMultiplexedProcessor:
+ * <ul>
+ *   <li>"Airavata" → AiravataServerHandler (main API)</li>
+ *   <li>"RegistryService" → RegistryServerHandler</li>
+ *   <li>"SharingRegistry" → SharingRegistryServerHandler</li>
+ *   <li>"CredentialStore" → CredentialStoreServerHandler</li>
+ *   <li>Profile services (UserProfile, TenantProfile, IamAdminServices, GroupManager)</li>
+ * </ul>
+ *
+ * <p>All services share the same port (default 8930, from {@code apiserver.port}).
+ */
+public class AiravataUnifiedServer implements IServer {
+
+    private static final Logger logger = LoggerFactory.getLogger(AiravataUnifiedServer.class);
+    private static final String SERVER_NAME = "Airavata Unified Server";
+    private static final String SERVER_VERSION = "1.0";
+
+    private ServerStatus status;
+    private TServer server;
+
+    private final List<DBInitConfig> dbInitConfigs = Arrays.asList(
+            new ExpCatalogDBInitConfig(),
+            new AppCatalogDBInitConfig(),
+            new ReplicaCatalogDBInitConfig(),
+            new UserProfileCatalogDBInitConfig());
+
+    public AiravataUnifiedServer() {
+        setStatus(ServerStatus.STOPPED);
+    }
+
+    @Override
+    public void start() throws Exception {
+        setStatus(ServerStatus.STARTING);
+
+        logger.info("Initializing databases...");
+        for (DBInitConfig dbInitConfig : dbInitConfigs) {
+            DBInitializer.initializeDB(dbInitConfig);
+        }
+        logger.info("Databases initialized successfully");
+
+        try {
+            final String serverHost = ServerSettings.getSetting(Constants.API_SERVER_HOST, null);
+            final int serverPort =
+                    Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_PORT, "8930"));
+
+            // --- Instantiate handlers ---
+            CredentialStoreServerHandler credentialStoreServerHandler = new CredentialStoreServerHandler();
+            RegistryServerHandler registryServerHandler = new RegistryServerHandler();
+            SharingRegistryServerHandler sharingRegistryServerHandler =
+                    new SharingRegistryServerHandler(new SharingRegistryDBInitConfig());
+
+            // AiravataServerHandler constructor accepting in-process handler refs is added in Task 3.
+            // Until then this file will not compile.
+            AiravataServerHandler airavataServerHandler = new AiravataServerHandler(
+                    credentialStoreServerHandler, registryServerHandler, sharingRegistryServerHandler);
+
+            // --- Build processors ---
+            TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor();
+
+            multiplexedProcessor.registerProcessor(
+                    "Airavata", new Airavata.Processor<>(airavataServerHandler));
+
+            multiplexedProcessor.registerProcessor(
+                    "RegistryService", new RegistryService.Processor<>(registryServerHandler));
+
+            multiplexedProcessor.registerProcessor(
+                    "SharingRegistry", new SharingRegistryService.Processor<>(sharingRegistryServerHandler));
+
+            multiplexedProcessor.registerProcessor(
+                    "CredentialStore", new CredentialStoreService.Processor<>(credentialStoreServerHandler));
+
+            // Profile services (multiplexed on the same port as the existing ProfileServiceServer)
+            multiplexedProcessor.registerProcessor(
+                    profile_user_cpiConstants.USER_PROFILE_CPI_NAME,
+                    new UserProfileService.Processor<>(new UserProfileServiceHandler()));
+
+            multiplexedProcessor.registerProcessor(
+                    profile_tenant_cpiConstants.TENANT_PROFILE_CPI_NAME,
+                    new TenantProfileService.Processor<>(new TenantProfileServiceHandler()));
+
+            multiplexedProcessor.registerProcessor(
+                    iam_admin_services_cpiConstants.IAM_ADMIN_SERVICES_CPI_NAME,
+                    new IamAdminServices.Processor<>(new IamAdminServicesHandler()));
+
+            multiplexedProcessor.registerProcessor(
+                    group_manager_cpiConstants.GROUP_MANAGER_CPI_NAME,
+                    new GroupManagerService.Processor<>(new GroupManagerServiceHandler()));
+
+            // --- Transport and server ---
+            TServerTransport serverTransport;
+            if (serverHost == null) {
+                serverTransport = new TServerSocket(serverPort);
+            } else {
+                serverTransport = new TServerSocket(new InetSocketAddress(serverHost, serverPort));
+            }
+
+            TThreadPoolServer.Args options = new TThreadPoolServer.Args(serverTransport);
+            options.minWorkerThreads =
+                    Integer.parseInt(ServerSettings.getSetting(Constants.API_SERVER_MIN_THREADS, "50"));
+            server = new TThreadPoolServer(options.processor(multiplexedProcessor));
+
+            new Thread(() -> {
+                        server.serve();
+                        setStatus(ServerStatus.STOPPED);
+                        logger.info("Airavata Unified Server stopped.");
+                    })
+                    .start();
+
+            new Thread(() -> {
+                        while (!server.isServing()) {
+                            try {
+                                Thread.sleep(500);
+                            } catch (InterruptedException e) {
+                                break;
+                            }
+                        }
+                        if (server.isServing()) {
+                            setStatus(ServerStatus.STARTED);
+                            logger.info("Airavata Unified Server started on port {}", serverPort);
+                            logger.info("Registered services: Airavata, RegistryService, SharingRegistry, "
+                                    + "CredentialStore, UserProfile, TenantProfile, IamAdminServices, GroupManager");
+                        }
+                    })
+                    .start();
+
+        } catch (TTransportException | ApplicationSettingsException e) {
+            logger.error("Failed to start Airavata Unified Server", e);
+            setStatus(ServerStatus.FAILED);
+            throw new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
+        }
+    }
+
+    @Override
+    public void stop() throws Exception {
+        if (server != null && server.isServing()) {
+            setStatus(ServerStatus.STOPING);
+            server.stop();
+        }
+    }
+
+    @Override
+    public void restart() throws Exception {
+        stop();
+        start();
+    }
+
+    @Override
+    public void configure() throws Exception {}
+
+    @Override
+    public ServerStatus getStatus() throws Exception {
+        return status;
+    }
+
+    @Override
+    public String getName() {
+        return SERVER_NAME;
+    }
+
+    @Override
+    public String getVersion() {
+        return SERVER_VERSION;
+    }
+
+    private void setStatus(ServerStatus stat) {
+        status = stat;
+        status.updateTime();
+    }
+
+    public static void main(String[] args) {
+        try {
+            new AiravataUnifiedServer().start();
+        } catch (Exception e) {
+            logger.error("Error starting Airavata Unified Server", e);
+        }
+    }
+}


(airavata) 02/06: refactor: replace ThriftClientPool RPC calls with in-process handler method calls

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit 4944767c92cebef5e92d4e40a9d6988c922d3cf9
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Mar 25 23:43:57 2026 -0500

    refactor: replace ThriftClientPool RPC calls with in-process handler method calls
    
    AiravataServerHandler now takes RegistryServerHandler, SharingRegistryServerHandler,
    and CredentialStoreServerHandler as constructor dependencies instead of communicating
    via ThriftClientPool over the network. All ~759 pool references (getResource,
    returnResource, returnBrokenResource) have been eliminated. Private helper methods
    that previously accepted Client parameters now use the handler fields directly.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
---
 .../airavata/api/server/AiravataUnifiedServer.java |    2 +-
 .../api/server/handler/AiravataServerHandler.java  | 1526 +++++---------------
 2 files changed, 369 insertions(+), 1159 deletions(-)

diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java
index f2dc3e045c..23d32beaf6 100644
--- a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java
+++ b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataUnifiedServer.java
@@ -121,7 +121,7 @@ public class AiravataUnifiedServer implements IServer {
             // AiravataServerHandler constructor accepting in-process handler refs is added in Task 3.
             // Until then this file will not compile.
             AiravataServerHandler airavataServerHandler = new AiravataServerHandler(
-                    credentialStoreServerHandler, registryServerHandler, sharingRegistryServerHandler);
+                    registryServerHandler, sharingRegistryServerHandler, credentialStoreServerHandler);
 
             // --- Build processors ---
             TMultiplexedProcessor multiplexedProcessor = new TMultiplexedProcessor();
diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
index 4da1eb7494..d085214005 100644
--- a/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
+++ b/airavata-api/src/main/java/org/apache/airavata/api/server/handler/AiravataServerHandler.java
@@ -35,7 +35,6 @@ import org.apache.airavata.common.exception.ApplicationSettingsException;
 import org.apache.airavata.common.utils.AiravataUtils;
 import org.apache.airavata.common.utils.Constants;
 import org.apache.airavata.common.utils.ServerSettings;
-import org.apache.airavata.common.utils.ThriftClientPool;
 import org.apache.airavata.credential.store.cpi.CredentialStoreService;
 import org.apache.airavata.helix.core.support.adaptor.AdaptorSupportImpl;
 import org.apache.airavata.messaging.core.MessageContext;
@@ -97,12 +96,14 @@ import org.apache.airavata.model.workspace.Gateway;
 import org.apache.airavata.model.workspace.Notification;
 import org.apache.airavata.model.workspace.Project;
 import org.apache.airavata.registry.api.RegistryService;
+import org.apache.airavata.registry.api.service.handler.RegistryServerHandler;
+import org.apache.airavata.credential.store.server.CredentialStoreServerHandler;
+import org.apache.airavata.sharing.registry.server.SharingRegistryServerHandler;
 import org.apache.airavata.registry.api.exception.RegistryServiceException;
 import org.apache.airavata.service.security.GatewayGroupsInitializer;
 import org.apache.airavata.service.security.interceptor.SecurityCheck;
 import org.apache.airavata.sharing.registry.models.*;
 import org.apache.airavata.sharing.registry.service.cpi.SharingRegistryService;
-import org.apache.commons.pool2.impl.GenericObjectPoolConfig;
 import org.apache.thrift.TApplicationException;
 import org.apache.thrift.TException;
 import org.slf4j.Logger;
@@ -113,31 +114,20 @@ public class AiravataServerHandler implements Airavata.Iface {
     private Publisher statusPublisher;
     private Publisher experimentPublisher;
 
-    private ThriftClientPool<SharingRegistryService.Client> sharingClientPool;
-    private ThriftClientPool<RegistryService.Client> registryClientPool;
-    private ThriftClientPool<CredentialStoreService.Client> csClientPool;
+    private final RegistryServerHandler registryHandler;
+    private final SharingRegistryServerHandler sharingHandler;
+    private final CredentialStoreServerHandler credentialHandler;
 
-    public AiravataServerHandler() {
+    public AiravataServerHandler(
+            RegistryServerHandler registryHandler,
+            SharingRegistryServerHandler sharingHandler,
+            CredentialStoreServerHandler credentialHandler) {
+        this.registryHandler = registryHandler;
+        this.sharingHandler = sharingHandler;
+        this.credentialHandler = credentialHandler;
         try {
             statusPublisher = MessagingFactory.getPublisher(Type.STATUS);
             experimentPublisher = MessagingFactory.getPublisher(Type.EXPERIMENT_LAUNCH);
-
-            sharingClientPool = new ThriftClientPool<>(
-                    tProtocol -> new SharingRegistryService.Client(tProtocol),
-                    this.<SharingRegistryService.Client>createGenericObjectPoolConfig(),
-                    ServerSettings.getSharingRegistryHost(),
-                    Integer.parseInt(ServerSettings.getSharingRegistryPort()));
-            registryClientPool = new ThriftClientPool<>(
-                    tProtocol -> new RegistryService.Client(tProtocol),
-                    this.<RegistryService.Client>createGenericObjectPoolConfig(),
-                    ServerSettings.getRegistryServerHost(),
-                    Integer.parseInt(ServerSettings.getRegistryServerPort()));
-            csClientPool = new ThriftClientPool<>(
-                    tProtocol -> new CredentialStoreService.Client(tProtocol),
-                    this.<CredentialStoreService.Client>createGenericObjectPoolConfig(),
-                    ServerSettings.getCredentialStoreServerHost(),
-                    Integer.parseInt(ServerSettings.getCredentialStoreServerPort()));
-
             initSharingRegistry();
             postInitDefaultGateway();
         } catch (ApplicationSettingsException e) {
@@ -149,19 +139,10 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
-    private <T> GenericObjectPoolConfig<T> createGenericObjectPoolConfig() {
-
-        GenericObjectPoolConfig<T> poolConfig = new GenericObjectPoolConfig<T>();
-        poolConfig.setMaxTotal(100);
-        poolConfig.setMinIdle(5);
-        poolConfig.setBlockWhenExhausted(true);
-        poolConfig.setTestOnBorrow(true);
-        poolConfig.setTestWhileIdle(true);
-        // must set timeBetweenEvictionRunsMillis since eviction doesn't run unless that is positive
-        poolConfig.setTimeBetweenEvictionRunsMillis(5L * 60L * 1000L);
-        poolConfig.setNumTestsPerEvictionRun(10);
-        poolConfig.setMaxWaitMillis(3000);
-        return poolConfig;
+    public AiravataServerHandler() throws Exception {
+        this(new RegistryServerHandler(),
+             new SharingRegistryServerHandler(),
+             new CredentialStoreServerHandler());
     }
 
     /**
@@ -171,11 +152,10 @@ public class AiravataServerHandler implements Airavata.Iface {
      */
     private void postInitDefaultGateway() {
 
-        RegistryService.Client registryClient = registryClientPool.getResource();
         try {
 
             GatewayResourceProfile gatewayResourceProfile =
-                    registryClient.getGatewayResourceProfile(ServerSettings.getDefaultUserGateway());
+                    registryHandler.getGatewayResourceProfile(ServerSettings.getDefaultUserGateway());
             if (gatewayResourceProfile != null && gatewayResourceProfile.getIdentityServerPwdCredToken() == null) {
 
                 logger.debug("Starting to add the password credential for default gateway : "
@@ -188,20 +168,15 @@ public class AiravataServerHandler implements Airavata.Iface {
                 passwordCredential.setPassword(ServerSettings.getDefaultUserPassword());
                 passwordCredential.setDescription("Credentials for default gateway");
 
-                CredentialStoreService.Client csClient = csClientPool.getResource();
                 String token = null;
                 try {
                     logger.info("Creating password credential for default gateway");
-                    token = csClient.addPasswordCredential(passwordCredential);
-                    csClientPool.returnResource(csClient);
+                    token = credentialHandler.addPasswordCredential(passwordCredential);
                 } catch (Exception ex) {
                     logger.error(
                             "Failed to create the password credential for the default gateway : "
                                     + ServerSettings.getDefaultUserGateway(),
                             ex);
-                    if (csClient != null) {
-                        csClientPool.returnBrokenResource(csClient);
-                    }
                 }
 
                 if (token != null) {
@@ -209,36 +184,31 @@ public class AiravataServerHandler implements Airavata.Iface {
                             + ServerSettings.getDefaultUserGateway());
                     gatewayResourceProfile.setIdentityServerPwdCredToken(token);
                     gatewayResourceProfile.setIdentityServerTenant(ServerSettings.getDefaultUserGateway());
-                    registryClient.updateGatewayResourceProfile(
+                    registryHandler.updateGatewayResourceProfile(
                             ServerSettings.getDefaultUserGateway(), gatewayResourceProfile);
                 }
             }
 
-            registryClientPool.returnResource(registryClient);
         } catch (Exception e) {
             logger.error("Failed to add the password credentials for the default gateway", e);
 
-            if (registryClient != null) {
-                registryClientPool.returnBrokenResource(registryClient);
-            }
         }
     }
 
     private void initSharingRegistry() throws ApplicationSettingsException, TException {
-        SharingRegistryService.Client client = sharingClientPool.getResource();
         try {
-            if (!client.isDomainExists(ServerSettings.getDefaultUserGateway())) {
+            if (!sharingHandler.isDomainExists(ServerSettings.getDefaultUserGateway())) {
                 Domain domain = new Domain();
                 domain.setDomainId(ServerSettings.getDefaultUserGateway());
                 domain.setName(ServerSettings.getDefaultUserGateway());
                 domain.setDescription("Domain entry for " + domain.getName());
-                client.createDomain(domain);
+                sharingHandler.createDomain(domain);
 
                 User user = new User();
                 user.setDomainId(domain.getDomainId());
                 user.setUserId(ServerSettings.getDefaultUser() + "@" + ServerSettings.getDefaultUserGateway());
                 user.setUserName(ServerSettings.getDefaultUser());
-                client.createUser(user);
+                sharingHandler.createUser(user);
 
                 // Creating Entity Types for each domain
                 EntityType entityType = new EntityType();
@@ -246,42 +216,42 @@ public class AiravataServerHandler implements Airavata.Iface {
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName("PROJECT");
                 entityType.setDescription("Project entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
                 entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName("EXPERIMENT");
                 entityType.setDescription("Experiment entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
                 entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName("FILE");
                 entityType.setDescription("File entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
                 entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName("APPLICATION-DEPLOYMENT");
                 entityType.setDescription("Application Deployment entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
                 entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
                 entityType.setDescription("Group Resource Profile entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 entityType = new EntityType();
                 entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.CREDENTIAL_TOKEN.name());
                 entityType.setDomainId(domain.getDomainId());
                 entityType.setName(ResourceType.CREDENTIAL_TOKEN.name());
                 entityType.setDescription("Credential Store Token entity type");
-                client.createEntityType(entityType);
+                sharingHandler.createEntityType(entityType);
 
                 // Creating Permission Types for each domain
                 PermissionType permissionType = new PermissionType();
@@ -289,25 +259,23 @@ public class AiravataServerHandler implements Airavata.Iface {
                 permissionType.setDomainId(domain.getDomainId());
                 permissionType.setName("READ");
                 permissionType.setDescription("Read permission type");
-                client.createPermissionType(permissionType);
+                sharingHandler.createPermissionType(permissionType);
 
                 permissionType = new PermissionType();
                 permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
                 permissionType.setDomainId(domain.getDomainId());
                 permissionType.setName("WRITE");
                 permissionType.setDescription("Write permission type");
-                client.createPermissionType(permissionType);
+                sharingHandler.createPermissionType(permissionType);
 
                 permissionType = new PermissionType();
                 permissionType.setPermissionTypeId(domain.getDomainId() + ":MANAGE_SHARING");
                 permissionType.setDomainId(domain.getDomainId());
                 permissionType.setName("MANAGE_SHARING");
                 permissionType.setDescription("Sharing permission type");
-                client.createPermissionType(permissionType);
+                sharingHandler.createPermissionType(permissionType);
             }
-            sharingClientPool.returnResource(client);
         } catch (Exception ex) {
-            sharingClientPool.returnBrokenResource(client);
             throw ex;
         }
     }
@@ -333,18 +301,15 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean isUserExists(AuthzToken authzToken, String gatewayId, String userName)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client client = registryClientPool.getResource();
         try {
-            boolean isExists = client.isUserExists(gatewayId, userName);
+            boolean isExists = registryHandler.isUserExists(gatewayId, userName);
             logger.debug("Checking if the user" + userName + "exists in the gateway" + gatewayId);
-            registryClientPool.returnResource(client);
             return isExists;
         } catch (Exception e) {
             logger.error("Error while verifying user", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while verifying user. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(client);
             throw exception;
         }
     }
@@ -354,15 +319,13 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String addGateway(AuthzToken authzToken, Gateway gateway)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
-        RegistryService.Client registryClient = registryClientPool.getResource();
         try {
-            String gatewayId = registryClient.addGateway(gateway);
+            String gatewayId = registryHandler.addGateway(gateway);
             Domain domain = new Domain();
             domain.setDomainId(gateway.getGatewayId());
             domain.setName(gateway.getGatewayName());
             domain.setDescription("Domain entry for " + domain.getName());
-            sharingClient.createDomain(domain);
+            sharingHandler.createDomain(domain);
 
             // Creating Entity Types for each domain
             EntityType entityType = new EntityType();
@@ -370,35 +333,35 @@ public class AiravataServerHandler implements Airavata.Iface {
             entityType.setDomainId(domain.getDomainId());
             entityType.setName("PROJECT");
             entityType.setDescription("Project entity type");
-            sharingClient.createEntityType(entityType);
+            sharingHandler.createEntityType(entityType);
 
             entityType = new EntityType();
             entityType.setEntityTypeId(domain.getDomainId() + ":EXPERIMENT");
             entityType.setDomainId(domain.getDomainId());
             entityType.setName("EXPERIMENT");
             entityType.setDescription("Experiment entity type");
-            sharingClient.createEntityType(entityType);
+            sharingHandler.createEntityType(entityType);
 
             entityType = new EntityType();
             entityType.setEntityTypeId(domain.getDomainId() + ":FILE");
             entityType.setDomainId(domain.getDomainId());
             entityType.setName("FILE");
             entityType.setDescription("File entity type");
-            sharingClient.createEntityType(entityType);
+            sharingHandler.createEntityType(entityType);
 
             entityType = new EntityType();
             entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.APPLICATION_DEPLOYMENT.name());
             entityType.setDomainId(domain.getDomainId());
             entityType.setName("APPLICATION-DEPLOYMENT");
             entityType.setDescription("Application Deployment entity type");
-            sharingClient.createEntityType(entityType);
+            sharingHandler.createEntityType(entityType);
 
             entityType = new EntityType();
             entityType.setEntityTypeId(domain.getDomainId() + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
             entityType.setDomainId(domain.getDomainId());
             entityType.setName(ResourceType.GROUP_RESOURCE_PROFILE.name());
             entityType.setDescription("Group Resource Profile entity type");
-            sharingClient.createEntityType(entityType);
+            sharingHandler.createEntityType(entityType);
 
             // Creating Permission Types for each domain
             PermissionType permissionType = new PermissionType();
@@ -406,24 +369,22 @@ public class AiravataServerHandler implements Airavata.Iface {
             permissionType.setDomainId(domain.getDomainId());
             permissionType.setName("READ");
             permissionType.setDescription("Read permission type");
-            sharingClient.createPermissionType(permissionType);
+            sharingHandler.createPermissionType(permissionType);
 
             permissionType = new PermissionType();
             permissionType.setPermissionTypeId(domain.getDomainId() + ":WRITE");
             permissionType.setDomainId(domain.getDomainId());
             permissionType.setName("WRITE");
             permissionType.setDescription("Write permission type");
-            sharingClient.createPermissionType(permissionType);
+            sharingHandler.createPermissionType(permissionType);
 
             permissionType = new PermissionType();
             permissionType.setPermissionTypeId(domain.getDomainId() + ":MANAGE_SHARING");
             permissionType.setDomainId(domain.getDomainId());
             permissionType.setName("MANAGE_SHARING");
             permissionType.setDescription("Sharing permission type");
-            sharingClient.createPermissionType(permissionType);
+            sharingHandler.createPermissionType(permissionType);
 
-            registryClientPool.returnResource(registryClient);
-            sharingClientPool.returnResource(sharingClient);
             logger.debug("Airavata successfully created the gateway with " + gatewayId);
 
             return gatewayId;
@@ -432,8 +393,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding gateway. More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(registryClient);
             throw exception;
         }
     }
@@ -451,17 +410,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<String> getAllUsersInGateway(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<String> result = regClient.getAllUsersInGateway(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<String> result = registryHandler.getAllUsersInGateway(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving users", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving users. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -472,17 +428,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
 
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateGateway(gatewayId, updatedGateway);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateGateway(gatewayId, updatedGateway);
             return result;
         } catch (Exception e) {
             logger.error("Error while updating the gateway", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating the gateway. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -493,10 +446,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
 
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Gateway result = regClient.getGateway(gatewayId);
-            registryClientPool.returnResource(regClient);
+            Gateway result = registryHandler.getGateway(gatewayId);
             logger.debug("Airavata found the gateway with " + gatewayId);
             return result;
         } catch (Exception e) {
@@ -504,7 +455,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting the gateway. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -514,17 +464,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteGateway(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteGateway(gatewayId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteGateway(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while deleting the gateway", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting the gateway. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -534,18 +481,15 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<Gateway> getAllGateways(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             logger.debug("Airavata searching for all gateways");
-            List<Gateway> result = regClient.getAllGateways();
-            registryClientPool.returnResource(regClient);
+            List<Gateway> result = registryHandler.getAllGateways();
             return result;
         } catch (Exception e) {
             logger.error("Error while getting all the gateways", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting all the gateways. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -555,18 +499,15 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean isGatewayExist(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             logger.debug("Airavata verifying if the gateway with " + gatewayId + "exits");
-            boolean result = regClient.isGatewayExist(gatewayId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.isGatewayExist(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while getting gateway", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting gateway. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -583,17 +524,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String createNotification(AuthzToken authzToken, Notification notification)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.createNotification(notification);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.createNotification(notification);
             return result;
         } catch (Exception e) {
             logger.error("Error while creating notification", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while creating notification. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -603,17 +541,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean updateNotification(AuthzToken authzToken, Notification notification)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateNotification(notification);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateNotification(notification);
             return result;
         } catch (Exception e) {
             logger.error("Error while updating notification", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting gateway. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -623,17 +558,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteNotification(AuthzToken authzToken, String gatewayId, String notificationId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteNotification(gatewayId, notificationId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteNotification(gatewayId, notificationId);
             return result;
         } catch (Exception e) {
             logger.error("Error while deleting notification", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting notification. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -643,17 +575,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Notification getNotification(AuthzToken authzToken, String gatewayId, String notificationId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Notification result = regClient.getNotification(gatewayId, notificationId);
-            registryClientPool.returnResource(regClient);
+            Notification result = registryHandler.getNotification(gatewayId, notificationId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving notification", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retreiving notification. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -663,17 +592,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<Notification> getAllNotifications(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<Notification> result = regClient.getAllNotifications(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<Notification> result = registryHandler.getAllNotifications(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while getting all notifications", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting all notifications. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -684,15 +610,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             SSHCredential sshCredential = new SSHCredential();
             sshCredential.setUsername(userName);
             sshCredential.setGatewayId(gatewayId);
             sshCredential.setDescription(description);
-            String key = csClient.addSSHCredential(sshCredential);
+            String key = credentialHandler.addSSHCredential(sshCredential);
             try {
                 Entity entity = new Entity();
                 entity.setEntityId(key);
@@ -701,29 +624,23 @@ public class AiravataServerHandler implements Airavata.Iface {
                 entity.setOwnerId(userName + "@" + gatewayId);
                 entity.setName(key);
                 entity.setDescription(description);
-                sharingClient.createEntity(entity);
+                sharingHandler.createEntity(entity);
             } catch (Exception ex) {
                 logger.error(ex.getMessage(), ex);
                 logger.error("Rolling back ssh key creation for user " + userName + " and description [" + description
                         + "]");
-                csClient.deleteSSHCredential(key, gatewayId);
+                credentialHandler.deleteSSHCredential(key, gatewayId);
                 AiravataSystemException ase = new AiravataSystemException();
                 ase.setMessage("Failed to create sharing registry record");
                 throw ase;
             }
             logger.debug("Airavata generated SSH keys for gateway : " + gatewayId + " and for user : " + userName);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
-            registryClientPool.returnResource(regClient);
             return key;
         } catch (Exception e) {
             logger.error("Error occurred while registering SSH Credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while registering SSH Credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -744,9 +661,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             PasswordCredential pwdCredential = new PasswordCredential();
             pwdCredential.setPortalUserName(userName);
@@ -754,7 +668,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             pwdCredential.setPassword(password);
             pwdCredential.setDescription(description);
             pwdCredential.setGatewayId(gatewayId);
-            String key = csClient.addPasswordCredential(pwdCredential);
+            String key = credentialHandler.addPasswordCredential(pwdCredential);
             try {
                 Entity entity = new Entity();
                 entity.setEntityId(key);
@@ -763,28 +677,24 @@ public class AiravataServerHandler implements Airavata.Iface {
                 entity.setOwnerId(userName + "@" + gatewayId);
                 entity.setName(key);
                 entity.setDescription(description);
-                sharingClient.createEntity(entity);
+                sharingHandler.createEntity(entity);
             } catch (Exception ex) {
                 logger.error(ex.getMessage(), ex);
                 logger.error("Rolling back password registration for user " + userName + " and description ["
                         + description + "]");
-                csClient.deletePWDCredential(key, gatewayId);
+                credentialHandler.deletePWDCredential(key, gatewayId);
                 AiravataSystemException ase = new AiravataSystemException();
                 ase.setMessage("Failed to create sharing registry record");
                 throw ase;
             }
             logger.debug("Airavata generated PWD credential for gateway : " + gatewayId + " and for user : "
                     + loginUserName);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
-            registryClientPool.returnResource(regClient);
             return key;
         } catch (Exception e) {
             logger.error("Error occurred while registering PWD Credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while registering PWD Credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
             throw exception;
         }
     }
@@ -794,31 +704,23 @@ public class AiravataServerHandler implements Airavata.Iface {
     public CredentialSummary getCredentialSummary(AuthzToken authzToken, String tokenId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
-            if (!userHasAccessInternal(sharingClient, authzToken, tokenId, ResourcePermissionType.READ)) {
+            if (!userHasAccessInternal(authzToken, tokenId, ResourcePermissionType.READ)) {
                 throw new AuthorizationException("User does not have permission to access this resource");
             }
-            CredentialSummary credentialSummary = csClient.getCredentialSummary(tokenId, gatewayId);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
+            CredentialSummary credentialSummary = credentialHandler.getCredentialSummary(tokenId, gatewayId);
             logger.debug("Airavata retrived the credential summary for token " + tokenId + "GatewayId: " + gatewayId);
             return credentialSummary;
         } catch (AuthorizationException ae) {
             String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
             logger.info("User " + userName + " not allowed to access credential store token " + tokenId);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
             throw ae;
         } catch (Exception e) {
             String msg = "Error retrieving credential summary for token " + tokenId + ". GatewayId: " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -827,8 +729,6 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public List<CredentialSummary> getAllCredentialSummaries(AuthzToken authzToken, SummaryType type)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
         try {
@@ -839,13 +739,11 @@ public class AiravataServerHandler implements Airavata.Iface {
             searchCriteria.setValue(gatewayId + ":" + ResourceType.CREDENTIAL_TOKEN.name());
             filters.add(searchCriteria);
             List<String> accessibleTokenIds =
-                    sharingClient.searchEntities(gatewayId, userName + "@" + gatewayId, filters, 0, -1).stream()
+                    sharingHandler.searchEntities(gatewayId, userName + "@" + gatewayId, filters, 0, -1).stream()
                             .map(p -> p.getEntityId())
                             .collect(Collectors.toList());
             List<CredentialSummary> credentialSummaries =
-                    csClient.getAllCredentialSummaries(type, accessibleTokenIds, gatewayId);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
+                    credentialHandler.getAllCredentialSummaries(type, accessibleTokenIds, gatewayId);
             logger.debug(
                     "Airavata successfully retrived credential summaries of type " + type + " GatewayId: " + gatewayId);
             return credentialSummaries;
@@ -854,8 +752,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -864,34 +760,26 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public boolean deleteSSHPubKey(AuthzToken authzToken, String airavataCredStoreToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
             if (!userHasAccessInternal(
-                    sharingClient, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
+                    authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
                 throw new AuthorizationException("User does not have permission to delete this resource.");
             }
             logger.debug("Airavata deleted SSH pub key for gateway Id : " + gatewayId + " and with token id : "
                     + airavataCredStoreToken);
-            boolean result = csClient.deleteSSHCredential(airavataCredStoreToken, gatewayId);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = credentialHandler.deleteSSHCredential(airavataCredStoreToken, gatewayId);
             return result;
         } catch (AuthorizationException ae) {
             String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
             logger.info("User " + userName + " not allowed to delete (no WRITE permission) credential store token "
                     + airavataCredStoreToken);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
             throw ae;
         } catch (Exception e) {
             logger.error("Error occurred while deleting SSH credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while deleting SSH credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -900,34 +788,26 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public boolean deletePWDCredential(AuthzToken authzToken, String airavataCredStoreToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, TException {
-        CredentialStoreService.Client csClient = csClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
             if (!userHasAccessInternal(
-                    sharingClient, authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
+                    authzToken, airavataCredStoreToken, ResourcePermissionType.WRITE)) {
                 throw new AuthorizationException("User does not have permission to delete this resource.");
             }
             logger.debug("Airavata deleted PWD credential for gateway Id : " + gatewayId + " and with token id : "
                     + airavataCredStoreToken);
-            boolean result = csClient.deletePWDCredential(airavataCredStoreToken, gatewayId);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = credentialHandler.deletePWDCredential(airavataCredStoreToken, gatewayId);
             return result;
         } catch (AuthorizationException ae) {
             String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
             logger.info("User " + userName + " not allowed to delete (no WRITE permission) credential store token "
                     + airavataCredStoreToken);
-            csClientPool.returnResource(csClient);
-            sharingClientPool.returnResource(sharingClient);
             throw ae;
         } catch (Exception e) {
             logger.error("Error occurred while deleting PWD credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while deleting PWD credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -943,10 +823,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
         // TODO: verify that gatewayId and project.gatewayId match authzToken
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            String projectId = regClient.createProject(gatewayId, project);
+            String projectId = registryHandler.createProject(gatewayId, project);
             if (ServerSettings.isEnableSharing()) {
                 try {
                     Entity entity = new Entity();
@@ -957,27 +835,23 @@ public class AiravataServerHandler implements Airavata.Iface {
                     entity.setOwnerId(project.getOwner() + "@" + domainId);
                     entity.setName(project.getName());
                     entity.setDescription(project.getDescription());
-                    sharingClient.createEntity(entity);
+                    sharingHandler.createEntity(entity);
                 } catch (Exception ex) {
                     logger.error(ex.getMessage(), ex);
                     logger.error("Rolling back project creation Proj ID : " + projectId);
-                    regClient.deleteProject(projectId);
+                    registryHandler.deleteProject(projectId);
                     AiravataSystemException ase = new AiravataSystemException();
                     ase.setMessage("Failed to create entry for project in Sharing Registry");
                     throw ase;
                 }
             }
             logger.debug("Airavata created project with project Id : " + projectId + " for gateway Id : " + gatewayId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return projectId;
         } catch (Exception e) {
             logger.error("Error while creating the project", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while creating the project. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -987,10 +861,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public void updateProject(AuthzToken authzToken, String projectId, Project updatedProject)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
                     AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            Project existingProject = regClient.getProject(projectId);
+            Project existingProject = registryHandler.getProject(projectId);
             if (ServerSettings.isEnableSharing()
                             && !authzToken
                                     .getClaimsMap()
@@ -1003,7 +875,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
@@ -1017,17 +889,13 @@ public class AiravataServerHandler implements Airavata.Iface {
             if (!updatedProject.getGatewayId().equals(existingProject.getGatewayId())) {
                 throw new InvalidRequestException("Gateway ID of a project cannot be changed");
             }
-            regClient.updateProject(projectId, updatedProject);
+            registryHandler.updateProject(projectId, updatedProject);
             logger.debug("Airavata updated project with project Id : " + projectId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
         } catch (Exception e) {
             logger.error("Error while updating the project", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating the project. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1037,10 +905,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteProject(AuthzToken authzToken, String projectId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
                     AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            Project existingProject = regClient.getProject(projectId);
+            Project existingProject = registryHandler.getProject(projectId);
             if (ServerSettings.isEnableSharing()
                             && !authzToken
                                     .getClaimsMap()
@@ -1053,7 +919,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
@@ -1061,17 +927,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AuthorizationException("User does not have permission to access this resource");
                 }
             }
-            boolean ret = regClient.deleteProject(projectId);
+            boolean ret = registryHandler.deleteProject(projectId);
             logger.debug("Airavata deleted project with project Id : " + projectId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return ret;
         } catch (Exception e) {
             logger.error("Error while removing the project", e);
             ProjectNotFoundException exception = new ProjectNotFoundException();
             exception.setMessage("Error while removing the project. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1094,10 +956,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Project getProject(AuthzToken authzToken, String projectId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
                     AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            Project project = regClient.getProject(projectId);
+            Project project = registryHandler.getProject(projectId);
             if (authzToken
                             .getClaimsMap()
                             .get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -1106,34 +966,26 @@ public class AiravataServerHandler implements Airavata.Iface {
                             .getClaimsMap()
                             .get(org.apache.airavata.common.utils.Constants.GATEWAY_ID)
                             .equals(project.getGatewayId())) {
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
                 return project;
             } else if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":READ")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
-                    registryClientPool.returnResource(regClient);
-                    sharingClientPool.returnResource(sharingClient);
                     return project;
                 } catch (Exception e) {
                     throw new AuthorizationException("User does not have permission to access this resource");
                 }
             } else {
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
                 return null;
             }
         } catch (Exception e) {
             logger.error("Error while retrieving the project", e);
             ProjectNotFoundException exception = new ProjectNotFoundException();
             exception.setMessage("Error while retrieving the project. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1157,8 +1009,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayId, String userName, int limit, int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 // user projects + user accessible projects
@@ -1169,7 +1019,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 searchCriteria.setSearchCondition(SearchCondition.EQUAL);
                 searchCriteria.setValue(gatewayId + ":PROJECT");
                 filters.add(searchCriteria);
-                sharingClient
+                sharingHandler
                         .searchEntities(
                                 authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                                 userName + "@" + gatewayId,
@@ -1182,16 +1032,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                 if (accessibleProjectIds.isEmpty()) {
                     result = Collections.emptyList();
                 } else {
-                    result = regClient.searchProjects(
+                    result = registryHandler.searchProjects(
                             gatewayId, userName, accessibleProjectIds, new HashMap<>(), limit, offset);
                 }
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
                 return result;
             } else {
-                List<Project> result = regClient.getUserProjects(gatewayId, userName, limit, offset);
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
+                List<Project> result = registryHandler.getUserProjects(gatewayId, userName, limit, offset);
                 return result;
             }
 
@@ -1200,8 +1046,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1239,8 +1083,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             List<String> accessibleProjIds = new ArrayList<>();
 
@@ -1252,7 +1094,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 searchCriteria.setSearchCondition(SearchCondition.EQUAL);
                 searchCriteria.setValue(gatewayId + ":PROJECT");
                 sharingFilters.add(searchCriteria);
-                sharingClient
+                sharingHandler
                         .searchEntities(
                                 authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                                 userName + "@" + gatewayId,
@@ -1264,21 +1106,17 @@ public class AiravataServerHandler implements Airavata.Iface {
                 if (accessibleProjIds.isEmpty()) {
                     result = Collections.emptyList();
                 } else {
-                    result = regClient.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
+                    result = registryHandler.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
                 }
             } else {
-                result = regClient.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
+                result = registryHandler.searchProjects(gatewayId, userName, accessibleProjIds, filters, limit, offset);
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving projects", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving projects. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1309,8 +1147,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             List<String> accessibleExpIds = new ArrayList<>();
             Map<ExperimentSearchFields, String> filtersCopy = new HashMap<>(filters);
@@ -1380,7 +1216,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 searchOffset = offset;
                 searchLimit = limit;
             }
-            sharingClient
+            sharingHandler
                     .searchEntities(
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                             userName + "@" + gatewayId,
@@ -1394,17 +1230,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                 finalOffset = 0;
             }
             List<ExperimentSummaryModel> result =
-                    regClient.searchExperiments(gatewayId, userName, accessibleExpIds, filtersCopy, limit, finalOffset);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.searchExperiments(gatewayId, userName, accessibleExpIds, filtersCopy, limit, finalOffset);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving experiments", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1436,8 +1268,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        // SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             // FIXME: re-enable experiment statistics for non-admin users
             // Find accessible experiments in date range
@@ -1459,12 +1289,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             // toCreatedTimeCriteria.setValue(Long.toString(toTime));
             // sharingFilters.add(toCreatedTimeCriteria);
             // String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-            // sharingClient.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
+            // sharingHandler.searchEntities(authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
             //         userId + "@" + gatewayId, sharingFilters, 0, Integer.MAX_VALUE).forEach(e ->
             // accessibleExpIds.add(e.getEntityId()));
             List<String> accessibleExpIds = null;
 
-            ExperimentStatistics result = regClient.getExperimentStatistics(
+            ExperimentStatistics result = registryHandler.getExperimentStatistics(
                     gatewayId,
                     fromTime,
                     toTime,
@@ -1474,16 +1304,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     accessibleExpIds,
                     limit,
                     offset);
-            registryClientPool.returnResource(regClient);
-            // sharingClientPool.returnResource(sharingClient);
+
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving experiments", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving experiments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            // sharingClientPool.returnBrokenResource(sharingClient);
+
             throw exception;
         }
     }
@@ -1504,10 +1332,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<ExperimentModel> getExperimentsInProject(AuthzToken authzToken, String projectId, int limit, int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, ProjectNotFoundException,
                     AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            Project project = regClient.getProject(projectId);
+            Project project = registryHandler.getProject(projectId);
 
             String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
             if (ServerSettings.isEnableSharing()
@@ -1521,7 +1347,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                             .equals(project.getGatewayId())) {
                 try {
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, projectId, gatewayId + ":READ")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
@@ -1529,17 +1355,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AuthorizationException("User does not have permission to access this resource");
                 }
             }
-            List<ExperimentModel> result = regClient.getExperimentsInProject(gatewayId, projectId, limit, offset);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            List<ExperimentModel> result = registryHandler.getExperimentsInProject(gatewayId, projectId, limit, offset);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving the experiments", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the experiments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1563,20 +1385,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayId, String userName, int limit, int offset)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            List<ExperimentModel> result = regClient.getUserExperiments(gatewayId, userName, limit, offset);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            List<ExperimentModel> result = registryHandler.getUserExperiments(gatewayId, userName, limit, offset);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving the experiments", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the experiments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1610,10 +1426,8 @@ public class AiravataServerHandler implements Airavata.Iface {
                     TException {
         // TODO: verify that gatewayId and experiment.gatewayId match authzToken
         logger.info("Api server accepted experiment creation with name {}", experiment.getExperimentName());
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            String experimentId = regClient.createExperiment(gatewayId, experiment);
+            String experimentId = registryHandler.createExperiment(gatewayId, experiment);
 
             if (ServerSettings.isEnableSharing()) {
                 try {
@@ -1627,12 +1441,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     entity.setDescription(experiment.getDescription());
                     entity.setParentEntityId(experiment.getProjectId());
 
-                    sharingClient.createEntity(entity);
-                    shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+                    sharingHandler.createEntity(entity);
+                    shareEntityWithAdminGatewayGroups(entity);
                 } catch (Exception ex) {
                     logger.error(ex.getMessage(), ex);
                     logger.error("Rolling back experiment creation Exp ID : " + experimentId);
-                    regClient.deleteExperiment(experimentId);
+                    registryHandler.deleteExperiment(experimentId);
                     AiravataSystemException ase = new AiravataSystemException();
                     ase.setMessage("Failed to create sharing registry record");
                     throw ase;
@@ -1654,16 +1468,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     "Created new experiment with experiment name {} and id ",
                     experiment.getExperimentName(),
                     experimentId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return experimentId;
         } catch (Exception e) {
             logger.error("Error while creating the experiment with experiment name {}", experiment.getExperimentName());
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while creating the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1684,10 +1494,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteExperiment(AuthzToken authzToken, String experimentId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            ExperimentModel experimentModel = regClient.getExperiment(experimentId);
+            ExperimentModel experimentModel = registryHandler.getExperiment(experimentId);
 
             if (ServerSettings.isEnableSharing()
                             && !authzToken
@@ -1701,7 +1509,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, experimentId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
@@ -1715,17 +1523,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                 throw new RegistryServiceException(
                         "Experiment is not in CREATED state. Hence cannot deleted. ID:" + experimentId);
             }
-            boolean result = regClient.deleteExperiment(experimentId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.deleteExperiment(experimentId);
             return result;
         } catch (Exception e) {
             logger.error("Error while deleting the experiment", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1757,11 +1561,9 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ExperimentModel getExperiment(AuthzToken authzToken, String airavataExperimentId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         ExperimentModel experimentModel = null;
         try {
-            experimentModel = regClient.getExperiment(airavataExperimentId);
+            experimentModel = registryHandler.getExperiment(airavataExperimentId);
             if (authzToken
                             .getClaimsMap()
                             .get(org.apache.airavata.common.utils.Constants.USER_NAME)
@@ -1770,40 +1572,30 @@ public class AiravataServerHandler implements Airavata.Iface {
                             .getClaimsMap()
                             .get(org.apache.airavata.common.utils.Constants.GATEWAY_ID)
                             .equals(experimentModel.getGatewayId())) {
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
                 return experimentModel;
             } else if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, airavataExperimentId, gatewayId + ":READ")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
-                    registryClientPool.returnResource(regClient);
-                    sharingClientPool.returnResource(sharingClient);
                     return experimentModel;
                 } catch (Exception e) {
                     throw new AuthorizationException("User does not have permission to access this resource");
                 }
             } else {
-                registryClientPool.returnResource(regClient);
-                sharingClientPool.returnResource(sharingClient);
                 return null;
             }
         } catch (ExperimentNotFoundException e) {
             logger.error(e.getMessage(), e);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw e;
         } catch (Exception e) {
             logger.error("Error while getting the experiment", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1813,12 +1605,10 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ExperimentModel getExperimentByAdmin(AuthzToken authzToken, String airavataExperimentId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         ExperimentModel experimentModel = null;
         try {
             String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
-            experimentModel = regClient.getExperiment(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
+            experimentModel = registryHandler.getExperiment(airavataExperimentId);
             if (gatewayId.equals(experimentModel.getGatewayId())) {
                 return experimentModel;
             } else {
@@ -1829,7 +1619,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while getting the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -1862,20 +1651,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ExperimentModel getDetailedExperimentTree(AuthzToken authzToken, String airavataExperimentId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            ExperimentModel result = regClient.getDetailedExperimentTree(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            ExperimentModel result = registryHandler.getDetailedExperimentTree(airavataExperimentId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving the experiment", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1909,10 +1692,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public void updateExperiment(AuthzToken authzToken, String airavataExperimentId, ExperimentModel experiment)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            ExperimentModel experimentModel = regClient.getExperiment(airavataExperimentId);
+            ExperimentModel experimentModel = registryHandler.getExperiment(airavataExperimentId);
             String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
             if (ServerSettings.isEnableSharing()
                             && !authzToken
@@ -1926,7 +1707,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 try {
                     // Verify WRITE access
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, airavataExperimentId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException("User does not have permission to access this resource");
                     }
@@ -1938,25 +1719,21 @@ public class AiravataServerHandler implements Airavata.Iface {
             try {
                 // Update name, description and parent on Entity
                 // TODO: update the experiment via a DB event
-                Entity entity = sharingClient.getEntity(gatewayId, airavataExperimentId);
+                Entity entity = sharingHandler.getEntity(gatewayId, airavataExperimentId);
                 entity.setName(experiment.getExperimentName());
                 entity.setDescription(experiment.getDescription());
                 entity.setParentEntityId(experiment.getProjectId());
-                sharingClient.updateEntity(entity);
+                sharingHandler.updateEntity(entity);
             } catch (Exception e) {
                 throw new Exception("Failed to update entity in sharing registry", e);
             }
 
-            regClient.updateExperiment(airavataExperimentId, experiment);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            registryHandler.updateExperiment(airavataExperimentId, experiment);
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while updating experiment", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -1966,10 +1743,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public void updateExperimentConfiguration(
             AuthzToken authzToken, String airavataExperimentId, UserConfigurationDataModel userConfiguration)
             throws AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            regClient.updateExperimentConfiguration(airavataExperimentId, userConfiguration);
-            registryClientPool.returnResource(regClient);
+            registryHandler.updateExperimentConfiguration(airavataExperimentId, userConfiguration);
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while updating user configuration", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -1979,7 +1754,6 @@ public class AiravataServerHandler implements Airavata.Iface {
                             + "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
                             + "experiment is in one of above statuses...  "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -1989,10 +1763,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public void updateResourceScheduleing(
             AuthzToken authzToken, String airavataExperimentId, ComputationalResourceSchedulingModel resourceScheduling)
             throws AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            regClient.updateResourceScheduleing(airavataExperimentId, resourceScheduling);
-            registryClientPool.returnResource(regClient);
+            registryHandler.updateResourceScheduleing(airavataExperimentId, resourceScheduling);
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while updating scheduling info", e);
             AiravataSystemException exception = new AiravataSystemException();
@@ -2002,7 +1774,6 @@ public class AiravataServerHandler implements Airavata.Iface {
                             + "with status CREATED, VALIDATED, CANCELLED, FAILED and UNKNOWN. Make sure the given "
                             + "experiment is in one of above statuses...  "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2023,7 +1794,7 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean validateExperiment(AuthzToken authzToken, String airavataExperimentId) throws TException {
         // TODO - call validation module and validate experiment
         /*     	try {
-                 ExperimentModel experimentModel = regClient.getExperiment(airavataExperimentId);
+                 ExperimentModel experimentModel = registryHandler.getExperiment(airavataExperimentId);
         	if (experimentModel == null) {
                      logger.error(airavataExperimentId, "Experiment validation failed , experiment {} doesn't exist.", airavataExperimentId);
                      throw new ExperimentNotFoundException("Requested experiment id " + airavataExperimentId + " does not exist in the system..");
@@ -2079,15 +1850,12 @@ public class AiravataServerHandler implements Airavata.Iface {
     @Override
     @SecurityCheck
     public ExperimentStatus getExperimentStatus(AuthzToken authzToken, String airavataExperimentId) throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ExperimentStatus result = regClient.getExperimentStatus(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
+            ExperimentStatus result = registryHandler.getExperimentStatus(airavataExperimentId);
             return result;
         } catch (Exception e) {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setMessage(e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2096,17 +1864,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public List<OutputDataObjectType> getExperimentOutputs(AuthzToken authzToken, String airavataExperimentId)
             throws AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<OutputDataObjectType> result = regClient.getExperimentOutputs(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
+            List<OutputDataObjectType> result = registryHandler.getExperimentOutputs(airavataExperimentId);
             return result;
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while retrieving the experiment outputs", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the experiment outputs. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2125,20 +1890,18 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
 
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
 
             // Verify that user has WRITE access to experiment
             final boolean hasAccess = userHasAccessInternal(
-                    sharingClient, authzToken, airavataExperimentId, ResourcePermissionType.WRITE);
+                    authzToken, airavataExperimentId, ResourcePermissionType.WRITE);
             if (!hasAccess) {
                 throw new AuthorizationException("User does not have WRITE access to this experiment");
             }
 
             // Verify that the experiment's job is currently ACTIVE
-            ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
-            List<JobModel> jobs = regClient.getJobDetails(airavataExperimentId);
+            ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
+            List<JobModel> jobs = registryHandler.getJobDetails(airavataExperimentId);
             boolean anyJobIsActive = jobs.stream().anyMatch(j -> {
                 if (j.getJobStatusesSize() > 0) {
                     return j.getJobStatuses().get(j.getJobStatusesSize() - 1).getJobState() == JobState.ACTIVE;
@@ -2174,12 +1937,8 @@ public class AiravataServerHandler implements Airavata.Iface {
 
             String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
             submitExperimentIntermediateOutputsEvent(gatewayId, airavataExperimentId, outputNames);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
         } catch (InvalidRequestException | AuthorizationException e) {
             logger.error(e.getMessage(), e);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw e;
         } catch (Exception e) {
             logger.error(
@@ -2191,8 +1950,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while processing request to fetch intermediate outputs for experiment. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -2203,18 +1960,16 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String airavataExperimentId, List<String> outputNames)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
 
             // Verify that user has READ access to experiment
             final boolean hasAccess =
-                    userHasAccessInternal(sharingClient, authzToken, airavataExperimentId, ResourcePermissionType.READ);
+                    userHasAccessInternal(authzToken, airavataExperimentId, ResourcePermissionType.READ);
             if (!hasAccess) {
                 throw new AuthorizationException("User does not have WRITE access to this experiment");
             }
 
-            ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
+            ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
 
             // Find the most recent intermediate output fetching process for the outputNames
             // Assumption: only one of these output fetching processes runs at a
@@ -2245,13 +2000,9 @@ public class AiravataServerHandler implements Airavata.Iface {
                 result = new ProcessStatus(ProcessState.CREATED);
             }
 
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (InvalidRequestException | AuthorizationException e) {
             logger.debug(e.getMessage(), e);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw e;
         } catch (Exception e) {
             logger.error(
@@ -2263,8 +2014,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while processing request to fetch intermediate outputs for experiment. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -2272,17 +2021,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public Map<String, JobStatus> getJobStatuses(AuthzToken authzToken, String airavataExperimentId)
             throws AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Map<String, JobStatus> result = regClient.getJobStatuses(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
+            Map<String, JobStatus> result = registryHandler.getJobStatuses(airavataExperimentId);
             return result;
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while retrieving the job statuses", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the job statuses. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2292,17 +2038,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<JobModel> getJobDetails(AuthzToken authzToken, String airavataExperimentId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<JobModel> result = regClient.getJobDetails(airavataExperimentId);
-            registryClientPool.returnResource(regClient);
+            List<JobModel> result = registryHandler.getJobDetails(airavataExperimentId);
             return result;
         } catch (Exception e) {
             logger.error(airavataExperimentId, "Error while retrieving the job details", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the job details. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2340,10 +2083,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws AuthorizationException, AiravataSystemException, TException {
         // TODO: verify that gatewayId matches gatewayId in authzToken
         logger.info("Launching experiment {}", airavataExperimentId);
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            ExperimentModel experiment = regClient.getExperiment(airavataExperimentId);
+            ExperimentModel experiment = registryHandler.getExperiment(airavataExperimentId);
 
             if (experiment == null) {
                 logger.error(
@@ -2369,7 +2110,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                             airavataExperimentId,
                             groupResourceProfileId);
                     experiment.getUserConfigurationData().setGroupResourceProfileId(groupResourceProfileId);
-                    regClient.updateExperimentConfiguration(
+                    registryHandler.updateExperimentConfiguration(
                             airavataExperimentId, experiment.getUserConfigurationData());
                 } else {
                     throw new AuthorizationException("User " + username + " in gateway " + gatewayId
@@ -2378,7 +2119,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             }
 
             // Verify user has READ access to groupResourceProfileId
-            if (!sharingClient.userHasAccess(
+            if (!sharingHandler.userHasAccess(
                     gatewayId,
                     username + "@" + gatewayId,
                     experiment.getUserConfigurationData().getGroupResourceProfileId(),
@@ -2391,14 +2132,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             // Verify user has READ access to Application Deployment
             final String appInterfaceId = experiment.getExecutionId();
             ApplicationInterfaceDescription applicationInterfaceDescription =
-                    regClient.getApplicationInterface(appInterfaceId);
+                    registryHandler.getApplicationInterface(appInterfaceId);
 
             List<String> appModuleIds = applicationInterfaceDescription.getApplicationModules();
             // Assume that there is only one app module for this interface (otherwise, how could we figure out the
             // deployment)
             String appModuleId = appModuleIds.get(0);
             List<ApplicationDeploymentDescription> applicationDeploymentDescriptions =
-                    regClient.getApplicationDeployments(appModuleId);
+                    registryHandler.getApplicationDeployments(appModuleId);
 
             if (!experiment.getUserConfigurationData().isAiravataAutoSchedule()) {
                 final String resourceHostId = experiment
@@ -2413,7 +2154,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 if (applicationDeploymentDescription.isPresent()) {
                     final String appDeploymentId =
                             applicationDeploymentDescription.get().getAppDeploymentId();
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, username + "@" + gatewayId, appDeploymentId, gatewayId + ":READ")) {
                         throw new AuthorizationException("User " + username + " in gateway " + gatewayId
                                 + " doesn't have access to app deployment " + appDeploymentId);
@@ -2437,7 +2178,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                     if (applicationDeploymentDescription.isPresent()) {
                         final String appDeploymentId =
                                 applicationDeploymentDescription.get().getAppDeploymentId();
-                        if (!sharingClient.userHasAccess(
+                        if (!sharingHandler.userHasAccess(
                                 gatewayId, username + "@" + gatewayId, appDeploymentId, gatewayId + ":READ")) {
                             throw new AuthorizationException("User " + username + " in gateway " + gatewayId
                                     + " doesn't have access to app deployment " + appDeploymentId);
@@ -2448,20 +2189,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             submitExperiment(gatewayId, airavataExperimentId);
             logger.info("Experiment with ExpId: " + airavataExperimentId + " was submitted in gateway with gatewayID: "
                     + gatewayId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
         } catch (InvalidRequestException | ExperimentNotFoundException | AuthorizationException e) {
             logger.error(e.getMessage(), e);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw e;
         } catch (Exception e1) {
             logger.error(airavataExperimentId, "Error while instantiate the registry instance", e1);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while instantiate the registry instance. More info : " + e1.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -2523,21 +2258,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, ProjectNotFoundException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             // getExperiment will apply sharing permissions
             ExperimentModel existingExperiment = this.getExperiment(authzToken, existingExperimentID);
             String result = cloneExperimentInternal(
-                    regClient,
-                    sharingClient,
                     authzToken,
                     existingExperimentID,
                     newExperimentName,
                     newExperimentProjectId,
                     existingExperiment);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (Exception e) {
             logger.error(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
@@ -2545,8 +2274,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while cloning the experiment with existing configuration. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -2557,21 +2284,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String existingExperimentID, String newExperimentName, String newExperimentProjectId)
             throws InvalidRequestException, ExperimentNotFoundException, AiravataClientException,
                     AiravataSystemException, AuthorizationException, ProjectNotFoundException, TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             // get existing experiment by bypassing normal sharing permissions for the admin user
             ExperimentModel existingExperiment = this.getExperimentByAdmin(authzToken, existingExperimentID);
             String result = cloneExperimentInternal(
-                    regClient,
-                    sharingClient,
                     authzToken,
                     existingExperimentID,
                     newExperimentName,
                     newExperimentProjectId,
                     existingExperiment);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (Exception e) {
             logger.error(existingExperimentID, "Error while cloning the experiment with existing configuration...", e);
@@ -2579,15 +2300,11 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while cloning the experiment with existing configuration. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
 
     private String cloneExperimentInternal(
-            RegistryService.Client regClient,
-            SharingRegistryService.Client sharingClient,
             AuthzToken authzToken,
             String existingExperimentID,
             String newExperimentName,
@@ -2621,7 +2338,7 @@ public class AiravataServerHandler implements Airavata.Iface {
         // make sure user has write access to the project
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        if (!sharingClient.userHasAccess(
+        if (!sharingHandler.userHasAccess(
                 gatewayId, userId + "@" + gatewayId, existingExperiment.getProjectId(), gatewayId + ":WRITE")) {
             logger.error(
                     "Error while cloning experiment {}, user doesn't have write access to project {}",
@@ -2633,7 +2350,7 @@ public class AiravataServerHandler implements Airavata.Iface {
         existingExperiment.setCreationTime(AiravataUtils.getCurrentTimestamp().getTime());
         if (existingExperiment.getExecutionId() != null) {
             List<OutputDataObjectType> applicationOutputs =
-                    regClient.getApplicationOutputs(existingExperiment.getExecutionId());
+                    registryHandler.getApplicationOutputs(existingExperiment.getExecutionId());
             existingExperiment.setExperimentOutputs(applicationOutputs);
         }
         if (validateString(newExperimentName)) {
@@ -2654,14 +2371,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     .getComputationalResourceScheduling()
                     .getResourceHostId();
 
-            ComputeResourceDescription computeResourceDescription = regClient.getComputeResource(compResourceId);
+            ComputeResourceDescription computeResourceDescription = registryHandler.getComputeResource(compResourceId);
             if (!computeResourceDescription.isEnabled()) {
                 existingExperiment.getUserConfigurationData().setComputationalResourceScheduling(null);
             }
         }
         logger.debug("Airavata cloned experiment with experiment id : " + existingExperimentID);
         existingExperiment.setUserName(userId);
-        String expId = regClient.createExperiment(gatewayId, existingExperiment);
+        String expId = registryHandler.createExperiment(gatewayId, existingExperiment);
 
         if (ServerSettings.isEnableSharing()) {
             try {
@@ -2673,12 +2390,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                 entity.setOwnerId(existingExperiment.getUserName() + "@" + domainId);
                 entity.setName(existingExperiment.getExperimentName());
                 entity.setDescription(existingExperiment.getDescription());
-                sharingClient.createEntity(entity);
-                shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+                sharingHandler.createEntity(entity);
+                shareEntityWithAdminGatewayGroups(entity);
             } catch (Exception ex) {
                 logger.error(ex.getMessage(), ex);
                 logger.error("rolling back experiment creation Exp ID : " + expId);
-                regClient.deleteExperiment(expId);
+                registryHandler.deleteExperiment(expId);
             }
         }
 
@@ -2710,10 +2427,9 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public void terminateExperiment(AuthzToken authzToken, String airavataExperimentId, String gatewayId)
             throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ExperimentModel existingExperiment = regClient.getExperiment(airavataExperimentId);
-            ExperimentStatus experimentLastStatus = regClient.getExperimentStatus(airavataExperimentId);
+            ExperimentModel existingExperiment = registryHandler.getExperiment(airavataExperimentId);
+            ExperimentStatus experimentLastStatus = registryHandler.getExperimentStatus(airavataExperimentId);
             if (existingExperiment == null) {
                 logger.error(
                         airavataExperimentId,
@@ -2743,13 +2459,11 @@ public class AiravataServerHandler implements Airavata.Iface {
                     logger.debug("Airavata cancelled experiment with experiment id : " + airavataExperimentId);
                     break;
             }
-            registryClientPool.returnResource(regClient);
         } catch (RegistryServiceException | AiravataException e) {
             logger.error(airavataExperimentId, "Error while cancelling the experiment...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while cancelling the experiment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2767,17 +2481,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayId, ApplicationModule applicationModule)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerApplicationModule(gatewayId, applicationModule);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerApplicationModule(gatewayId, applicationModule);
             return result;
         } catch (Exception e) {
             logger.error("Error while adding application module...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding application module. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2794,17 +2505,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ApplicationModule getApplicationModule(AuthzToken authzToken, String appModuleId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ApplicationModule result = regClient.getApplicationModule(appModuleId);
-            registryClientPool.returnResource(regClient);
+            ApplicationModule result = registryHandler.getApplicationModule(appModuleId);
             return result;
         } catch (Exception e) {
             logger.error(appModuleId, "Error while retrieving application module...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving the adding application module. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2823,17 +2531,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String appModuleId, ApplicationModule applicationModule)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateApplicationModule(appModuleId, applicationModule);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateApplicationModule(appModuleId, applicationModule);
             return result;
         } catch (Exception e) {
             logger.error(appModuleId, "Error while updating application module...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating application module. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2849,17 +2554,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<ApplicationModule> getAllAppModules(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<ApplicationModule> result = regClient.getAllAppModules(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<ApplicationModule> result = registryHandler.getAllAppModules(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving all application modules...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving all application modules. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2875,9 +2577,7 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<ApplicationModule> getAccessibleAppModules(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             List<String> accessibleAppDeploymentIds = new ArrayList<>();
             if (ServerSettings.isEnableSharing()) {
@@ -2892,7 +2592,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
                 permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
                 sharingFilters.add(permissionTypeFilter);
-                sharingClient
+                sharingHandler
                         .searchEntities(
                                 authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                                 userName + "@" + gatewayId,
@@ -2911,18 +2611,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     accessibleComputeResourceIds.add(groupComputeResourcePreference.getComputeResourceId());
                 }
             }
-            List<ApplicationModule> result = regClient.getAccessibleAppModules(
+            List<ApplicationModule> result = registryHandler.getAccessibleAppModules(
                     gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving all application modules...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving all application modules. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -2939,17 +2635,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteApplicationModule(AuthzToken authzToken, String appModuleId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteApplicationModule(appModuleId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteApplicationModule(appModuleId);
             return result;
         } catch (Exception e) {
             logger.error(appModuleId, "Error while deleting application module...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting the application module. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -2967,10 +2660,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
         // TODO: verify that gatewayId matches authzToken gatewayId
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            String result = regClient.registerApplicationDeployment(gatewayId, applicationDeployment);
+            String result = registryHandler.registerApplicationDeployment(gatewayId, applicationDeployment);
             Entity entity = new Entity();
             entity.setEntityId(result);
             final String domainId = gatewayId;
@@ -2980,18 +2671,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             entity.setOwnerId(userName + "@" + domainId);
             entity.setName(result);
             entity.setDescription(applicationDeployment.getAppDeploymentDescription());
-            sharingClient.createEntity(entity);
-            shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            sharingHandler.createEntity(entity);
+            shareEntityWithAdminGatewayGroups(entity);
             return result;
         } catch (Exception e) {
             logger.error("Error while adding application deployment...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding application deployment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3008,28 +2695,22 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ApplicationDeploymentDescription getApplicationDeployment(AuthzToken authzToken, String appDeploymentId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 final boolean hasAccess =
-                        userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.READ);
+                        userHasAccessInternal(authzToken, appDeploymentId, ResourcePermissionType.READ);
                 if (!hasAccess) {
                     throw new AuthorizationException(
                             "User does not have access to application deployment " + appDeploymentId);
                 }
             }
-            ApplicationDeploymentDescription result = regClient.getApplicationDeployment(appDeploymentId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            ApplicationDeploymentDescription result = registryHandler.getApplicationDeployment(appDeploymentId);
             return result;
         } catch (Exception e) {
             logger.error(appDeploymentId, "Error while retrieving application deployment...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application deployment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3048,28 +2729,22 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String appDeploymentId, ApplicationDeploymentDescription applicationDeployment)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 final boolean hasAccess =
-                        userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
+                        userHasAccessInternal(authzToken, appDeploymentId, ResourcePermissionType.WRITE);
                 if (!hasAccess) {
                     throw new AuthorizationException(
                             "User does not have WRITE access to application deployment " + appDeploymentId);
                 }
             }
-            boolean result = regClient.updateApplicationDeployment(appDeploymentId, applicationDeployment);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.updateApplicationDeployment(appDeploymentId, applicationDeployment);
             return result;
         } catch (Exception e) {
             logger.error(appDeploymentId, "Error while updating application deployment...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating application deployment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3086,28 +2761,22 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteApplicationDeployment(AuthzToken authzToken, String appDeploymentId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             final boolean hasAccess =
-                    userHasAccessInternal(sharingClient, authzToken, appDeploymentId, ResourcePermissionType.WRITE);
+                    userHasAccessInternal(authzToken, appDeploymentId, ResourcePermissionType.WRITE);
             if (!hasAccess) {
                 throw new AuthorizationException(
                         "User does not have WRITE access to application deployment " + appDeploymentId);
             }
             final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
-            boolean result = regClient.deleteApplicationDeployment(appDeploymentId);
-            sharingClient.deleteEntity(domainId, appDeploymentId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.deleteApplicationDeployment(appDeploymentId);
+            sharingHandler.deleteEntity(domainId, appDeploymentId);
             return result;
         } catch (Exception e) {
             logger.error(appDeploymentId, "Error while deleting application deployment...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting application deployment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3138,9 +2807,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayId, ResourcePermissionType permissionType)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             List<String> accessibleAppDeploymentIds = new ArrayList<>();
             if (ServerSettings.isEnableSharing()) {
@@ -3155,7 +2822,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
                 permissionTypeFilter.setValue(gatewayId + ":" + permissionType.name());
                 sharingFilters.add(permissionTypeFilter);
-                sharingClient
+                sharingHandler
                         .searchEntities(
                                 authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                                 userName + "@" + gatewayId,
@@ -3174,18 +2841,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     accessibleComputeResourceIds.add(groupComputeResourcePreference.getComputeResourceId());
                 }
             }
-            List<ApplicationDeploymentDescription> result = regClient.getAccessibleApplicationDeployments(
+            List<ApplicationDeploymentDescription> result = registryHandler.getAccessibleApplicationDeployments(
                     gatewayId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving application deployments...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application deployments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3203,18 +2866,15 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<String> getAppModuleDeployedResources(AuthzToken authzToken, String appModuleId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             // TODO: restrict to only application deployments that are accessible to user
-            List<String> result = regClient.getAppModuleDeployedResources(appModuleId);
-            registryClientPool.returnResource(regClient);
+            List<String> result = registryHandler.getAppModuleDeployedResources(appModuleId);
             return result;
         } catch (Exception e) {
             logger.error(appModuleId, "Error while retrieving application deployments...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application deployment. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3238,18 +2898,16 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String appModuleId, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
             // Get list of compute resources for this Group Resource Profile
             if (!userHasAccessInternal(
-                    sharingClient, authzToken, groupResourceProfileId, ResourcePermissionType.READ)) {
+                    authzToken, groupResourceProfileId, ResourcePermissionType.READ)) {
                 throw new AuthorizationException(
                         "User is not authorized to access Group Resource Profile " + groupResourceProfileId);
             }
-            GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile(groupResourceProfileId);
+            GroupResourceProfile groupResourceProfile = registryHandler.getGroupResourceProfile(groupResourceProfileId);
             List<String> accessibleComputeResourceIds = groupResourceProfile.getComputePreferences().stream()
                     .map(compPref -> compPref.getComputeResourceId())
                     .collect(Collectors.toList());
@@ -3267,27 +2925,21 @@ public class AiravataServerHandler implements Airavata.Iface {
             permissionTypeFilter.setSearchCondition(SearchCondition.EQUAL);
             permissionTypeFilter.setValue(gatewayId + ":" + ResourcePermissionType.READ);
             sharingFilters.add(permissionTypeFilter);
-            sharingClient
+            sharingHandler
                     .searchEntities(gatewayId, userName + "@" + gatewayId, sharingFilters, 0, -1)
                     .forEach(a -> accessibleAppDeploymentIds.add(a.getEntityId()));
 
-            List<ApplicationDeploymentDescription> result = regClient.getAccessibleApplicationDeploymentsForAppModule(
+            List<ApplicationDeploymentDescription> result = registryHandler.getAccessibleApplicationDeploymentsForAppModule(
                     gatewayId, appModuleId, accessibleAppDeploymentIds, accessibleComputeResourceIds);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return result;
         } catch (AuthorizationException checkedException) {
             logger.error("Error while retrieving application deployments...", checkedException);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw checkedException;
         } catch (Exception e) {
             logger.error("Error while retrieving application deployments...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application deployments. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -3304,17 +2956,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayId, ApplicationInterfaceDescription applicationInterface)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerApplicationInterface(gatewayId, applicationInterface);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerApplicationInterface(gatewayId, applicationInterface);
             return result;
         } catch (Exception e) {
             logger.error("Error while adding application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding application interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3325,10 +2974,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String existingAppInterfaceID, String newApplicationName, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             ApplicationInterfaceDescription existingInterface =
-                    regClient.getApplicationInterface(existingAppInterfaceID);
+                    registryHandler.getApplicationInterface(existingAppInterfaceID);
             if (existingInterface == null) {
                 logger.error(
                         "Provided application interface does not exist.Please provide a valid application interface id...");
@@ -3337,17 +2985,15 @@ public class AiravataServerHandler implements Airavata.Iface {
 
             existingInterface.setApplicationName(newApplicationName);
             existingInterface.setApplicationInterfaceId(airavata_commonsConstants.DEFAULT_ID);
-            String interfaceId = regClient.registerApplicationInterface(gatewayId, existingInterface);
+            String interfaceId = registryHandler.registerApplicationInterface(gatewayId, existingInterface);
             logger.debug("Airavata cloned application interface : " + existingAppInterfaceID + " for gateway id : "
                     + gatewayId);
-            registryClientPool.returnResource(regClient);
             return interfaceId;
         } catch (Exception e) {
             logger.error("Error while adding application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding application interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3364,17 +3010,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ApplicationInterfaceDescription getApplicationInterface(AuthzToken authzToken, String appInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ApplicationInterfaceDescription result = regClient.getApplicationInterface(appInterfaceId);
-            registryClientPool.returnResource(regClient);
+            ApplicationInterfaceDescription result = registryHandler.getApplicationInterface(appInterfaceId);
             return result;
         } catch (Exception e) {
             logger.error(appInterfaceId, "Error while retrieving application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3393,17 +3036,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String appInterfaceId, ApplicationInterfaceDescription applicationInterface)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateApplicationInterface(appInterfaceId, applicationInterface);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateApplicationInterface(appInterfaceId, applicationInterface);
             return result;
         } catch (Exception e) {
             logger.error(appInterfaceId, "Error while updating application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating application interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3420,17 +3060,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteApplicationInterface(AuthzToken authzToken, String appInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteApplicationInterface(appInterfaceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteApplicationInterface(appInterfaceId);
             return result;
         } catch (Exception e) {
             logger.error(appInterfaceId, "Error while deleting application interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting application interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3446,17 +3083,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Map<String, String> getAllApplicationInterfaceNames(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Map<String, String> result = regClient.getAllApplicationInterfaceNames(gatewayId);
-            registryClientPool.returnResource(regClient);
+            Map<String, String> result = registryHandler.getAllApplicationInterfaceNames(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving application interfaces...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application interfaces. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3472,17 +3106,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<ApplicationInterfaceDescription> getAllApplicationInterfaces(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<ApplicationInterfaceDescription> result = regClient.getAllApplicationInterfaces(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<ApplicationInterfaceDescription> result = registryHandler.getAllApplicationInterfaces(gatewayId);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving application interfaces...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application interfaces. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3499,17 +3130,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<InputDataObjectType> getApplicationInputs(AuthzToken authzToken, String appInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<InputDataObjectType> result = regClient.getApplicationInputs(appInterfaceId);
-            registryClientPool.returnResource(regClient);
+            List<InputDataObjectType> result = registryHandler.getApplicationInputs(appInterfaceId);
             return result;
         } catch (Exception e) {
             logger.error(appInterfaceId, "Error while retrieving application inputs...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving application inputs. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3526,15 +3154,12 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<OutputDataObjectType> getApplicationOutputs(AuthzToken authzToken, String appInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<OutputDataObjectType> result = regClient.getApplicationOutputs(appInterfaceId);
-            registryClientPool.returnResource(regClient);
+            List<OutputDataObjectType> result = registryHandler.getApplicationOutputs(appInterfaceId);
             return result;
         } catch (Exception e) {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setMessage(e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3553,17 +3178,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Map<String, String> getAvailableAppInterfaceComputeResources(AuthzToken authzToken, String appInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Map<String, String> result = regClient.getAvailableAppInterfaceComputeResources(appInterfaceId);
-            registryClientPool.returnResource(regClient);
+            Map<String, String> result = registryHandler.getAvailableAppInterfaceComputeResources(appInterfaceId);
             return result;
         } catch (Exception e) {
             logger.error(appInterfaceId, "Error while saving compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while saving compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3580,17 +3202,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerComputeResource(AuthzToken authzToken, ComputeResourceDescription computeResourceDescription)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerComputeResource(computeResourceDescription);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerComputeResource(computeResourceDescription);
             return result;
         } catch (Exception e) {
             logger.error("Error while saving compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while saving compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3607,17 +3226,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ComputeResourceDescription getComputeResource(AuthzToken authzToken, String computeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ComputeResourceDescription result = regClient.getComputeResource(computeResourceId);
-            registryClientPool.returnResource(regClient);
+            ComputeResourceDescription result = registryHandler.getComputeResource(computeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(computeResourceId, "Error while retrieving compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3633,17 +3249,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Map<String, String> getAllComputeResourceNames(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Map<String, String> result = regClient.getAllComputeResourceNames();
-            registryClientPool.returnResource(regClient);
+            Map<String, String> result = registryHandler.getAllComputeResourceNames();
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3662,17 +3275,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, ComputeResourceDescription computeResourceDescription)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateComputeResource(computeResourceId, computeResourceDescription);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateComputeResource(computeResourceId, computeResourceDescription);
             return result;
         } catch (Exception e) {
             logger.error(computeResourceId, "Error while updating compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updaing compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3689,17 +3299,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteComputeResource(AuthzToken authzToken, String computeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteComputeResource(computeResourceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteComputeResource(computeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(computeResourceId, "Error while deleting compute resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3717,17 +3324,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerStorageResource(AuthzToken authzToken, StorageResourceDescription storageResourceDescription)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerStorageResource(storageResourceDescription);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerStorageResource(storageResourceDescription);
             return result;
         } catch (Exception e) {
             logger.error("Error while saving storage resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while saving storage resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3745,17 +3349,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public StorageResourceDescription getStorageResource(AuthzToken authzToken, String storageResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            StorageResourceDescription result = regClient.getStorageResource(storageResourceId);
-            registryClientPool.returnResource(regClient);
+            StorageResourceDescription result = registryHandler.getStorageResource(storageResourceId);
             return result;
         } catch (Exception e) {
             logger.error(storageResourceId, "Error while retrieving storage resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving storage resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3772,17 +3373,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Map<String, String> getAllStorageResourceNames(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Map<String, String> result = regClient.getAllStorageResourceNames();
-            registryClientPool.returnResource(regClient);
+            Map<String, String> result = registryHandler.getAllStorageResourceNames();
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving storage resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving storage resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3802,17 +3400,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String storageResourceId, StorageResourceDescription storageResourceDescription)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateStorageResource(storageResourceId, storageResourceDescription);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateStorageResource(storageResourceId, storageResourceDescription);
             return result;
         } catch (Exception e) {
             logger.error(storageResourceId, "Error while updating storage resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updaing storage resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3830,17 +3425,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteStorageResource(AuthzToken authzToken, String storageResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteStorageResource(storageResourceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteStorageResource(storageResourceId);
             return result;
         } catch (Exception e) {
             logger.error(storageResourceId, "Error while deleting storage resource...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting storage resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -3851,13 +3443,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        RegistryService.Client regClient = registryClientPool.getResource();
         StorageInfoContext context;
 
         try {
             Optional<ComputeResourceDescription> computeResourceOp = Optional.empty();
             try {
-                ComputeResourceDescription computeResource = regClient.getComputeResource(resourceId);
+                ComputeResourceDescription computeResource = registryHandler.getComputeResource(resourceId);
                 if (computeResource != null) {
                     computeResourceOp = Optional.of(computeResource);
                 }
@@ -3870,7 +3461,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             Optional<StorageResourceDescription> storageResourceOp = Optional.empty();
             if (computeResourceOp.isEmpty()) {
                 try {
-                    StorageResourceDescription storageResource = regClient.getStorageResource(resourceId);
+                    StorageResourceDescription storageResource = registryHandler.getStorageResource(resourceId);
                     if (storageResource != null) {
                         storageResourceOp = Optional.of(storageResource);
                     }
@@ -3897,21 +3488,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                 context = resolveStorageStorageInfoContext(authzToken, gatewayId, userId, resourceId);
             }
 
-            registryClientPool.returnResource(regClient);
-            regClient = null;
-
             return context.adaptor.getStorageVolumeInfo(location);
 
         } catch (InvalidRequestException | AiravataClientException e) {
-            if (regClient != null) {
-                registryClientPool.returnResource(regClient);
-            }
             logger.error("Error while retrieving storage resource.", e);
             throw e;
 
         } catch (Exception e) {
             logger.error("Error while retrieving storage volume info for resource {}", resourceId, e);
-            registryClientPool.returnBrokenResource(regClient);
 
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -3926,13 +3510,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        RegistryService.Client regClient = registryClientPool.getResource();
         StorageInfoContext context;
 
         try {
             Optional<ComputeResourceDescription> computeResourceOp = Optional.empty();
             try {
-                ComputeResourceDescription computeResource = regClient.getComputeResource(resourceId);
+                ComputeResourceDescription computeResource = registryHandler.getComputeResource(resourceId);
                 if (computeResource != null) {
                     computeResourceOp = Optional.of(computeResource);
                 }
@@ -3945,7 +3528,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             Optional<StorageResourceDescription> storageResourceOp = Optional.empty();
             if (computeResourceOp.isEmpty()) {
                 try {
-                    StorageResourceDescription storageResource = regClient.getStorageResource(resourceId);
+                    StorageResourceDescription storageResource = registryHandler.getStorageResource(resourceId);
                     if (storageResource != null) {
                         storageResourceOp = Optional.of(storageResource);
                     }
@@ -3972,21 +3555,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                 context = resolveStorageStorageInfoContext(authzToken, gatewayId, userId, resourceId);
             }
 
-            registryClientPool.returnResource(regClient);
-            regClient = null;
-
             return context.adaptor.getStorageDirectoryInfo(location);
 
         } catch (InvalidRequestException | AiravataClientException e) {
-            if (regClient != null) {
-                registryClientPool.returnResource(regClient);
-            }
             logger.error("Error while retrieving storage resource.", e);
             throw e;
 
         } catch (Exception e) {
             logger.error("Error while retrieving storage volume info for resource {}", resourceId, e);
-            registryClientPool.returnBrokenResource(regClient);
 
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
@@ -4011,10 +3587,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, int priorityOrder, LOCALSubmission localSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.addLocalSubmissionDetails(computeResourceId, priorityOrder, localSubmission);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.addLocalSubmissionDetails(computeResourceId, priorityOrder, localSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4026,7 +3600,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4045,10 +3618,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String jobSubmissionInterfaceId, LOCALSubmission localSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateLocalSubmissionDetails(jobSubmissionInterfaceId, localSubmission);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateLocalSubmissionDetails(jobSubmissionInterfaceId, localSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4060,7 +3631,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4070,10 +3640,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public LOCALSubmission getLocalJobSubmission(AuthzToken authzToken, String jobSubmissionId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            LOCALSubmission result = regClient.getLocalJobSubmission(jobSubmissionId);
-            registryClientPool.returnResource(regClient);
+            LOCALSubmission result = registryHandler.getLocalJobSubmission(jobSubmissionId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving local job submission interface to resource compute resource...";
@@ -4081,7 +3649,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4102,10 +3669,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.addSSHJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4117,7 +3682,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4138,11 +3702,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, int priorityOrder, SSHJobSubmission sshJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             String result =
-                    regClient.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.addSSHForkJobSubmissionDetails(computeResourceId, priorityOrder, sshJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4154,7 +3716,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4164,10 +3725,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public SSHJobSubmission getSSHJobSubmission(AuthzToken authzToken, String jobSubmissionId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            SSHJobSubmission result = regClient.getSSHJobSubmission(jobSubmissionId);
-            registryClientPool.returnResource(regClient);
+            SSHJobSubmission result = registryHandler.getSSHJobSubmission(jobSubmissionId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving SSH job submission interface to resource compute resource...";
@@ -4175,7 +3734,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4196,11 +3754,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, int priorityOrder, CloudJobSubmission cloudJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             String result =
-                    regClient.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, cloudJobSubmission);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.addCloudJobSubmissionDetails(computeResourceId, priorityOrder, cloudJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4212,7 +3768,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4222,10 +3777,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public CloudJobSubmission getCloudJobSubmission(AuthzToken authzToken, String jobSubmissionId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            CloudJobSubmission result = regClient.getCloudJobSubmission(jobSubmissionId);
-            registryClientPool.returnResource(regClient);
+            CloudJobSubmission result = registryHandler.getCloudJobSubmission(jobSubmissionId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving Cloud job submission interface to resource compute resource...";
@@ -4233,7 +3786,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4247,11 +3799,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             UnicoreJobSubmission unicoreJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             String result =
-                    regClient.addUNICOREJobSubmissionDetails(computeResourceId, priorityOrder, unicoreJobSubmission);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.addUNICOREJobSubmissionDetails(computeResourceId, priorityOrder, unicoreJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error("Error while adding job submission interface to resource compute resource...", e);
@@ -4260,7 +3810,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4270,10 +3819,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public UnicoreJobSubmission getUnicoreJobSubmission(AuthzToken authzToken, String jobSubmissionId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            UnicoreJobSubmission result = regClient.getUnicoreJobSubmission(jobSubmissionId);
-            registryClientPool.returnResource(regClient);
+            UnicoreJobSubmission result = registryHandler.getUnicoreJobSubmission(jobSubmissionId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving Unicore job submission interface to resource compute resource...";
@@ -4281,7 +3828,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4300,10 +3846,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String jobSubmissionInterfaceId, SSHJobSubmission sshJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateSSHJobSubmissionDetails(jobSubmissionInterfaceId, sshJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4315,7 +3859,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4334,10 +3877,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String jobSubmissionInterfaceId, CloudJobSubmission cloudJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, cloudJobSubmission);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateCloudJobSubmissionDetails(jobSubmissionInterfaceId, cloudJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4349,7 +3890,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4360,11 +3900,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String jobSubmissionInterfaceId, UnicoreJobSubmission unicoreJobSubmission)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             boolean result =
-                    regClient.updateUnicoreJobSubmissionDetails(jobSubmissionInterfaceId, unicoreJobSubmission);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.updateUnicoreJobSubmissionDetails(jobSubmissionInterfaceId, unicoreJobSubmission);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4376,7 +3914,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4401,10 +3938,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             LOCALDataMovement localDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.addLocalDataMovementDetails(resourceId, dmType, priorityOrder, localDataMovement);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.addLocalDataMovementDetails(resourceId, dmType, priorityOrder, localDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(resourceId, "Error while adding data movement interface to resource resource...", e);
@@ -4412,7 +3947,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while adding data movement interface to resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4431,17 +3965,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String dataMovementInterfaceId, LOCALDataMovement localDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateLocalDataMovementDetails(dataMovementInterfaceId, localDataMovement);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateLocalDataMovementDetails(dataMovementInterfaceId, localDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(dataMovementInterfaceId, "Error while updating local data movement interface..", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating local data movement interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4451,10 +3982,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public LOCALDataMovement getLocalDataMovement(AuthzToken authzToken, String dataMovementId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            LOCALDataMovement result = regClient.getLocalDataMovement(dataMovementId);
-            registryClientPool.returnResource(regClient);
+            LOCALDataMovement result = registryHandler.getLocalDataMovement(dataMovementId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving local data movement interface to resource compute resource...";
@@ -4462,7 +3991,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4483,10 +4011,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, DMType dmType, int priorityOrder, SCPDataMovement scpDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.addSCPDataMovementDetails(resourceId, dmType, priorityOrder, scpDataMovement);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.addSCPDataMovementDetails(resourceId, dmType, priorityOrder, scpDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(resourceId, "Error while adding data movement interface to resource compute resource...", e);
@@ -4494,7 +4020,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
                     + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4514,10 +4039,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String dataMovementInterfaceId, SCPDataMovement scpDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateSCPDataMovementDetails(dataMovementInterfaceId, scpDataMovement);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateSCPDataMovementDetails(dataMovementInterfaceId, scpDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4529,7 +4052,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4539,10 +4061,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public SCPDataMovement getSCPDataMovement(AuthzToken authzToken, String dataMovementId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            SCPDataMovement result = regClient.getSCPDataMovement(dataMovementId);
-            registryClientPool.returnResource(regClient);
+            SCPDataMovement result = registryHandler.getSCPDataMovement(dataMovementId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving SCP data movement interface to resource compute resource...";
@@ -4550,7 +4070,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4565,11 +4084,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             UnicoreDataMovement unicoreDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             String result =
-                    regClient.addUnicoreDataMovementDetails(resourceId, dmType, priorityOrder, unicoreDataMovement);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.addUnicoreDataMovementDetails(resourceId, dmType, priorityOrder, unicoreDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(resourceId, "Error while adding data movement interface to resource compute resource...", e);
@@ -4577,7 +4094,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
                     + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4588,10 +4104,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String dataMovementInterfaceId, UnicoreDataMovement unicoreDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateUnicoreDataMovementDetails(dataMovementInterfaceId, unicoreDataMovement);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateUnicoreDataMovementDetails(dataMovementInterfaceId, unicoreDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4600,7 +4114,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while updating unicore data movement to compute resource. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4610,10 +4123,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public UnicoreDataMovement getUnicoreDataMovement(AuthzToken authzToken, String dataMovementId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            UnicoreDataMovement result = regClient.getUnicoreDataMovement(dataMovementId);
-            registryClientPool.returnResource(regClient);
+            UnicoreDataMovement result = registryHandler.getUnicoreDataMovement(dataMovementId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving UNICORE data movement interface...";
@@ -4621,7 +4132,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4646,11 +4156,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             GridFTPDataMovement gridFTPDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.addGridFTPDataMovementDetails(
+            String result = registryHandler.addGridFTPDataMovementDetails(
                     computeResourceId, dmType, priorityOrder, gridFTPDataMovement);
-            registryClientPool.returnResource(regClient);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4659,7 +4167,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding data movement interface to resource compute resource. More info : "
                     + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4679,10 +4186,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String dataMovementInterfaceId, GridFTPDataMovement gridFTPDataMovement)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateGridFTPDataMovementDetails(dataMovementInterfaceId, gridFTPDataMovement);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateGridFTPDataMovementDetails(dataMovementInterfaceId, gridFTPDataMovement);
             return result;
         } catch (Exception e) {
             logger.error(
@@ -4694,7 +4199,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setMessage(
                     "Error while adding job submission interface to resource compute resource. More info : "
                             + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4704,10 +4208,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public GridFTPDataMovement getGridFTPDataMovement(AuthzToken authzToken, String dataMovementId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            GridFTPDataMovement result = regClient.getGridFTPDataMovement(dataMovementId);
-            registryClientPool.returnResource(regClient);
+            GridFTPDataMovement result = registryHandler.getGridFTPDataMovement(dataMovementId);
             return result;
         } catch (Exception e) {
             String errorMsg = "Error while retrieving GridFTP data movement interface to resource compute resource...";
@@ -4715,7 +4217,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(errorMsg + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4797,17 +4298,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, String jobSubmissionInterfaceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteJobSubmissionInterface(computeResourceId, jobSubmissionInterfaceId);
             return result;
         } catch (Exception e) {
             logger.error(jobSubmissionInterfaceId, "Error while deleting job submission interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting job submission interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4825,17 +4323,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, String dataMovementInterfaceId, DMType dmType)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, dmType);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteDataMovementInterface(resourceId, dataMovementInterfaceId, dmType);
             return result;
         } catch (Exception e) {
             logger.error(dataMovementInterfaceId, "Error while deleting data movement interface...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting data movement interface. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4845,17 +4340,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerResourceJobManager(AuthzToken authzToken, ResourceJobManager resourceJobManager)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerResourceJobManager(resourceJobManager);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerResourceJobManager(resourceJobManager);
             return result;
         } catch (Exception e) {
             logger.error(resourceJobManager.getResourceJobManagerId(), "Error while adding resource job manager...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while adding resource job manager. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4866,17 +4358,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceJobManagerId, ResourceJobManager updatedResourceJobManager)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateResourceJobManager(resourceJobManagerId, updatedResourceJobManager);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateResourceJobManager(resourceJobManagerId, updatedResourceJobManager);
             return result;
         } catch (Exception e) {
             logger.error(resourceJobManagerId, "Error while updating resource job manager...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating resource job manager. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4886,17 +4375,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ResourceJobManager getResourceJobManager(AuthzToken authzToken, String resourceJobManagerId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ResourceJobManager result = regClient.getResourceJobManager(resourceJobManagerId);
-            registryClientPool.returnResource(regClient);
+            ResourceJobManager result = registryHandler.getResourceJobManager(resourceJobManagerId);
             return result;
         } catch (Exception e) {
             logger.error(resourceJobManagerId, "Error while retrieving resource job manager...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving resource job manager. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4906,17 +4392,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteResourceJobManager(AuthzToken authzToken, String resourceJobManagerId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteResourceJobManager(resourceJobManagerId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteResourceJobManager(resourceJobManagerId);
             return result;
         } catch (Exception e) {
             logger.error(resourceJobManagerId, "Error while deleting resource job manager...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting resource job manager. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4926,17 +4409,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteBatchQueue(AuthzToken authzToken, String computeResourceId, String queueName)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteBatchQueue(computeResourceId, queueName);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteBatchQueue(computeResourceId, queueName);
             return result;
         } catch (Exception e) {
             logger.error(computeResourceId, "Error while deleting batch queue...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while deleting batch queue. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4955,17 +4435,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerGatewayResourceProfile(AuthzToken authzToken, GatewayResourceProfile gatewayResourceProfile)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerGatewayResourceProfile(gatewayResourceProfile);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerGatewayResourceProfile(gatewayResourceProfile);
             return result;
         } catch (Exception e) {
             logger.error("Error while registering gateway resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while registering gateway resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -4982,17 +4459,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public GatewayResourceProfile getGatewayResourceProfile(AuthzToken authzToken, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            GatewayResourceProfile result = regClient.getGatewayResourceProfile(gatewayID);
-            registryClientPool.returnResource(regClient);
+            GatewayResourceProfile result = registryHandler.getGatewayResourceProfile(gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while retrieving gateway resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving gateway resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5009,17 +4483,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     @SecurityCheck
     public boolean updateGatewayResourceProfile(
             AuthzToken authzToken, String gatewayID, GatewayResourceProfile gatewayResourceProfile) throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateGatewayResourceProfile(gatewayID, gatewayResourceProfile);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while updating gateway resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating gateway resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5034,17 +4505,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     @Override
     @SecurityCheck
     public boolean deleteGatewayResourceProfile(AuthzToken authzToken, String gatewayID) throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteGatewayResourceProfile(gatewayID);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteGatewayResourceProfile(gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while removing gateway resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while removing gateway resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5068,11 +4536,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             ComputeResourcePreference computeResourcePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.addGatewayComputeResourcePreference(
+            boolean result = registryHandler.addGatewayComputeResourcePreference(
                     gatewayID, computeResourceId, computeResourcePreference);
-            registryClientPool.returnResource(regClient);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
@@ -5080,7 +4546,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while registering gateway resource profile preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5091,10 +4556,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayID, String storageResourceId, StoragePreference dataStoragePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.addGatewayStoragePreference(gatewayID, storageResourceId, dataStoragePreference);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.addGatewayStoragePreference(gatewayID, storageResourceId, dataStoragePreference);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while registering gateway resource profile preference...", e);
@@ -5102,7 +4565,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while registering gateway resource profile preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5121,11 +4583,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayID, String computeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             ComputeResourcePreference result =
-                    regClient.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.getGatewayComputeResourcePreference(gatewayID, computeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -5133,7 +4593,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while reading gateway compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5143,17 +4602,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public StoragePreference getGatewayStoragePreference(AuthzToken authzToken, String gatewayID, String storageId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            StoragePreference result = regClient.getGatewayStoragePreference(gatewayID, storageId);
-            registryClientPool.returnResource(regClient);
+            StoragePreference result = registryHandler.getGatewayStoragePreference(gatewayID, storageId);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading gateway data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5171,10 +4627,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<ComputeResourcePreference> result = regClient.getAllGatewayComputeResourcePreferences(gatewayID);
-            registryClientPool.returnResource(regClient);
+            List<ComputeResourcePreference> result = registryHandler.getAllGatewayComputeResourcePreferences(gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preferences...", e);
@@ -5182,7 +4636,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while reading gateway compute resource preferences. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5192,17 +4645,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<StoragePreference> getAllGatewayStoragePreferences(AuthzToken authzToken, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<StoragePreference> result = regClient.getAllGatewayStoragePreferences(gatewayID);
-            registryClientPool.returnResource(regClient);
+            List<StoragePreference> result = registryHandler.getAllGatewayStoragePreferences(gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preferences...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading gateway data storage preferences. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5212,16 +4662,13 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<GatewayResourceProfile> getAllGatewayResourceProfiles(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<GatewayResourceProfile> result = regClient.getAllGatewayResourceProfiles();
-            registryClientPool.returnResource(regClient);
+            List<GatewayResourceProfile> result = registryHandler.getAllGatewayResourceProfiles();
             return result;
         } catch (Exception e) {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading retrieving all gateway profiles. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5244,11 +4691,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             ComputeResourcePreference computeResourcePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateGatewayComputeResourcePreference(
+            boolean result = registryHandler.updateGatewayComputeResourcePreference(
                     gatewayID, computeResourceId, computeResourcePreference);
-            registryClientPool.returnResource(regClient);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -5256,7 +4701,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while updating gateway compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5267,17 +4711,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayID, String storageId, StoragePreference dataStoragePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateGatewayStoragePreference(gatewayID, storageId, dataStoragePreference);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateGatewayStoragePreference(gatewayID, storageId, dataStoragePreference);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5296,10 +4737,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String gatewayID, String computeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteGatewayComputeResourcePreference(gatewayID, computeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway compute resource preference...", e);
@@ -5307,7 +4746,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while updating gateway compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5317,17 +4755,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean deleteGatewayStoragePreference(AuthzToken authzToken, String gatewayID, String storageId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteGatewayStoragePreference(gatewayID, storageId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteGatewayStoragePreference(gatewayID, storageId);
             return result;
         } catch (Exception e) {
             logger.error(gatewayID, "Error while reading gateway data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating gateway data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5398,17 +4833,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-        CredentialStoreService.Client csClient = csClientPool.getResource();
         SSHCredential sshCredential = null;
         try {
-            sshCredential = csClient.getSSHCredential(airavataCredStoreToken, gatewayId);
-            csClientPool.returnResource(csClient);
+            sshCredential = credentialHandler.getSSHCredential(airavataCredStoreToken, gatewayId);
         } catch (Exception e) {
             logger.error("Error occurred while retrieving SSH Credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while retrieving SSH Credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
             throw exception;
         }
 
@@ -5432,17 +4864,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
-        CredentialStoreService.Client csClient = csClientPool.getResource();
         SSHCredential sshCredential = null;
         try {
-            sshCredential = csClient.getSSHCredential(airavataCredStoreToken, gatewayId);
-            csClientPool.returnResource(csClient);
+            sshCredential = credentialHandler.getSSHCredential(airavataCredStoreToken, gatewayId);
         } catch (Exception e) {
             logger.error("Error occurred while retrieving SSH Credential", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error occurred while retrieving SSH Credential. More info : " + e.getMessage());
-            csClientPool.returnBrokenResource(csClient);
             throw exception;
         }
 
@@ -5474,17 +4903,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerUserResourceProfile(AuthzToken authzToken, UserResourceProfile userResourceProfile)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerUserResourceProfile(userResourceProfile);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerUserResourceProfile(userResourceProfile);
             return result;
         } catch (Exception e) {
             logger.error("Error while registering user resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while registering user resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5494,10 +4920,8 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean isUserResourceProfileExists(AuthzToken authzToken, String userId, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.isUserResourceProfileExists(userId, gatewayID);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.isUserResourceProfileExists(userId, gatewayID);
             return result;
         } catch (Exception e) {
             logger.error("Error while checking existence of user resource profile for " + userId, e);
@@ -5505,7 +4929,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while checking existence of user resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5525,17 +4948,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public UserResourceProfile getUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            UserResourceProfile result = regClient.getUserResourceProfile(userId, gatewayID);
-            registryClientPool.returnResource(regClient);
+            UserResourceProfile result = registryHandler.getUserResourceProfile(userId, gatewayID);
             return result;
         } catch (Exception e) {
             logger.error("Error while retrieving user resource profile for " + userId, e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while retrieving user resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5554,17 +4974,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean updateUserResourceProfile(
             AuthzToken authzToken, String userId, String gatewayID, UserResourceProfile userResourceProfile)
             throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.updateUserResourceProfile(userId, gatewayID, userResourceProfile);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while updating user resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating user resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5580,17 +4997,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     @Override
     @SecurityCheck
     public boolean deleteUserResourceProfile(AuthzToken authzToken, String userId, String gatewayID) throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteUserResourceProfile(userId, gatewayID);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteUserResourceProfile(userId, gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while removing user resource profile...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while removing user resource profile. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5616,11 +5030,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             UserComputeResourcePreference userComputeResourcePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.addUserComputeResourcePreference(
+            boolean result = registryHandler.addUserComputeResourcePreference(
                     userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
-            registryClientPool.returnResource(regClient);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while registering user resource profile preference...", e);
@@ -5628,7 +5040,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while registering user resource profile preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5643,18 +5054,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             UserStoragePreference dataStoragePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             boolean result =
-                    regClient.addUserStoragePreference(userId, gatewayID, userStorageResourceId, dataStoragePreference);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.addUserStoragePreference(userId, gatewayID, userStorageResourceId, dataStoragePreference);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while registering user storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while registering user storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5674,18 +5082,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             UserComputeResourcePreference result =
-                    regClient.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.getUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user compute resource preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading user compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5696,17 +5101,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID, String userStorageId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            UserStoragePreference result = regClient.getUserStoragePreference(userId, gatewayID, userStorageId);
-            registryClientPool.returnResource(regClient);
+            UserStoragePreference result = registryHandler.getUserStoragePreference(userId, gatewayID, userStorageId);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading user data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5725,11 +5127,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             List<UserComputeResourcePreference> result =
-                    regClient.getAllUserComputeResourcePreferences(userId, gatewayID);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.getAllUserComputeResourcePreferences(userId, gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading User compute resource preferences...", e);
@@ -5737,7 +5137,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while reading User compute resource preferences. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5748,17 +5147,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<UserStoragePreference> result = regClient.getAllUserStoragePreferences(userId, gatewayID);
-            registryClientPool.returnResource(regClient);
+            List<UserStoragePreference> result = registryHandler.getAllUserStoragePreferences(userId, gatewayID);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading User data storage preferences...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while reading User data storage preferences. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5768,17 +5164,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<UserResourceProfile> getAllUserResourceProfiles(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<UserResourceProfile> result = regClient.getAllUserResourceProfiles();
-            registryClientPool.returnResource(regClient);
+            List<UserResourceProfile> result = registryHandler.getAllUserResourceProfiles();
             return result;
         } catch (Exception e) {
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while reading retrieving all user resource profiles. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5803,11 +5196,9 @@ public class AiravataServerHandler implements Airavata.Iface {
             UserComputeResourcePreference userComputeResourcePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.updateUserComputeResourcePreference(
+            boolean result = registryHandler.updateUserComputeResourcePreference(
                     userId, gatewayID, userComputeResourceId, userComputeResourcePreference);
-            registryClientPool.returnResource(regClient);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user compute resource preference...", e);
@@ -5815,7 +5206,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while updating user compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5830,18 +5220,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             UserStoragePreference dataStoragePreference)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             boolean result =
-                    regClient.updateUserStoragePreference(userId, gatewayID, userStorageId, dataStoragePreference);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.updateUserStoragePreference(userId, gatewayID, userStorageId, dataStoragePreference);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5861,10 +5248,8 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID, String userComputeResourceId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteUserComputeResourcePreference(userId, gatewayID, userComputeResourceId);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user compute resource preference...", e);
@@ -5872,7 +5257,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(
                     "Error while updating user compute resource preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5883,17 +5267,14 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String userId, String gatewayID, String userStorageId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            boolean result = regClient.deleteUserStoragePreference(userId, gatewayID, userStorageId);
-            registryClientPool.returnResource(regClient);
+            boolean result = registryHandler.deleteUserStoragePreference(userId, gatewayID, userStorageId);
             return result;
         } catch (Exception e) {
             logger.error(userId, "Error while reading user data storage preference...", e);
             AiravataSystemException exception = new AiravataSystemException();
             exception.setAiravataErrorType(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage("Error while updating user data storage preference. More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5903,17 +5284,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<QueueStatusModel> getLatestQueueStatuses(AuthzToken authzToken)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<QueueStatusModel> result = regClient.getLatestQueueStatuses();
-            registryClientPool.returnResource(regClient);
+            List<QueueStatusModel> result = registryHandler.getLatestQueueStatuses();
             return result;
         } catch (Exception e) {
             String msg = "Error in retrieving queue statuses";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5929,17 +5307,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerDataProduct(AuthzToken authzToken, DataProductModel dataProductModel)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerDataProduct(dataProductModel);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerDataProduct(dataProductModel);
             return result;
         } catch (Exception e) {
             String msg = "Error in registering the data resource" + dataProductModel.getProductName() + ".";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5949,17 +5324,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public DataProductModel getDataProduct(AuthzToken authzToken, String productUri)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            DataProductModel result = regClient.getDataProduct(productUri);
-            registryClientPool.returnResource(regClient);
+            DataProductModel result = registryHandler.getDataProduct(productUri);
             return result;
         } catch (Exception e) {
             String msg = "Error in retreiving the data product " + productUri + ".";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5969,17 +5341,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String registerReplicaLocation(AuthzToken authzToken, DataReplicaLocationModel replicaLocationModel)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String result = regClient.registerReplicaLocation(replicaLocationModel);
-            registryClientPool.returnResource(regClient);
+            String result = registryHandler.registerReplicaLocation(replicaLocationModel);
             return result;
         } catch (Exception e) {
             String msg = "Error in retreiving the replica " + replicaLocationModel.getReplicaName() + ".";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -5989,17 +5358,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public DataProductModel getParentDataProduct(AuthzToken authzToken, String productUri)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            DataProductModel result = regClient.getParentDataProduct(productUri);
-            registryClientPool.returnResource(regClient);
+            DataProductModel result = registryHandler.getParentDataProduct(productUri);
             return result;
         } catch (Exception e) {
             String msg = "Error in retreiving the parent data product for " + productUri + ".";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6009,17 +5375,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<DataProductModel> getChildDataProducts(AuthzToken authzToken, String productUri)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<DataProductModel> result = regClient.getChildDataProducts(productUri);
-            registryClientPool.returnResource(regClient);
+            List<DataProductModel> result = registryHandler.getChildDataProducts(productUri);
             return result;
         } catch (Exception e) {
             String msg = "Error in retreiving the child products for " + productUri + ".";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6037,35 +5400,33 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> userPermissionList)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+            if (!userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)
                     && !userHasAccessInternal(
-                            sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+                    authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
                 throw new AuthorizationException(
                         "User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
             }
             for (Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()) {
                 String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                 if (userPermission.getValue().equals(ResourcePermissionType.WRITE))
-                    sharingClient.shareEntityWithUsers(
+                    sharingHandler.shareEntityWithUsers(
                             gatewayId,
                             resourceId,
                             Arrays.asList(userPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE",
                             true);
                 else if (userPermission.getValue().equals(ResourcePermissionType.READ))
-                    sharingClient.shareEntityWithUsers(
+                    sharingHandler.shareEntityWithUsers(
                             gatewayId,
                             resourceId,
                             Arrays.asList(userPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ",
                             true);
                 else if (userPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
-                    if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
-                        createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
-                        sharingClient.shareEntityWithUsers(
+                    if (userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)) {
+                        createManageSharingPermissionTypeIfMissing(gatewayId);
+                        sharingHandler.shareEntityWithUsers(
                                 gatewayId,
                                 resourceId,
                                 Arrays.asList(userPermission.getKey()),
@@ -6080,16 +5441,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
                 }
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return true;
         } catch (Exception e) {
             String msg = "Error in sharing resource with users. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6100,35 +5457,33 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> groupPermissionList)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+            if (!userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)
                     && !userHasAccessInternal(
-                            sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+                    authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
                 throw new AuthorizationException(
                         "User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
             }
             for (Map.Entry<String, ResourcePermissionType> groupPermission : groupPermissionList.entrySet()) {
                 String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                 if (groupPermission.getValue().equals(ResourcePermissionType.WRITE))
-                    sharingClient.shareEntityWithGroups(
+                    sharingHandler.shareEntityWithGroups(
                             gatewayId,
                             resourceId,
                             Arrays.asList(groupPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE",
                             true);
                 else if (groupPermission.getValue().equals(ResourcePermissionType.READ))
-                    sharingClient.shareEntityWithGroups(
+                    sharingHandler.shareEntityWithGroups(
                             gatewayId,
                             resourceId,
                             Arrays.asList(groupPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ",
                             true);
                 else if (groupPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
-                    if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
-                        createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
-                        sharingClient.shareEntityWithGroups(
+                    if (userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)) {
+                        createManageSharingPermissionTypeIfMissing(gatewayId);
+                        sharingHandler.shareEntityWithGroups(
                                 gatewayId,
                                 resourceId,
                                 Arrays.asList(groupPermission.getKey()),
@@ -6143,16 +5498,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
                 }
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return true;
         } catch (Exception e) {
             String msg = "Error in sharing resource with groups. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6163,33 +5514,31 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> userPermissionList)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+            if (!userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)
                     && !userHasAccessInternal(
-                            sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+                    authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
                 throw new AuthorizationException(
                         "User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
             }
             for (Map.Entry<String, ResourcePermissionType> userPermission : userPermissionList.entrySet()) {
                 String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                 if (userPermission.getValue().equals(ResourcePermissionType.WRITE))
-                    sharingClient.revokeEntitySharingFromUsers(
+                    sharingHandler.revokeEntitySharingFromUsers(
                             gatewayId,
                             resourceId,
                             Arrays.asList(userPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "WRITE");
                 else if (userPermission.getValue().equals(ResourcePermissionType.READ))
-                    sharingClient.revokeEntitySharingFromUsers(
+                    sharingHandler.revokeEntitySharingFromUsers(
                             gatewayId,
                             resourceId,
                             Arrays.asList(userPermission.getKey()),
                             authzToken.getClaimsMap().get(Constants.GATEWAY_ID) + ":" + "READ");
                 else if (userPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
-                    if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
-                        createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
-                        sharingClient.revokeEntitySharingFromUsers(
+                    if (userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)) {
+                        createManageSharingPermissionTypeIfMissing(gatewayId);
+                        sharingHandler.revokeEntitySharingFromUsers(
                                 gatewayId,
                                 resourceId,
                                 Arrays.asList(userPermission.getKey()),
@@ -6203,16 +5552,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
                 }
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return true;
         } catch (Exception e) {
             String msg = "Error in revoking access to resource from users. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6223,23 +5568,21 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String resourceId, Map<String, ResourcePermissionType> groupPermissionList)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         final String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         try {
-            if (!userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)
+            if (!userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)
                     && !userHasAccessInternal(
-                            sharingClient, authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
+                    authzToken, resourceId, ResourcePermissionType.MANAGE_SHARING)) {
                 throw new AuthorizationException(
                         "User is not allowed to change sharing because the user is either not the resource owner or does not have access to share the resource");
             }
             // For certain resource types, restrict them from being unshared with admin groups
-            ResourceType resourceType = getResourceType(sharingClient, gatewayId, resourceId);
+            ResourceType resourceType = getResourceType(gatewayId, resourceId);
             Set<ResourceType> adminRestrictedResourceTypes = new HashSet<>(Arrays.asList(
                     ResourceType.EXPERIMENT, ResourceType.APPLICATION_DEPLOYMENT, ResourceType.GROUP_RESOURCE_PROFILE));
             if (adminRestrictedResourceTypes.contains(resourceType)) {
                 // Prevent removing Admins WRITE/MANAGE_SHARING access and Read Only Admins READ access
-                GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, gatewayId);
+                GatewayGroups gatewayGroups = retrieveGatewayGroups(gatewayId);
                 if (groupPermissionList.containsKey(gatewayGroups.getAdminsGroupId())
                         && groupPermissionList
                                 .get(gatewayGroups.getAdminsGroupId())
@@ -6267,15 +5610,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             }
             for (Map.Entry<String, ResourcePermissionType> groupPermission : groupPermissionList.entrySet()) {
                 if (groupPermission.getValue().equals(ResourcePermissionType.WRITE))
-                    sharingClient.revokeEntitySharingFromUsers(
+                    sharingHandler.revokeEntitySharingFromUsers(
                             gatewayId, resourceId, Arrays.asList(groupPermission.getKey()), gatewayId + ":" + "WRITE");
                 else if (groupPermission.getValue().equals(ResourcePermissionType.READ))
-                    sharingClient.revokeEntitySharingFromUsers(
+                    sharingHandler.revokeEntitySharingFromUsers(
                             gatewayId, resourceId, Arrays.asList(groupPermission.getKey()), gatewayId + ":" + "READ");
                 else if (groupPermission.getValue().equals(ResourcePermissionType.MANAGE_SHARING)) {
-                    if (userHasAccessInternal(sharingClient, authzToken, resourceId, ResourcePermissionType.OWNER)) {
-                        createManageSharingPermissionTypeIfMissing(sharingClient, gatewayId);
-                        sharingClient.revokeEntitySharingFromUsers(
+                    if (userHasAccessInternal(authzToken, resourceId, ResourcePermissionType.OWNER)) {
+                        createManageSharingPermissionTypeIfMissing(gatewayId);
+                        sharingHandler.revokeEntitySharingFromUsers(
                                 gatewayId,
                                 resourceId,
                                 Arrays.asList(groupPermission.getKey()),
@@ -6289,16 +5632,12 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AiravataClientException(AiravataErrorType.UNSUPPORTED_OPERATION);
                 }
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return true;
         } catch (Exception e) {
             String msg = "Error in revoking access to resource from groups. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6339,42 +5678,36 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken,
             String resourceId,
             ResourcePermissionType permissionType,
-            BiFunction<SharingRegistryService.Client, ResourcePermissionType, Collection<User>> userListFunction)
+            BiFunction<SharingRegistryServerHandler, ResourcePermissionType, Collection<User>> userListFunction)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             HashSet<String> accessibleUsers = new HashSet<>();
             if (permissionType.equals(ResourcePermissionType.WRITE)) {
-                userListFunction.apply(sharingClient, ResourcePermissionType.WRITE).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.WRITE).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
-                userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
             } else if (permissionType.equals(ResourcePermissionType.READ)) {
-                userListFunction.apply(sharingClient, ResourcePermissionType.READ).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.READ).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
-                userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
             } else if (permissionType.equals(ResourcePermissionType.OWNER)) {
-                userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
             } else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
-                userListFunction.apply(sharingClient, ResourcePermissionType.MANAGE_SHARING).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.MANAGE_SHARING).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
-                userListFunction.apply(sharingClient, ResourcePermissionType.OWNER).stream()
+                userListFunction.apply(sharingHandler, ResourcePermissionType.OWNER).stream()
                         .forEach(u -> accessibleUsers.add(u.getUserId()));
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return new ArrayList<>(accessibleUsers);
         } catch (Exception e) {
             String msg = "Error in getting all accessible users for resource. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6415,33 +5748,27 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken,
             String resourceId,
             ResourcePermissionType permissionType,
-            BiFunction<SharingRegistryService.Client, ResourcePermissionType, Collection<UserGroup>> groupListFunction)
+            BiFunction<SharingRegistryServerHandler, ResourcePermissionType, Collection<UserGroup>> groupListFunction)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             HashSet<String> accessibleGroups = new HashSet<>();
             if (permissionType.equals(ResourcePermissionType.WRITE)) {
-                groupListFunction.apply(sharingClient, ResourcePermissionType.WRITE).stream()
+                groupListFunction.apply(sharingHandler, ResourcePermissionType.WRITE).stream()
                         .forEach(g -> accessibleGroups.add(g.getGroupId()));
             } else if (permissionType.equals(ResourcePermissionType.READ)) {
-                groupListFunction.apply(sharingClient, ResourcePermissionType.READ).stream()
+                groupListFunction.apply(sharingHandler, ResourcePermissionType.READ).stream()
                         .forEach(g -> accessibleGroups.add(g.getGroupId()));
             } else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
-                groupListFunction.apply(sharingClient, ResourcePermissionType.MANAGE_SHARING).stream()
+                groupListFunction.apply(sharingHandler, ResourcePermissionType.MANAGE_SHARING).stream()
                         .forEach(g -> accessibleGroups.add(g.getGroupId()));
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return new ArrayList<>(accessibleGroups);
         } catch (Exception e) {
             String msg = "Error in getting all accessible groups for resource. Resource ID : " + resourceId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6453,10 +5780,8 @@ public class AiravataServerHandler implements Airavata.Iface {
                     TException {
         final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         final String userId = authzToken.getClaimsMap().get(Constants.USER_NAME) + "@" + domainId;
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            final boolean hasAccess = userHasAccessInternal(sharingClient, authzToken, resourceId, permissionType);
-            sharingClientPool.returnResource(sharingClient);
+            final boolean hasAccess = userHasAccessInternal(authzToken, resourceId, permissionType);
             return hasAccess;
         } catch (Exception e) {
             String msg = "Error in if user can access resource. User ID : " + userId + ", Resource ID : " + resourceId
@@ -6464,7 +5789,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -6475,12 +5799,10 @@ public class AiravataServerHandler implements Airavata.Iface {
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
         // TODO: verify that gatewayId in groupResourceProfile matches authzToken gatewayId
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
         try {
-            validateGroupResourceProfile(sharingClient, authzToken, groupResourceProfile);
-            String groupResourceProfileId = regClient.createGroupResourceProfile(groupResourceProfile);
+            validateGroupResourceProfile(authzToken, groupResourceProfile);
+            String groupResourceProfileId = registryHandler.createGroupResourceProfile(groupResourceProfile);
             if (ServerSettings.isEnableSharing()) {
                 try {
                     Entity entity = new Entity();
@@ -6491,41 +5813,35 @@ public class AiravataServerHandler implements Airavata.Iface {
                     entity.setOwnerId(userName + "@" + groupResourceProfile.getGatewayId());
                     entity.setName(groupResourceProfile.getGroupResourceProfileName());
 
-                    sharingClient.createEntity(entity);
+                    sharingHandler.createEntity(entity);
 
-                    shareEntityWithAdminGatewayGroups(regClient, sharingClient, entity);
+                    shareEntityWithAdminGatewayGroups(entity);
                 } catch (Exception ex) {
                     logger.error(ex.getMessage(), ex);
                     logger.error("Rolling back group resource profile creation Group Resource Profile ID : "
                             + groupResourceProfileId);
-                    regClient.removeGroupResourceProfile(groupResourceProfileId);
+                    registryHandler.removeGroupResourceProfile(groupResourceProfileId);
                     AiravataSystemException ase = new AiravataSystemException();
                     ase.setMessage("Failed to create sharing registry record");
                     throw ase;
                 }
             }
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             return groupResourceProfileId;
         } catch (AuthorizationException ae) {
             logger.info("User " + userName
                     + " not allowed access to resources referenced in this GroupResourceProfile. Reason: "
                     + ae.getMessage());
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw ae;
         } catch (Exception e) {
             String msg = "Error creating group resource profile.";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
 
     private void validateGroupResourceProfile(
-            SharingRegistryService.Client sharingClient,
             AuthzToken authzToken,
             GroupResourceProfile groupResourceProfile)
             throws AuthorizationException {
@@ -6542,7 +5858,7 @@ public class AiravataServerHandler implements Airavata.Iface {
             tokenIds.add(groupResourceProfile.getDefaultCredentialStoreToken());
         }
         for (String tokenId : tokenIds) {
-            if (!userHasAccessInternal(sharingClient, authzToken, tokenId, ResourcePermissionType.READ)) {
+            if (!userHasAccessInternal(authzToken, tokenId, ResourcePermissionType.READ)) {
                 throw new AuthorizationException(
                         "User does not have READ permission to credential token " + tokenId + ".");
             }
@@ -6554,26 +5870,19 @@ public class AiravataServerHandler implements Airavata.Iface {
     public void updateGroupResourceProfile(AuthzToken authzToken, GroupResourceProfile groupResourceProfile)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
-            validateGroupResourceProfile(sharingClient, authzToken, groupResourceProfile);
+            validateGroupResourceProfile(authzToken, groupResourceProfile);
             if (!userHasAccessInternal(
-                    sharingClient,
                     authzToken,
                     groupResourceProfile.getGroupResourceProfileId(),
                     ResourcePermissionType.WRITE)) {
                 throw new AuthorizationException("User does not have permission to update group resource profile");
             }
-            regClient.updateGroupResourceProfile(groupResourceProfile);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            registryHandler.updateGroupResourceProfile(groupResourceProfile);
         } catch (AuthorizationException ae) {
             String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
             logger.info("User " + userName + " not allowed access to update GroupResourceProfile "
                     + groupResourceProfile.getGroupResourceProfileId() + ", reason: " + ae.getMessage());
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw ae;
         } catch (Exception e) {
             String msg = "Error updating group resource profile. groupResourceProfileId: "
@@ -6581,7 +5890,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6591,14 +5899,12 @@ public class AiravataServerHandler implements Airavata.Iface {
     public GroupResourceProfile getGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
                         throw new AuthorizationException(
                                 "User does not have permission to access group resource profile");
@@ -6607,23 +5913,18 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AuthorizationException("User does not have permission to access group resource profile");
                 }
             }
-            GroupResourceProfile groupResourceProfile = regClient.getGroupResourceProfile(groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            GroupResourceProfile groupResourceProfile = registryHandler.getGroupResourceProfile(groupResourceProfileId);
             return groupResourceProfile;
         } catch (AuthorizationException checkedException) {
             logger.error(
                     "Error while retrieving group resource profile. groupResourceProfileId: " + groupResourceProfileId,
                     checkedException);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
             throw checkedException;
         } catch (Exception e) {
             String msg = "Error retrieving group resource profile. groupResourceProfileId: " + groupResourceProfileId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6633,14 +5934,12 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean removeGroupResourceProfile(AuthzToken authzToken, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException(
                                 "User does not have permission to remove group resource profile");
@@ -6649,17 +5948,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AuthorizationException("User does not have permission to remove group resource profile");
                 }
             }
-            boolean result = regClient.removeGroupResourceProfile(groupResourceProfileId);
-            sharingClient.deleteEntity(gatewayId, groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.removeGroupResourceProfile(groupResourceProfileId);
+            sharingHandler.deleteEntity(gatewayId, groupResourceProfileId);
             return result;
         } catch (Exception e) {
             String msg = "Error removing group resource profile. groupResourceProfileId: " + groupResourceProfileId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6669,8 +5965,6 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<GroupResourceProfile> getGroupResourceList(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         String userName = authzToken.getClaimsMap().get(Constants.USER_NAME);
         try {
             List<String> accessibleGroupResProfileIds = new ArrayList<>();
@@ -6681,7 +5975,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 searchCriteria.setSearchCondition(SearchCondition.EQUAL);
                 searchCriteria.setValue(gatewayId + ":" + ResourceType.GROUP_RESOURCE_PROFILE.name());
                 filters.add(searchCriteria);
-                sharingClient
+                sharingHandler
                         .searchEntities(
                                 authzToken.getClaimsMap().get(Constants.GATEWAY_ID),
                                 userName + "@" + gatewayId,
@@ -6692,17 +5986,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                         .forEach(p -> accessibleGroupResProfileIds.add(p.getEntityId()));
             }
             List<GroupResourceProfile> groupResourceProfileList =
-                    regClient.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.getGroupResourceList(gatewayId, accessibleGroupResProfileIds);
             return groupResourceProfileList;
         } catch (Exception e) {
             String msg = "Error retrieving list group resource profile list. GatewayId: " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
-            sharingClientPool.returnBrokenResource(sharingClient);
             throw exception;
         }
     }
@@ -6713,14 +6003,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":WRITE")) {
                         throw new AuthorizationException(
                                 "User does not have permission to remove group compute preferences");
@@ -6730,9 +6018,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                             "User does not have permission to remove group compute preferences");
                 }
             }
-            boolean result = regClient.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.removeGroupComputePrefs(computeResourceId, groupResourceProfileId);
             return result;
         } catch (Exception e) {
             String msg = "Error removing group compute resource preferences. GroupResourceProfileId: "
@@ -6740,7 +6026,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6750,16 +6035,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean removeGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     ComputeResourcePolicy computeResourcePolicy =
-                            regClient.getGroupComputeResourcePolicy(resourcePolicyId);
+                            registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId,
                             userId + "@" + gatewayId,
                             computeResourcePolicy.getGroupResourceProfileId(),
@@ -6772,16 +6055,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                             "User does not have permission to remove group compute resource policy");
                 }
             }
-            boolean result = regClient.removeGroupComputeResourcePolicy(resourcePolicyId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.removeGroupComputeResourcePolicy(resourcePolicyId);
             return result;
         } catch (Exception e) {
             String msg = "Error removing group compute resource policy. ResourcePolicyId: " + resourcePolicyId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6791,16 +6071,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean removeGroupBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     BatchQueueResourcePolicy batchQueueResourcePolicy =
-                            regClient.getBatchQueueResourcePolicy(resourcePolicyId);
+                            registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId,
                             userId + "@" + gatewayId,
                             batchQueueResourcePolicy.getGroupResourceProfileId(),
@@ -6813,16 +6091,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                             "User does not have permission to remove batch queue resource policy");
                 }
             }
-            boolean result = regClient.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            boolean result = registryHandler.removeGroupBatchQueueResourcePolicy(resourcePolicyId);
             return result;
         } catch (Exception e) {
             String msg = "Error removing batch queue resource policy. ResourcePolicyId: " + resourcePolicyId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6833,14 +6108,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String computeResourceId, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
                         throw new AuthorizationException(
                                 "User does not have permission to access group resource profile");
@@ -6850,16 +6123,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                 }
             }
             GroupComputeResourcePreference groupComputeResourcePreference =
-                    regClient.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.getGroupComputeResourcePreference(computeResourceId, groupResourceProfileId);
             return groupComputeResourcePreference;
         } catch (Exception e) {
             String msg = "Error retrieving Group compute preference. GroupResourceProfileId: " + groupResourceProfileId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6869,16 +6139,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ComputeResourcePolicy getGroupComputeResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     ComputeResourcePolicy computeResourcePolicy =
-                            regClient.getGroupComputeResourcePolicy(resourcePolicyId);
+                            registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId,
                             userId + "@" + gatewayId,
                             computeResourcePolicy.getGroupResourceProfileId(),
@@ -6891,16 +6159,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                 }
             }
 
-            ComputeResourcePolicy computeResourcePolicy = regClient.getGroupComputeResourcePolicy(resourcePolicyId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            ComputeResourcePolicy computeResourcePolicy = registryHandler.getGroupComputeResourcePolicy(resourcePolicyId);
             return computeResourcePolicy;
         } catch (Exception e) {
             String msg = "Error retrieving Group compute resource policy. ResourcePolicyId: " + resourcePolicyId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6910,16 +6175,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public BatchQueueResourcePolicy getBatchQueueResourcePolicy(AuthzToken authzToken, String resourcePolicyId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     BatchQueueResourcePolicy batchQueueResourcePolicy =
-                            regClient.getBatchQueueResourcePolicy(resourcePolicyId);
+                            registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId,
                             userId + "@" + gatewayId,
                             batchQueueResourcePolicy.getGroupResourceProfileId(),
@@ -6931,16 +6194,13 @@ public class AiravataServerHandler implements Airavata.Iface {
                     throw new AuthorizationException("User does not have permission to access group resource profile");
                 }
             }
-            BatchQueueResourcePolicy batchQueueResourcePolicy = regClient.getBatchQueueResourcePolicy(resourcePolicyId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+            BatchQueueResourcePolicy batchQueueResourcePolicy = registryHandler.getBatchQueueResourcePolicy(resourcePolicyId);
             return batchQueueResourcePolicy;
         } catch (Exception e) {
             String msg = "Error retrieving Group batch queue resource policy. ResourcePolicyId: " + resourcePolicyId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6951,14 +6211,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
                         throw new AuthorizationException(
                                 "User does not have permission to access group resource profile");
@@ -6968,9 +6226,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 }
             }
             List<GroupComputeResourcePreference> groupComputeResourcePreferenceList =
-                    regClient.getGroupComputeResourcePrefList(groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.getGroupComputeResourcePrefList(groupResourceProfileId);
             return groupComputeResourcePreferenceList;
         } catch (Exception e) {
             String msg = "Error retrieving Group compute resource preference. GroupResourceProfileId: "
@@ -6978,7 +6234,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -6989,14 +6244,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
                         throw new AuthorizationException(
                                 "User does not have permission to access group resource profile");
@@ -7006,9 +6259,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 }
             }
             List<BatchQueueResourcePolicy> batchQueueResourcePolicyList =
-                    regClient.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.getGroupBatchQueueResourcePolicyList(groupResourceProfileId);
             return batchQueueResourcePolicyList;
         } catch (Exception e) {
             String msg = "Error retrieving Group batch queue resource policy list. GroupResourceProfileId: "
@@ -7016,7 +6267,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7027,14 +6277,12 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String groupResourceProfileId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
-        SharingRegistryService.Client sharingClient = sharingClientPool.getResource();
         try {
             if (ServerSettings.isEnableSharing()) {
                 try {
                     String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
                     String userId = authzToken.getClaimsMap().get(Constants.USER_NAME);
-                    if (!sharingClient.userHasAccess(
+                    if (!sharingHandler.userHasAccess(
                             gatewayId, userId + "@" + gatewayId, groupResourceProfileId, gatewayId + ":READ")) {
                         throw new AuthorizationException(
                                 "User does not have permission to access group resource profile");
@@ -7044,9 +6292,7 @@ public class AiravataServerHandler implements Airavata.Iface {
                 }
             }
             List<ComputeResourcePolicy> computeResourcePolicyList =
-                    regClient.getGroupComputeResourcePolicyList(groupResourceProfileId);
-            registryClientPool.returnResource(regClient);
-            sharingClientPool.returnResource(sharingClient);
+                    registryHandler.getGroupComputeResourcePolicyList(groupResourceProfileId);
             return computeResourcePolicyList;
         } catch (Exception e) {
             String msg = "Error retrieving Group compute resource policy list. GroupResourceProfileId: "
@@ -7054,7 +6300,6 @@ public class AiravataServerHandler implements Airavata.Iface {
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7066,17 +6311,14 @@ public class AiravataServerHandler implements Airavata.Iface {
                     TException {
         String gatewayId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
 
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, gatewayId);
-            registryClientPool.returnResource(regClient);
+            GatewayGroups gatewayGroups = retrieveGatewayGroups(gatewayId);
             return gatewayGroups;
         } catch (Exception e) {
             String msg = "Error retrieving GatewayGroups for gateway: " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7086,17 +6328,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public Parser getParser(AuthzToken authzToken, String parserId, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            Parser parser = regClient.getParser(parserId, gatewayId);
-            registryClientPool.returnResource(regClient);
+            Parser parser = registryHandler.getParser(parserId, gatewayId);
             return parser;
         } catch (Exception e) {
             String msg = "Error retrieving parser with id: " + parserId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7106,17 +6345,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String saveParser(AuthzToken authzToken, Parser parser)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String parserId = regClient.saveParser(parser);
-            registryClientPool.returnResource(regClient);
+            String parserId = registryHandler.saveParser(parser);
             return parserId;
         } catch (Exception e) {
             String msg = "Error while saving the parser";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7126,17 +6362,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<Parser> listAllParsers(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<Parser> parsers = regClient.listAllParsers(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<Parser> parsers = registryHandler.listAllParsers(gatewayId);
             return parsers;
         } catch (Exception e) {
             String msg = "Error while listing the parsers for gateway " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7146,17 +6379,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean removeParser(AuthzToken authzToken, String parserId, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            regClient.removeParser(parserId, gatewayId);
-            registryClientPool.returnResource(regClient);
+            registryHandler.removeParser(parserId, gatewayId);
             return true;
         } catch (Exception e) {
             String msg = "Error while removing the parser " + parserId + " in gateway " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7166,17 +6396,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public ParsingTemplate getParsingTemplate(AuthzToken authzToken, String templateId, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            ParsingTemplate parsingTemplate = regClient.getParsingTemplate(templateId, gatewayId);
-            registryClientPool.returnResource(regClient);
+            ParsingTemplate parsingTemplate = registryHandler.getParsingTemplate(templateId, gatewayId);
             return parsingTemplate;
         } catch (Exception e) {
             String msg = "Error retrieving parsing template with id: " + templateId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7187,18 +6414,15 @@ public class AiravataServerHandler implements Airavata.Iface {
             AuthzToken authzToken, String experimentId, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             List<ParsingTemplate> parsingTemplates =
-                    regClient.getParsingTemplatesForExperiment(experimentId, gatewayId);
-            registryClientPool.returnResource(regClient);
+                    registryHandler.getParsingTemplatesForExperiment(experimentId, gatewayId);
             return parsingTemplates;
         } catch (Exception e) {
             String msg = "Error retrieving parsing templates for experiment: " + experimentId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7208,17 +6432,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public String saveParsingTemplate(AuthzToken authzToken, ParsingTemplate parsingTemplate)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            String templateId = regClient.saveParsingTemplate(parsingTemplate);
-            registryClientPool.returnResource(regClient);
+            String templateId = registryHandler.saveParsingTemplate(parsingTemplate);
             return templateId;
         } catch (Exception e) {
             String msg = "Error saving the parsing template";
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7228,17 +6449,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public boolean removeParsingTemplate(AuthzToken authzToken, String templateId, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            regClient.removeParsingTemplate(templateId, gatewayId);
-            registryClientPool.returnResource(regClient);
+            registryHandler.removeParsingTemplate(templateId, gatewayId);
             return true;
         } catch (Exception e) {
             String msg = "Error while removing the parsing template " + templateId + " in gateway " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7248,17 +6466,14 @@ public class AiravataServerHandler implements Airavata.Iface {
     public List<ParsingTemplate> listAllParsingTemplates(AuthzToken authzToken, String gatewayId)
             throws InvalidRequestException, AiravataClientException, AiravataSystemException, AuthorizationException,
                     TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
-            List<ParsingTemplate> templates = regClient.listAllParsingTemplates(gatewayId);
-            registryClientPool.returnResource(regClient);
+            List<ParsingTemplate> templates = registryHandler.listAllParsingTemplates(gatewayId);
             return templates;
         } catch (Exception e) {
             String msg = "Error while listing the parsing templates for gateway " + gatewayId;
             logger.error(msg, e);
             AiravataSystemException exception = new AiravataSystemException(AiravataErrorType.INTERNAL_ERROR);
             exception.setMessage(msg + " More info : " + e.getMessage());
-            registryClientPool.returnBrokenResource(regClient);
             throw exception;
         }
     }
@@ -7297,24 +6512,24 @@ public class AiravataServerHandler implements Airavata.Iface {
     }
 
     private void shareEntityWithAdminGatewayGroups(
-            RegistryService.Client regClient, SharingRegistryService.Client sharingClient, Entity entity)
+            Entity entity)
             throws TException {
         final String domainId = entity.getDomainId();
-        GatewayGroups gatewayGroups = retrieveGatewayGroups(regClient, domainId);
-        createManageSharingPermissionTypeIfMissing(sharingClient, domainId);
-        sharingClient.shareEntityWithGroups(
+        GatewayGroups gatewayGroups = retrieveGatewayGroups(domainId);
+        createManageSharingPermissionTypeIfMissing(domainId);
+        sharingHandler.shareEntityWithGroups(
                 domainId,
                 entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getAdminsGroupId()),
                 domainId + ":MANAGE_SHARING",
                 true);
-        sharingClient.shareEntityWithGroups(
+        sharingHandler.shareEntityWithGroups(
                 domainId,
                 entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getAdminsGroupId()),
                 domainId + ":WRITE",
                 true);
-        sharingClient.shareEntityWithGroups(
+        sharingHandler.shareEntityWithGroups(
                 domainId,
                 entity.getEntityId(),
                 Arrays.asList(gatewayGroups.getAdminsGroupId(), gatewayGroups.getReadOnlyAdminsGroupId()),
@@ -7323,27 +6538,26 @@ public class AiravataServerHandler implements Airavata.Iface {
     }
 
     private boolean userHasAccessInternal(
-            SharingRegistryService.Client sharingClient,
             AuthzToken authzToken,
             String entityId,
             ResourcePermissionType permissionType) {
         final String domainId = authzToken.getClaimsMap().get(Constants.GATEWAY_ID);
         final String userId = authzToken.getClaimsMap().get(Constants.USER_NAME) + "@" + domainId;
         try {
-            final boolean hasOwnerAccess = sharingClient.userHasAccess(
+            final boolean hasOwnerAccess = sharingHandler.userHasAccess(
                     domainId, userId, entityId, domainId + ":" + ResourcePermissionType.OWNER);
             boolean hasAccess = false;
             if (permissionType.equals(ResourcePermissionType.WRITE)) {
                 hasAccess = hasOwnerAccess
-                        || sharingClient.userHasAccess(
+                        || sharingHandler.userHasAccess(
                                 domainId, userId, entityId, domainId + ":" + ResourcePermissionType.WRITE);
             } else if (permissionType.equals(ResourcePermissionType.READ)) {
                 hasAccess = hasOwnerAccess
-                        || sharingClient.userHasAccess(
+                        || sharingHandler.userHasAccess(
                                 domainId, userId, entityId, domainId + ":" + ResourcePermissionType.READ);
             } else if (permissionType.equals(ResourcePermissionType.MANAGE_SHARING)) {
                 hasAccess = hasOwnerAccess
-                        || sharingClient.userHasAccess(
+                        || sharingHandler.userHasAccess(
                                 domainId, userId, entityId, domainId + ":" + ResourcePermissionType.MANAGE_SHARING);
             } else if (permissionType.equals(ResourcePermissionType.OWNER)) {
                 hasAccess = hasOwnerAccess;
@@ -7354,9 +6568,9 @@ public class AiravataServerHandler implements Airavata.Iface {
         }
     }
 
-    private ResourceType getResourceType(SharingRegistryService.Client sharingClient, String domainId, String entityId)
+    private ResourceType getResourceType(String domainId, String entityId)
             throws TException {
-        Entity entity = sharingClient.getEntity(domainId, entityId);
+        Entity entity = sharingHandler.getEntity(domainId, entityId);
         for (ResourceType resourceType : ResourceType.values()) {
             if (entity.getEntityTypeId().equals(domainId + ":" + resourceType.name())) {
                 return resourceType;
@@ -7366,24 +6580,24 @@ public class AiravataServerHandler implements Airavata.Iface {
     }
 
     private void createManageSharingPermissionTypeIfMissing(
-            SharingRegistryService.Client sharingClient, String domainId) throws TException {
+            String domainId) throws TException {
         // AIRAVATA-3297 Some gateways were created without the MANAGE_SHARING permission, so add it if missing
         String permissionTypeId = domainId + ":MANAGE_SHARING";
-        if (!sharingClient.isPermissionExists(domainId, permissionTypeId)) {
+        if (!sharingHandler.isPermissionExists(domainId, permissionTypeId)) {
             PermissionType permissionType = new PermissionType();
             permissionType.setPermissionTypeId(permissionTypeId);
             permissionType.setDomainId(domainId);
             permissionType.setName("MANAGE_SHARING");
             permissionType.setDescription("Manage sharing permission type");
-            sharingClient.createPermissionType(permissionType);
+            sharingHandler.createPermissionType(permissionType);
             logger.info("Created MANAGE_SHARING permission type for domain " + domainId);
         }
     }
 
-    private GatewayGroups retrieveGatewayGroups(RegistryService.Client regClient, String gatewayId) throws TException {
+    private GatewayGroups retrieveGatewayGroups(String gatewayId) throws TException {
 
-        if (regClient.isGatewayGroupsExists(gatewayId)) {
-            return regClient.getGatewayGroups(gatewayId);
+        if (registryHandler.isGatewayGroupsExists(gatewayId)) {
+            return registryHandler.getGatewayGroups(gatewayId);
         } else {
             return GatewayGroupsInitializer.initializeGatewayGroups(gatewayId);
         }
@@ -7398,19 +6612,15 @@ public class AiravataServerHandler implements Airavata.Iface {
      * Check if a gateway resource profile exists
      */
     private boolean isGatewayResourceProfileExists(String gatewayId) throws TException {
-        RegistryService.Client regClient = registryClientPool.getResource();
         try {
             try {
-                GatewayResourceProfile profile = regClient.getGatewayResourceProfile(gatewayId);
-                registryClientPool.returnResource(regClient);
+                GatewayResourceProfile profile = registryHandler.getGatewayResourceProfile(gatewayId);
                 return profile != null;
             } catch (org.apache.thrift.TApplicationException e) {
                 logger.error("Gateway resource profile does not exist for gateway: {}", gatewayId, e);
-                registryClientPool.returnResource(regClient);
                 return false;
             }
         } catch (Exception e) {
-            registryClientPool.returnBrokenResource(regClient);
             logger.error("Error while checking if gateway resource profile exists", e);
             throw e;
         }


(airavata) 05/06: feat: update DevOps configs for single unified server deployment

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasith pushed a commit to branch feat/single-jvm
in repository https://gitbox.apache.org/repos/asf/airavata.git

commit ddee63173e5838c90cb190fdbd5dacd95aa37ed1
Author: yasithdev <ya...@icloud.com>
AuthorDate: Wed Mar 25 23:56:35 2026 -0500

    feat: update DevOps configs for single unified server deployment
    
    - docker-startup.sh: Start single AiravataUnifiedServer instead of separate services
    - airavata-server.properties: Remove per-service host/port configs, keep unified DB config
    - Ansible start_services.yml: Start unified-server.sh instead of orchestrator/controller/etc
    - Ansible stop_services.yml: Stop unified-server and simplify port/log directory configs
    - Ansible defaults/main.yml: Replace service class configs with unified_server_class
    - services_up.sh: Start unified-server instead of separate services
    - services_down.sh: Stop unified-server instead of separate services
    - deploy_api_server.yml: Make unified-server.sh executable
    
    All services now multiplexed on port 8930 via AiravataUnifiedServer.
    
    Co-Authored-By: Claude Opus 4.6 (1M context) <no...@anthropic.com>
---
 .../roles/airavata_services/defaults/main.yml      | 29 +------
 .../airavata_services/tasks/deploy_api_server.yml  | 10 +--
 .../airavata_services/tasks/start_services.yml     | 65 ++------------
 .../airavata_services/tasks/stop_services.yml      | 80 ++----------------
 .../deployment-scripts/airavata-server.properties  | 65 +-------------
 dev-tools/deployment-scripts/docker-startup.sh     | 98 ++++++++--------------
 dev-tools/deployment-scripts/services_down.sh      | 22 ++---
 dev-tools/deployment-scripts/services_up.sh        | 22 ++---
 8 files changed, 68 insertions(+), 323 deletions(-)

diff --git a/dev-tools/ansible/roles/airavata_services/defaults/main.yml b/dev-tools/ansible/roles/airavata_services/defaults/main.yml
index 06eecc7f87..08fb811237 100644
--- a/dev-tools/ansible/roles/airavata_services/defaults/main.yml
+++ b/dev-tools/ansible/roles/airavata_services/defaults/main.yml
@@ -38,11 +38,6 @@ restproxy_dir: "{{ deployment_dir }}/{{ restproxy_dist_name }}"
 
 # Service ports
 api_server_port: 8930
-profile_service_port: 8962
-registry_port: 8970
-registry_server_port: 8970
-sharing_registry_port: 7878
-cred_store_port: 8960
 agent_service_port: 18880
 agent_service_server_port: 18880
 research_service_port: 18899
@@ -52,7 +47,6 @@ restproxy_port: 8082
 
 # Service hosts
 api_server_host: "airavata.localhost"
-profile_service_host: "airavata.localhost"
 agent_service_server_address: "airavata.localhost"
 research_service_server_address: "airavata.localhost"
 
@@ -68,25 +62,10 @@ participant_monitoring_host: "airavata.localhost"
 pre_workflow_manager_monitoring_host: "airavata.localhost"
 post_workflow_manager_monitoring_host: "airavata.localhost"
 
-# Server hosts
-orchestrator_server_host: "airavata.localhost"
-regserver_server_host: "airavata.localhost"
-sharing_registry_server_host: "airavata.localhost"
-cred_store_server_host: "airavata.localhost"
-
-# Orchestrator configuration
-orchestrator_class: "org.apache.airavata.orchestrator.server.OrchestratorServer"
-orchestrator_server_port: 8940
-orchestrator_server_min_threads: 50
-job_validators: "org.apache.airavata.orchestrator.core.validator.impl.BatchQueueValidator,org.apache.airavata.orchestrator.core.validator.impl.ExperimentStatusValidator"
-enable_validation: true
-host_scheduler: "org.apache.airavata.orchestrator.core.schedule.DefaultHostScheduler"
-
-# Registry server configuration
-regserver_class: "org.apache.airavata.registry.api.service.RegistryAPIServer"
-
-# Sharing registry configuration
-sharing_server_class: "org.apache.airavata.sharing.registry.server.SharingRegistryServer"
+# All services run on unified server (no separate server hosts needed)
+
+# Unified Server (replaces separate service configurations)
+unified_server_class: "org.apache.airavata.api.server.AiravataUnifiedServer"
 enable_sharing: true
 
 # Default registry user
diff --git a/dev-tools/ansible/roles/airavata_services/tasks/deploy_api_server.yml b/dev-tools/ansible/roles/airavata_services/tasks/deploy_api_server.yml
index 9307f09550..24096c3ca0 100644
--- a/dev-tools/ansible/roles/airavata_services/tasks/deploy_api_server.yml
+++ b/dev-tools/ansible/roles/airavata_services/tasks/deploy_api_server.yml
@@ -118,18 +118,12 @@
     - deploy
     - api-server
 
-- name: Set executable permissions on API Server scripts
+- name: Set executable permissions on Unified Server script
   file:
     path: "{{ api_server_dir }}/bin/{{ item }}"
     mode: "0755"
   loop:
-    - orchestrator.sh
-    - controller.sh
-    - participant.sh
-    - pre-wm.sh
-    - post-wm.sh
-    - email-monitor.sh
-    - realtime-monitor.sh
+    - unified-server.sh
   tags:
     - deploy
     - api-server
diff --git a/dev-tools/ansible/roles/airavata_services/tasks/start_services.yml b/dev-tools/ansible/roles/airavata_services/tasks/start_services.yml
index 3f2f1c9ab4..97ce3fa294 100644
--- a/dev-tools/ansible/roles/airavata_services/tasks/start_services.yml
+++ b/dev-tools/ansible/roles/airavata_services/tasks/start_services.yml
@@ -18,79 +18,24 @@
 # under the License.
 #
 
-- name: Start API Server orchestrator
-  shell: '{{ api_server_dir }}/bin/orchestrator.sh -d start api-orch'
+- name: Start Airavata Unified Server
+  shell: '{{ api_server_dir }}/bin/unified-server.sh -d start'
   args:
     chdir: '{{ api_server_dir }}'
   tags:
     - start
     - api-server
 
-- name: Wait for API Server orchestrator to be ready
+- name: Wait for Airavata Unified Server to be ready
   wait_for:
-    port: '{{ orchestrator_server_port }}'
-    host: airavata.localhost
+    port: '{{ api_server_port }}'
+    host: '{{ api_server_host }}'
     delay: 5
     timeout: 60
   tags:
     - start
     - api-server
 
-- name: Start API Server controller
-  shell: '{{ api_server_dir }}/bin/controller.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Start API Server participant
-  shell: '{{ api_server_dir }}/bin/participant.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Start API Server email-monitor
-  shell: '{{ api_server_dir }}/bin/email-monitor.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Start API Server realtime-monitor
-  shell: '{{ api_server_dir }}/bin/realtime-monitor.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Start API Server pre-wm
-  shell: '{{ api_server_dir }}/bin/pre-wm.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Start API Server post-wm
-  shell: '{{ api_server_dir }}/bin/post-wm.sh -d start'
-  args:
-    chdir: '{{ api_server_dir }}'
-  tags:
-    - start
-    - api-server
-
-- name: Wait for API Server to start
-  wait_for:
-    timeout: 30
-  tags:
-    - start
-    - api-server
-
 - name: Start Agent Service
   shell: '{{ agent_service_dir }}/bin/agent-service.sh -d start'
   args:
diff --git a/dev-tools/ansible/roles/airavata_services/tasks/stop_services.yml b/dev-tools/ansible/roles/airavata_services/tasks/stop_services.yml
index c8a8c0a9b7..791481ca26 100644
--- a/dev-tools/ansible/roles/airavata_services/tasks/stop_services.yml
+++ b/dev-tools/ansible/roles/airavata_services/tasks/stop_services.yml
@@ -19,58 +19,16 @@
 #
 
 ---
-- name: Check if API Server binary exists
+- name: Check if Unified Server binary exists
   stat:
-    path: "{{ api_server_dir }}/bin/orchestrator.sh"
-  register: api_server_exists
+    path: "{{ api_server_dir }}/bin/unified-server.sh"
+  register: unified_server_exists
   tags:
     - stop
 
-- name: Stop API Server orchestrator if exists
-  shell: "{{ api_server_dir }}/bin/orchestrator.sh -d stop api-orch"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server controller if exists
-  shell: "{{ api_server_dir }}/bin/controller.sh -d stop"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server participant if exists
-  shell: "{{ api_server_dir }}/bin/participant.sh -d stop"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server pre-wm if exists
-  shell: "{{ api_server_dir }}/bin/pre-wm.sh -d stop"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server post-wm if exists
-  shell: "{{ api_server_dir }}/bin/post-wm.sh -d stop"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server email-monitor if exists
-  shell: "{{ api_server_dir }}/bin/email-monitor.sh -d stop"
-  when: api_server_exists.stat.exists
-  tags:
-    - stop
-  ignore_errors: yes
-
-- name: Stop API Server realtime-monitor if exists
-  shell: "{{ api_server_dir }}/bin/realtime-monitor.sh -d stop"
-  when: api_server_exists.stat.exists
+- name: Stop Airavata Unified Server if exists
+  shell: "{{ api_server_dir }}/bin/unified-server.sh -d stop"
+  when: unified_server_exists.stat.exists
   tags:
     - stop
   ignore_errors: yes
@@ -141,25 +99,7 @@
   set_fact:
     airavata_ports:
       - port: "{{ api_server_port }}"
-        service: "API Server"
-      - port: "{{ orchestrator_server_port }}"
-        service: "Orchestrator"
-      - port: "{{ registry_server_port }}"
-        service: "Registry"
-      - port: "{{ sharing_registry_port }}"
-        service: "Sharing Registry"
-      - port: "{{ cred_store_port }}"
-        service: "Credential Store"
-      - port: "{{ profile_service_port }}"
-        service: "Profile Service"
-      - port: "{{ agent_service_server_port }}"
-        service: "Agent Service"
-      - port: "{{ research_service_server_port }}"
-        service: "Research Service"
-      - port: "{{ file_server_port }}"
-        service: "File Server"
-      - port: "{{ restproxy_port }}"
-        service: "REST Proxy"
+        service: "Unified Server"
       - port: "{{ participant_monitoring_port }}"
         service: "Participant Monitoring"
       - port: "{{ api_server_monitoring_port }}"
@@ -258,11 +198,7 @@
 - name: Define Airavata service log directories
   set_fact:
     airavata_log_dirs:
-      - { service: "API Server", path: "{{ api_server_dir }}/logs" }
-      - { service: "Agent Service", path: "{{ agent_service_dir }}/logs" }
-      - { service: "Research Service", path: "{{ research_service_dir }}/logs" }
-      - { service: "File Server", path: "{{ file_server_dir }}/logs" }
-      - { service: "REST Proxy", path: "{{ restproxy_dir }}/logs" }
+      - { service: "Unified Server", path: "{{ api_server_dir }}/logs" }
   when: archive_logs_on_stop | bool
 
 - name: Check log directories
diff --git a/dev-tools/deployment-scripts/airavata-server.properties b/dev-tools/deployment-scripts/airavata-server.properties
index fc8cc3bd90..1ea44cdedd 100644
--- a/dev-tools/deployment-scripts/airavata-server.properties
+++ b/dev-tools/deployment-scripts/airavata-server.properties
@@ -229,12 +229,12 @@ enable.application.catalog=true
 application.deployment.directory=/opt/airavata/applications
 
 ############################
-# Orchestrator Configuration
+# Unified Server Configuration
 ############################
+# All Thrift services are multiplexed on the unified server port (8930)
+# No separate per-service host/port configurations needed
 enable.orchestrator=true
-orchestrator.server.host=airavata.localhost
-orchestrator.server.port=8940
-orchestrator.server.name=Airavata_Orchestrator
+enable.gfac=true
 
 ############################
 # Helix Controller & Participant Settings
@@ -254,60 +254,3 @@ post.workflow.manager.monitoring.host=airavata.localhost
 # Helix Participant Settings
 ############################
 helix.participant.name=AiravataParticipant
-
-############################
-# GFAC Configuration
-############################
-enable.gfac=true
-gfac.server.host=airavata.localhost
-gfac.server.port=8950
-gfac.server.name=Airavata_GFAC
-
-############################
-# Registry Configuration
-############################
-registry.server.host=airavata.localhost
-registry.server.port=8960
-registry.server.name=Airavata_Registry
-
-############################
-# Credential Store Configuration
-############################
-credential.store.server.host=airavata.localhost
-credential.store.server.port=8961
-credential.store.server.name=Airavata_CredentialStore
-
-############################
-# User Profile Configuration
-############################
-profile.service.server.host=airavata.localhost
-profile.service.server.port=8962
-profile.service.server.name=Airavata_ProfileService
-
-############################
-# Tenant Profile Configuration
-############################
-tenant.profile.service.server.host=airavata.localhost
-tenant.profile.service.server.port=8963
-tenant.profile.service.server.name=Airavata_TenantProfileService
-
-############################
-# IAM Admin Services Configuration
-############################
-iam.admin.services.server.host=airavata.localhost
-iam.admin.services.server.port=8964
-iam.admin.services.server.name=Airavata_IamAdminServices
-
-############################
-# Group Manager Configuration
-############################
-group.manager.service.server.host=airavata.localhost
-group.manager.service.server.port=8965
-group.manager.service.server.name=Airavata_GroupManagerService
-
-############################
-# Sharing Registry Configuration
-############################
-sharing.registry.server.host=airavata.localhost
-sharing.registry.server.port=8966
-sharing.registry.server.name=Airavata_SharingRegistryService
diff --git a/dev-tools/deployment-scripts/docker-startup.sh b/dev-tools/deployment-scripts/docker-startup.sh
index 0e2b5a5d6c..71d2f9b65a 100644
--- a/dev-tools/deployment-scripts/docker-startup.sh
+++ b/dev-tools/deployment-scripts/docker-startup.sh
@@ -5,8 +5,8 @@ set -e
 # Set Airavata configuration directory
 export AIRAVATA_CONFIG_DIR=/opt/airavata/vault
 
-echo "🚀 Starting Apache Airavata Monolithic Server..."
-echo "📋 All services included: API Server, Agent Service, Research Service, File Server"
+echo "🚀 Starting Apache Airavata Unified Server..."
+echo "📋 Single JVM server with all Thrift services multiplexed on port 8930"
 echo "📁 Properties file location: /opt/airavata/vault/airavata-server.properties"
 echo "📁 Configuration directory: $AIRAVATA_CONFIG_DIR"
 echo "📊 All logs will be captured and visible via 'docker logs'"
@@ -66,25 +66,14 @@ start_service() {
 }
 
 # ================================
-# Start the API Server Components
+# Start the Unified Server
 # ================================
-log "🔧 Starting the API Services..."
+log "🔧 Starting Airavata Unified Server..."
 
 cd ${AIRAVATA_HOME}
 
-# Start all API services
-start_service "Orchestrator" "./bin/orchestrator.sh" "${AIRAVATA_HOME}/logs/orchestrator.log"
-start_service "Controller" "./bin/controller.sh" "${AIRAVATA_HOME}/logs/controller.log"
-start_service "Participant" "./bin/participant.sh" "${AIRAVATA_HOME}/logs/participant.log"
-# Email Monitor (disabled by default due to config requirements)
-log "📧 Email Monitor disabled (requires email config)"
-echo "$(date '+%Y-%m-%d %H:%M:%S') - Email Monitor disabled (requires email config)" | sed "s/^/[Email Monitor] /"
-
-# Realtime Monitor (disabled due to API connection dependency)  
-log "⏱️  Realtime Monitor disabled (requires API server running)"
-echo "$(date '+%Y-%m-%d %H:%M:%S') - Realtime Monitor disabled (requires API server running)" | sed "s/^/[Realtime Monitor] /"
-start_service "Pre-WM" "./bin/pre-wm.sh" "${AIRAVATA_HOME}/logs/pre-wm.log"
-start_service "Post-WM" "./bin/post-wm.sh" "${AIRAVATA_HOME}/logs/post-wm.log"
+# Start unified server - single JVM with all services multiplexed on port 8930
+start_service "Airavata Unified" "./bin/unified-server.sh" "${AIRAVATA_HOME}/logs/unified-server.log"
 
 # ================================
 # Start the Agent Service (Optional)
@@ -123,21 +112,22 @@ else
 fi
 
 # ================================
-# Monitor all logs and keep container running
+# Monitor logs and keep container running
 # ================================
-log "🎉 All Airavata services started successfully!"
-log "📊 Starting comprehensive log monitoring..."
-
-# Wait a moment for all services to initialize
-sleep 10
-
-# Stream all service logs to docker logs and keep container running
-echo "🚀 All Airavata services are running!"
-echo "📋 Service status:"
-echo "   - ZooKeeper: Connected (no more 'airavata.localhost' errors)"
-echo "   - All components started successfully"
+log "🎉 Airavata Unified Server started successfully!"
+log "📊 Starting log monitoring..."
+
+# Wait a moment for server to initialize
+sleep 5
+
+# Stream server logs to docker logs and keep container running
+echo "🚀 Airavata Unified Server is running on port 8930!"
+echo "📋 Server status:"
+echo "   - Single JVM with all Thrift services multiplexed"
+echo "   - Services: Airavata, RegistryService, SharingRegistry, CredentialStore"
+echo "   - Additional: UserProfile, TenantProfile, IamAdminServices, GroupManager"
 echo ""
-echo "🔍 Streaming all logs to 'docker logs -f airavata-monolithic'"
+echo "🔍 Streaming logs to 'docker logs -f airavata-monolithic'"
 echo ""
 
 # Function to monitor log file and stream to stdout with prefix
@@ -166,48 +156,30 @@ monitor_log() {
     fi
 }
 
-# Wait a moment for log files to be created
-echo "📊 Waiting for log files to be created..."
-sleep 15
+# Wait a moment for log file to be created
+echo "📊 Waiting for unified server log file to be created..."
+sleep 5
 
-# Start monitoring all service logs
-echo "📊 Starting log monitoring for all services..."
+# Start monitoring unified server logs
+echo "📊 Starting log monitoring for unified server..."
 cd ${AIRAVATA_HOME}
 
-# Monitor core service logs
-monitor_log "${AIRAVATA_HOME}/logs/controller.log" "Controller"
-monitor_log "${AIRAVATA_HOME}/logs/participant.log" "Participant"
-
-# Monitor workflow manager logs if they exist
-monitor_log "${AIRAVATA_HOME}/logs/pre-wm.log" "Pre-WM"
-monitor_log "${AIRAVATA_HOME}/logs/post-wm.log" "Post-WM"
-
-# Monitor additional service logs if they exist
-monitor_log "${AIRAVATA_HOME}/logs/orchestrator.log" "Orchestrator"
-monitor_log "${AIRAVATA_HOME}/logs/email-monitor.log" "Email-Monitor"
-monitor_log "${AIRAVATA_HOME}/logs/realtime-monitor.log" "Realtime-Monitor"
-
-# Monitor optional service logs
-monitor_log "${AIRAVATA_HOME}/logs/agent-service.log" "Agent"
-monitor_log "${AIRAVATA_HOME}/logs/research-service.log" "Research"
-monitor_log "${AIRAVATA_HOME}/logs/file-service.log" "File"
+# Monitor unified server logs
+monitor_log "${AIRAVATA_HOME}/logs/unified-server.log" "Unified-Server"
 
-echo "📊 All log monitoring started!"
-echo "🔍 Use 'docker logs -f airavata-monolithic' to view all service logs"
+echo "📊 Log monitoring started!"
+echo "🔍 Use 'docker logs -f airavata-monolithic' to view server logs"
 
 # Keep container running and show periodic status
 while true; do
     sleep 300  # Check every 5 minutes
-    echo "[Status] $(date): Container active, monitoring logs from all services"
-    
-    # Check if critical processes are still running
-    if ! pgrep -f "controller" > /dev/null; then
-        echo "[WARNING] Controller process not found"
-    fi
-    if ! pgrep -f "participant" > /dev/null; then
-        echo "[WARNING] Participant process not found"
+    echo "[Status] $(date): Container active, monitoring unified server logs"
+
+    # Check if unified server process is still running
+    if ! pgrep -f "AiravataUnifiedServer" > /dev/null; then
+        echo "[WARNING] Unified server process not found"
     fi
-    
+
     # Show number of running tail processes
     tail_count=$(pgrep -f "tail -F" | wc -l)
     echo "[Status] Currently monitoring $tail_count log files"
diff --git a/dev-tools/deployment-scripts/services_down.sh b/dev-tools/deployment-scripts/services_down.sh
index e626972f47..e933bf3561 100644
--- a/dev-tools/deployment-scripts/services_down.sh
+++ b/dev-tools/deployment-scripts/services_down.sh
@@ -5,23 +5,11 @@ log() {
 }
 
 # ================================
-# Shutdown the API Server
-# ================================
-log "Stopping the API Services..."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/orchestrator.sh -d stop api-orch
-log "Orchestrator stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/controller.sh -d stop
-log "Controller stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/participant.sh -d stop
-log "Participant stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/pre-wm.sh -d stop
-log "Pre-Workflow Manager stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/post-wm.sh -d stop
-log "Post-Workflow Manager stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/email-monitor.sh -d stop
-log "Email Monitor stopped."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/realtime-monitor.sh -d stop
-log "Realtime Monitor stopped."
+# Shutdown the Unified Server
+# ================================
+log "Stopping the Airavata Unified Server..."
+./apache-airavata-api-server-0.21-SNAPSHOT/bin/unified-server.sh -d stop
+log "Unified Server stopped."
 
 # ================================
 # Shutdown the Agent Service
diff --git a/dev-tools/deployment-scripts/services_up.sh b/dev-tools/deployment-scripts/services_up.sh
index 508637e362..de35716973 100644
--- a/dev-tools/deployment-scripts/services_up.sh
+++ b/dev-tools/deployment-scripts/services_up.sh
@@ -6,23 +6,11 @@ log() {
 }
 
 # ================================
-# Start the API Server
-# ================================
-log "Starting the API Services..."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/orchestrator.sh -d start api-orch
-log "Orchestrator started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/controller.sh -d start
-log "Controller started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/participant.sh -d start
-log "Participant started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/email-monitor.sh -d start
-log "Email Monitor started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/realtime-monitor.sh -d start
-log "Realtime Monitor started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/pre-wm.sh -d start
-log "Pre-Workflow Manager started."
-./apache-airavata-api-server-0.21-SNAPSHOT/bin/post-wm.sh -d start
-log "Post-Workflow Manager started."
+# Start the Unified Server
+# ================================
+log "Starting the Airavata Unified Server..."
+./apache-airavata-api-server-0.21-SNAPSHOT/bin/unified-server.sh -d start
+log "Unified Server started."
 
 # ================================
 # Start the Agent Service