This is an automated email from the ASF dual-hosted git repository. dimuthuupe pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/develop by this push: new c86a4ea Refactoring PreWorkflowManager c86a4ea is described below commit c86a4ea911f2350a09ecf6dab65730d3e5c882a1 Author: dimuthu <dimuthu.upeks...@gmail.com> AuthorDate: Wed Apr 4 14:10:39 2018 -0400 Refactoring PreWorkflowManager --- .../helix/impl/workflow/PreWorkflowManager.java | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java index 6733b42..4cef145 100644 --- a/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java +++ b/modules/airavata-helix/helix-spectator/src/main/java/org/apache/airavata/helix/impl/workflow/PreWorkflowManager.java @@ -66,22 +66,31 @@ public class PreWorkflowManager { private CuratorFramework curatorClient = null; private WorkflowManager workflowManager; - @SuppressWarnings("WeakerAccess") - public PreWorkflowManager() throws Exception { - init(); + private void initAllComponents() throws Exception { + initWorkflowManager(); + initLaunchSubscriber(); + initStatusPublisher(); + initCuratorClient(); } - private void init() throws Exception { - + private void initWorkflowManager() throws Exception { workflowManager = new WorkflowManager( ServerSettings.getSetting("helix.cluster.name"), ServerSettings.getSetting("pre.workflow.manager.name"), ServerSettings.getZookeeperConnection()); + } + + private void initStatusPublisher() throws AiravataException { + this.statusPublisher = MessagingFactory.getPublisher(Type.STATUS); + } + private void initLaunchSubscriber() throws AiravataException { List<String> routingKeys = new ArrayList<>(); routingKeys.add(ServerSettings.getRabbitmqProcessExchangeName()); this.subscriber = MessagingFactory.getSubscriber(new ProcessLaunchMessageHandler(), routingKeys, Type.PROCESS_LAUNCH); - this.statusPublisher = MessagingFactory.getPublisher(Type.STATUS); + } + + private void initCuratorClient() throws Exception { RetryPolicy retryPolicy = new ExponentialBackoffRetry(1000, 3); this.curatorClient = CuratorFrameworkFactory.newClient(ServerSettings.getZookeeperConnection(), retryPolicy); this.curatorClient.start(); @@ -225,6 +234,7 @@ public class PreWorkflowManager { public static void main(String[] args) throws Exception { PreWorkflowManager preWorkflowManager = new PreWorkflowManager(); + preWorkflowManager.initAllComponents(); } private class ProcessLaunchMessageHandler implements MessageHandler { -- To stop receiving notification emails like this one, please contact dimuthu...@apache.org.