knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lmc...@apache.org
Subject knox git commit: KNOX-525 - fix service registry persistence for upgrades
Date Sat, 28 Mar 2015 18:49:50 GMT
Repository: knox
Updated Branches:
  refs/heads/master 32feae7fe -> bc716d92a


KNOX-525 - fix service registry persistence for upgrades

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

Branch: refs/heads/master
Commit: bc716d92a60469088b5b9b57da9004e46333af93
Parents: 32feae7
Author: Larry McCay <lmccay@hortonworks.com>
Authored: Sat Mar 28 14:50:04 2015 -0400
Committer: Larry McCay <lmccay@hortonworks.com>
Committed: Sat Mar 28 14:50:04 2015 -0400

----------------------------------------------------------------------
 .../registry/impl/DefaultServiceRegistryService.java     |  5 ++++-
 .../hadoop/gateway/services/registry/impl/RegEntry.java  | 11 +++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/bc716d92/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/DefaultServiceRegistryService.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/DefaultServiceRegistryService.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/DefaultServiceRegistryService.java
index 12d22ad..b446b3a 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/DefaultServiceRegistryService.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/DefaultServiceRegistryService.java
@@ -185,7 +185,10 @@ public class DefaultServiceRegistryService implements ServiceRegistry,
Service {
     if (registryFile.exists()) {
       try {
         String json = FileUtils.readFileToString(registryFile);
-        registry = (Registry) getMapFromJsonString(json);
+        Registry reg = (Registry) getMapFromJsonString(json);
+        if (reg != null) {
+          registry = reg;
+        }
       } catch (Exception e) {
         throw new ServiceLifecycleException("Unable to load the persisted registry.", e);
       }

http://git-wip-us.apache.org/repos/asf/knox/blob/bc716d92/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/RegEntry.java
----------------------------------------------------------------------
diff --git a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/RegEntry.java
b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/RegEntry.java
index 6d5c269..c8bef88 100644
--- a/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/RegEntry.java
+++ b/gateway-server/src/main/java/org/apache/hadoop/gateway/services/registry/impl/RegEntry.java
@@ -17,12 +17,14 @@
  */
 package org.apache.hadoop.gateway.services.registry.impl;
 
+import java.util.ArrayList;
 import java.util.List;
 
 public class RegEntry {
   public String clusterName;
   public String serviceName;
   public List<String> urls;
+  public String url;
 
   public RegEntry() {
   }
@@ -44,6 +46,10 @@ public class RegEntry {
   }
 
   public List<String> getUrls() {
+    if (urls == null && url != null) {
+      urls = new ArrayList<String>();
+      urls.add(url);
+    }
     return urls;
   }
 
@@ -51,4 +57,9 @@ public class RegEntry {
     this.urls = urls;
   }
 
+  public void setUrl( String url) {
+    ArrayList<String> urls = new ArrayList<String>();
+    urls.add(url);
+    this.urls = urls;
+  }
 }
\ No newline at end of file


Mime
View raw message