accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject [accumulo] 06/06: Revert "ACCUMULO-4779 fixed classpath context config performance issue (#358)"
Date Fri, 02 Feb 2018 18:25:16 GMT
This is an automated email from the ASF dual-hosted git repository.

kturner pushed a commit to branch 1.7
in repository https://gitbox.apache.org/repos/asf/accumulo.git

commit 7b123b6ea77c5ba09f1875dad0f0f421096e4f2b
Author: Keith Turner <kturner@apache.org>
AuthorDate: Fri Feb 2 12:15:44 2018 -0500

    Revert "ACCUMULO-4779 fixed classpath context config performance issue (#358)"
    
    This reverts commit 8c27bdf0e0168f854e9bb6effad25e6b6b0cb853.
---
 .../java/org/apache/accumulo/master/Master.java    |  8 ++---
 .../org/apache/accumulo/tserver/TabletServer.java  |  8 ++---
 .../main/java/org/apache/accumulo/shell/Shell.java | 18 ++++++-----
 .../start/classloader/vfs/ContextManager.java      | 36 ++++++++++++++--------
 4 files changed, 41 insertions(+), 29 deletions(-)

diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java
index 984fb60..6a43e93 100644
--- a/server/master/src/main/java/org/apache/accumulo/master/Master.java
+++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java
@@ -589,12 +589,12 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List
     this.tabletBalancer.init(serverConfig);
 
     try {
-      AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig()
{
+      AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig(new
Iterable<Entry<String,String>>() {
         @Override
-        public String getProperty(String key) {
-          return getConfiguration().get(key);
+        public Iterator<Entry<String,String>> iterator() {
+          return getConfiguration().iterator();
         }
-      });
+      }));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
diff --git a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
index 5240db6..4db28b5 100644
--- a/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
+++ b/server/tserver/src/main/java/org/apache/accumulo/tserver/TabletServer.java
@@ -2814,12 +2814,12 @@ public class TabletServer extends AccumuloServerContext implements
Runnable {
 
     clientAddress = HostAndPort.fromParts(hostname, 0);
     try {
-      AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig()
{
+      AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig(new
Iterable<Entry<String,String>>() {
         @Override
-        public String getProperty(String key) {
-          return getConfiguration().get(key);
+        public Iterator<Entry<String,String>> iterator() {
+          return getConfiguration().iterator();
         }
-      });
+      }));
     } catch (IOException e) {
       throw new RuntimeException(e);
     }
diff --git a/shell/src/main/java/org/apache/accumulo/shell/Shell.java b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
index b5e5afb..36c843e 100644
--- a/shell/src/main/java/org/apache/accumulo/shell/Shell.java
+++ b/shell/src/main/java/org/apache/accumulo/shell/Shell.java
@@ -545,16 +545,18 @@ public class Shell extends ShellOptions implements KeywordExecutable
{
       shellState.getConnector().instanceOperations().getSystemConfiguration().get(Property.VFS_CONTEXT_CLASSPATH_PROPERTY.getKey()
+ classpath);
 
       try {
-
-        final Map<String,String> systemConfig = shellState.getConnector().instanceOperations().getSystemConfiguration();
-
-        AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig()
{
+        AccumuloVFSClassLoader.getContextManager().setContextConfig(new ContextManager.DefaultContextsConfig(new
Iterable<Map.Entry<String,String>>() {
           @Override
-          public String getProperty(String key) {
-            return systemConfig.get(key);
+          public Iterator<Entry<String,String>> iterator() {
+            try {
+              return shellState.getConnector().instanceOperations().getSystemConfiguration().entrySet().iterator();
+            } catch (AccumuloException e) {
+              throw new RuntimeException(e);
+            } catch (AccumuloSecurityException e) {
+              throw new RuntimeException(e);
+            }
           }
-
-        });
+        }));
       } catch (IllegalStateException ise) {}
 
       classloader = AccumuloVFSClassLoader.getContextManager().getClassLoader(classpath);
diff --git a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
index a3d51fc..7145b4a 100644
--- a/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
+++ b/start/src/main/java/org/apache/accumulo/start/classloader/vfs/ContextManager.java
@@ -18,7 +18,9 @@ package org.apache.accumulo.start.classloader.vfs;
 
 import java.io.IOException;
 import java.util.HashMap;
+import java.util.Iterator;
 import java.util.Map;
+import java.util.Map.Entry;
 import java.util.Set;
 
 import org.apache.commons.vfs2.FileSystemException;
@@ -97,30 +99,38 @@ public class ContextManager {
     ContextConfig getContextConfig(String context);
   }
 
-  public static abstract class DefaultContextsConfig implements ContextsConfig {
+  public static class DefaultContextsConfig implements ContextsConfig {
 
-    public abstract String getProperty(String key);
+    private Iterable<Entry<String,String>> config;
+
+    public DefaultContextsConfig(Iterable<Entry<String,String>> config) {
+      this.config = config;
+    }
 
     @Override
     public ContextConfig getContextConfig(String context) {
 
       String key = AccumuloVFSClassLoader.VFS_CONTEXT_CLASSPATH_PROPERTY + context;
 
-      String uris = getProperty(key);
-
-      if (uris == null) {
-        return null;
-      }
-
-      String delegate = getProperty(key + ".delegation");
-
+      String uris = null;
       boolean preDelegate = true;
 
-      if (delegate != null && delegate.trim().equalsIgnoreCase("post")) {
-        preDelegate = false;
+      Iterator<Entry<String,String>> iter = config.iterator();
+      while (iter.hasNext()) {
+        Entry<String,String> entry = iter.next();
+        if (entry.getKey().equals(key)) {
+          uris = entry.getValue();
+        }
+
+        if (entry.getKey().equals(key + ".delegation") && entry.getValue().trim().equalsIgnoreCase("post"))
{
+          preDelegate = false;
+        }
       }
 
-      return new ContextConfig(uris, preDelegate);
+      if (uris != null)
+        return new ContextConfig(uris, preDelegate);
+
+      return null;
     }
   }
 

-- 
To stop receiving notification emails like this one, please contact
kturner@apache.org.

Mime
View raw message