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 18:13:47 UTC
(airavata) 31/38: refactor: extract initialization from AiravataServerHandler constructor
This is an automated email from the ASF dual-hosted git repository.
yasith pushed a commit to branch feat/airavata-service-layer
in repository https://gitbox.apache.org/repos/asf/airavata.git
commit 82a5a17dd45aa88dde957afdfe04c0c062246573
Author: yasithdev <ya...@icloud.com>
AuthorDate: Thu Mar 26 12:24:22 2026 -0500
refactor: extract initialization from AiravataServerHandler constructor
Move initSharingRegistry() and postInitDefaultGateway() calls out of the
constructor into a new public initialize() method. The constructor now only
wires dependencies, while initialization side effects are deferred to
initialize(), which is called explicitly by AiravataServer after construction.
---
.../java/org/apache/airavata/api/server/AiravataServer.java | 1 +
.../airavata/api/server/handler/AiravataServerHandler.java | 13 +++++++++----
2 files changed, 10 insertions(+), 4 deletions(-)
diff --git a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataServer.java b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataServer.java
index faa04b35a2..4d4acf38cf 100644
--- a/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataServer.java
+++ b/airavata-api/src/main/java/org/apache/airavata/api/server/AiravataServer.java
@@ -133,6 +133,7 @@ public class AiravataServer {
// Until then this file will not compile.
AiravataServerHandler airavataServerHandler = new AiravataServerHandler(
registryServerHandler, sharingRegistryServerHandler, credentialStoreServerHandler);
+ airavataServerHandler.initialize();
// --- 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 56a318583f..0f2bdd7898 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
@@ -152,14 +152,10 @@ public class AiravataServerHandler implements Airavata.Iface {
try {
statusPublisher = MessagingFactory.getPublisher(Type.STATUS);
experimentPublisher = MessagingFactory.getPublisher(Type.EXPERIMENT_LAUNCH);
- initSharingRegistry();
- postInitDefaultGateway();
} catch (ApplicationSettingsException e) {
logger.error("Error occured while reading airavata-server properties..", e);
} catch (AiravataException e) {
logger.error("Error occured while reading airavata-server properties..", e);
- } catch (TException e) {
- logger.error("Error occured while reading airavata-server properties..", e);
}
EventPublisher eventPub = new EventPublisher(statusPublisher, experimentPublisher);
this.applicationCatalogService =
@@ -182,6 +178,15 @@ public class AiravataServerHandler implements Airavata.Iface {
this(new RegistryServerHandler(), new SharingRegistryServerHandler(), new CredentialStoreServerHandler());
}
+ public void initialize() {
+ try {
+ initSharingRegistry();
+ postInitDefaultGateway();
+ } catch (Exception e) {
+ logger.error("Error during server initialization", e);
+ }
+ }
+
/**
* This method creates a password token for the default gateway profile. Default gateway is originally initialized
* at the registry server but we can not add the password token at that step as the credential store is not initialized