knox-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From m...@apache.org
Subject knox git commit: KNOX-1054 - Make DefaultURLManager thread-safe (Phil Zampino via Sandeep More)
Date Thu, 21 Sep 2017 01:47:43 GMT
Repository: knox
Updated Branches:
  refs/heads/master 2666894bc -> d3f507f94


KNOX-1054 - Make DefaultURLManager thread-safe (Phil Zampino via Sandeep More)


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

Branch: refs/heads/master
Commit: d3f507f9424b7deb355696c1c6d5f5aad142157d
Parents: 2666894
Author: Sandeep More <more@apache.org>
Authored: Wed Sep 20 21:47:35 2017 -0400
Committer: Sandeep More <more@apache.org>
Committed: Wed Sep 20 21:47:35 2017 -0400

----------------------------------------------------------------------
 .../hadoop/gateway/ha/provider/impl/DefaultURLManager.java  | 9 +++------
 1 file changed, 3 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/knox/blob/d3f507f9/gateway-provider-ha/src/main/java/org/apache/hadoop/gateway/ha/provider/impl/DefaultURLManager.java
----------------------------------------------------------------------
diff --git a/gateway-provider-ha/src/main/java/org/apache/hadoop/gateway/ha/provider/impl/DefaultURLManager.java
b/gateway-provider-ha/src/main/java/org/apache/hadoop/gateway/ha/provider/impl/DefaultURLManager.java
index 484a580..e76be7d 100644
--- a/gateway-provider-ha/src/main/java/org/apache/hadoop/gateway/ha/provider/impl/DefaultURLManager.java
+++ b/gateway-provider-ha/src/main/java/org/apache/hadoop/gateway/ha/provider/impl/DefaultURLManager.java
@@ -24,7 +24,6 @@ import org.apache.hadoop.gateway.ha.provider.impl.i18n.HaMessages;
 import org.apache.hadoop.gateway.i18n.messages.MessagesFactory;
 
 import java.net.URI;
-import java.util.Iterator;
 import java.util.List;
 import java.util.concurrent.ConcurrentLinkedQueue;
 
@@ -34,8 +33,6 @@ public class DefaultURLManager implements URLManager {
 
   private ConcurrentLinkedQueue<String> urls = new ConcurrentLinkedQueue<>();
 
-  public DefaultURLManager() {
-  }
 
   @Override
   public boolean supportsConfig(HaServiceConfig config) {
@@ -48,7 +45,7 @@ public class DefaultURLManager implements URLManager {
   }
 
   @Override
-  public String getActiveURL() {
+  public synchronized String getActiveURL() {
     return urls.peek();
   }
 
@@ -68,13 +65,13 @@ public class DefaultURLManager implements URLManager {
   }
 
   @Override
-  public List<String> getURLs() {
+  public synchronized List<String> getURLs() {
     return Lists.newArrayList(urls.iterator());
   }
 
   @Override
   public synchronized void setURLs(List<String> urls) {
-    if ( urls != null && !urls.isEmpty()) {
+    if (urls != null && !urls.isEmpty()) {
       this.urls.clear();
       this.urls.addAll(urls);
     }


Mime
View raw message