You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@falcon.apache.org by sh...@apache.org on 2014/04/16 15:35:02 UTC

git commit: FALCON-352 old properties not removed on refresh of runtime properties. Contributed by Shaik Idris Ali

Repository: incubator-falcon
Updated Branches:
  refs/heads/master f7284f8b0 -> 0e81412b0


FALCON-352 old properties not removed on refresh of runtime properties. Contributed by Shaik Idris Ali


Project: http://git-wip-us.apache.org/repos/asf/incubator-falcon/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-falcon/commit/0e81412b
Tree: http://git-wip-us.apache.org/repos/asf/incubator-falcon/tree/0e81412b
Diff: http://git-wip-us.apache.org/repos/asf/incubator-falcon/diff/0e81412b

Branch: refs/heads/master
Commit: 0e81412b091f078a28dabd703e8b67130acbcf21
Parents: f7284f8
Author: Shwetha GS <sh...@gmail.com>
Authored: Wed Apr 16 19:00:35 2014 +0530
Committer: Shwetha GS <sh...@gmail.com>
Committed: Wed Apr 16 19:00:35 2014 +0530

----------------------------------------------------------------------
 .../apache/falcon/util/RuntimeProperties.java   | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-falcon/blob/0e81412b/common/src/main/java/org/apache/falcon/util/RuntimeProperties.java
----------------------------------------------------------------------
diff --git a/common/src/main/java/org/apache/falcon/util/RuntimeProperties.java b/common/src/main/java/org/apache/falcon/util/RuntimeProperties.java
index 6270406..6ec2f70 100644
--- a/common/src/main/java/org/apache/falcon/util/RuntimeProperties.java
+++ b/common/src/main/java/org/apache/falcon/util/RuntimeProperties.java
@@ -38,8 +38,6 @@ public final class RuntimeProperties extends ApplicationProperties {
 
     private RuntimeProperties() throws FalconException {
         super();
-        Thread refreshThread = new Thread(new DynamicLoader(this));
-        refreshThread.start();
     }
 
     @Override
@@ -50,7 +48,13 @@ public final class RuntimeProperties extends ApplicationProperties {
     public static Properties get() {
         try {
             if (INSTANCE.get() == null) {
-                INSTANCE.compareAndSet(null, new RuntimeProperties());
+                RuntimeProperties properties = new RuntimeProperties();
+                properties.loadProperties();
+                INSTANCE.compareAndSet(null, properties);
+                if (INSTANCE.get() == properties) {
+                    Thread refreshThread = new Thread(new DynamicLoader());
+                    refreshThread.start();
+                }
             }
             return INSTANCE.get();
         } catch (FalconException e) {
@@ -65,11 +69,6 @@ public final class RuntimeProperties extends ApplicationProperties {
 
         private static final long REFRESH_DELAY = 300000L;
         private static final int MAX_ITER = 20;  //1hr
-        private final ApplicationProperties applicationProperties;
-
-        private DynamicLoader(ApplicationProperties applicationProperties) {
-            this.applicationProperties = applicationProperties;
-        }
 
         @Override
         public void run() {
@@ -77,8 +76,9 @@ public final class RuntimeProperties extends ApplicationProperties {
             while (true) {
                 try {
                     try {
-                        applicationProperties.clear();
-                        applicationProperties.loadProperties();
+                        RuntimeProperties newProperties = new RuntimeProperties();
+                        newProperties.loadProperties();
+                        INSTANCE.set(newProperties);
                         backOffDelay = REFRESH_DELAY;
                     } catch (FalconException e) {
                         LOG.warn("Error refreshing runtime properties", e);