airavata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From shame...@apache.org
Subject airavata git commit: configuration lazy loading
Date Wed, 08 Jul 2015 17:47:17 GMT
Repository: airavata
Updated Branches:
  refs/heads/master b7cee3e0b -> e060b47e8


configuration lazy loading


Project: http://git-wip-us.apache.org/repos/asf/airavata/repo
Commit: http://git-wip-us.apache.org/repos/asf/airavata/commit/e060b47e
Tree: http://git-wip-us.apache.org/repos/asf/airavata/tree/e060b47e
Diff: http://git-wip-us.apache.org/repos/asf/airavata/diff/e060b47e

Branch: refs/heads/master
Commit: e060b47e8ec25771b338646c0df0c36d38565246
Parents: b7cee3e
Author: Shameera Rathanyaka <shameerainfo@gmail.com>
Authored: Wed Jul 8 13:47:06 2015 -0400
Committer: Shameera Rathanyaka <shameerainfo@gmail.com>
Committed: Wed Jul 8 13:47:06 2015 -0400

----------------------------------------------------------------------
 .../main/java/org/apache/airavata/gfac/impl/Factory.java    | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/airavata/blob/e060b47e/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
----------------------------------------------------------------------
diff --git a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
index c2ce8dc..2b629bb 100644
--- a/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
+++ b/modules/gfac/gfac-impl/src/main/java/org/apache/airavata/gfac/impl/Factory.java
@@ -23,7 +23,6 @@ package org.apache.airavata.gfac.impl;
 import com.google.common.eventbus.EventBus;
 import org.apache.airavata.common.exception.AiravataException;
 import org.apache.airavata.common.exception.ApplicationSettingsException;
-import org.apache.airavata.common.utils.ApplicationSettings;
 import org.apache.airavata.common.utils.LocalEventPublisher;
 import org.apache.airavata.common.utils.ServerSettings;
 import org.apache.airavata.gfac.core.GFacEngine;
@@ -85,6 +84,7 @@ public abstract class Factory {
 	private static Map<JobSubmissionProtocol, JobSubmissionTask> jobSubmissionTask = new
HashMap<>();
 	private static Map<DataMovementProtocol, Task> dataMovementTask = new HashMap<>();
 	private static Map<ResourceJobManagerType, ResourceConfig> resources = new HashMap<>();
+	private static boolean readConfig = false;
 
 	public static GFacEngine getGFacEngine() throws GFacException {
 		if (engine == null) {
@@ -236,14 +236,14 @@ public abstract class Factory {
 
 	public static JobSubmissionTask getJobSubmissionTask(JobSubmissionProtocol jobSubmissionProtocol)
throws
 			GFacException {
-		if (jobSubmissionTask == null) {
+		if (!readConfig) {
 			loadConfiguration();
 		}
 		return jobSubmissionTask.get(jobSubmissionProtocol);
 	}
 
 	public static Task getDataMovementTask(DataMovementProtocol dataMovementProtocol) throws
GFacException {
-		if (dataMovementTask == null) {
+		if (!readConfig) {
 			loadConfiguration();
 		}
 		return dataMovementTask.get(dataMovementProtocol);
@@ -251,7 +251,7 @@ public abstract class Factory {
 
 	public static ResourceConfig getResourceConfig(ResourceJobManagerType resourceJobManagerType)
throws
 			GFacException {
-		if (resources == null) {
+		if (!readConfig) {
 			loadConfiguration();
 		}
 		return resources.get(resourceJobManagerType);
@@ -270,6 +270,7 @@ public abstract class Factory {
 		for (ResourceConfig resourceConfig : config.getResourceConfiguration()) {
 			resources.put(resourceConfig.getJobManagerType(), resourceConfig);
 		}
+		readConfig = true;
 	}
 
 


Mime
View raw message