accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From els...@apache.org
Subject [5/7] git commit: Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT
Date Sat, 04 Jan 2014 19:38:42 GMT
Merge branch '1.5.1-SNAPSHOT' into 1.6.0-SNAPSHOT

Conflicts:
	minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java


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

Branch: refs/heads/master
Commit: 4313ff8bbfd7e664914ff3ebbd45c4a1e58c0f9d
Parents: 764884e feccaa4
Author: Josh Elser <elserj@apache.org>
Authored: Sat Jan 4 14:25:15 2014 -0500
Committer: Josh Elser <elserj@apache.org>
Committed: Sat Jan 4 14:25:15 2014 -0500

----------------------------------------------------------------------
 .../java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/accumulo/blob/4313ff8b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
----------------------------------------------------------------------
diff --cc minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
index 2f8f433,d12c05a..6a8d24e
--- a/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
+++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/MiniAccumuloCluster.java
@@@ -128,137 -101,47 +128,137 @@@ public class MiniAccumuloCluster 
        } catch (IOException e) {}
      }
    }
 -  
 -  private File libDir;
 -  private File confDir;
 -  private File zooKeeperDir;
 -  private File accumuloDir;
 +
 +  private boolean initialized = false;
 +  private Process zooKeeperProcess = null;
 +  private Process masterProcess = null;
 +  private Process gcProcess = null;
 +  private List<Process> tabletServerProcesses = Collections.synchronizedList(new ArrayList<Process>());
 +
 +  private Set<Pair<ServerType,Integer>> debugPorts = new HashSet<Pair<ServerType,Integer>>();
 +
    private File zooCfgFile;
 -  private File logDir;
 -  private File walogDir;
 -  
 -  private Process zooKeeperProcess;
 -  private Process masterProcess;
 -  private Process gcProcess;
 -  
 -  private int zooKeeperPort;
 -  
 +  private String dfsUri;
 +
 +  public List<LogWriter> getLogWriters() {
 +    return logWriters;
 +  }
 +
    private List<LogWriter> logWriters = new ArrayList<MiniAccumuloCluster.LogWriter>();
 -  
 +
    private MiniAccumuloConfig config;
 -  private Process[] tabletServerProcesses;
 -  
 -  private Process exec(Class<? extends Object> clazz, String... args) throws IOException
{
 +  private MiniDFSCluster miniDFS = null;
 +  private List<Process> cleanup = new ArrayList<Process>();
 +
 +  public Process exec(Class<?> clazz, String... args) throws IOException {
 +    return exec(clazz, null, args);
 +  }
 +
 +  public Process exec(Class<?> clazz, List<String> jvmArgs, String... args)
throws IOException {
 +    ArrayList<String> jvmArgs2 = new ArrayList<String>(1 + (jvmArgs == null
? 0 : jvmArgs.size()));
 +    jvmArgs2.add("-Xmx" + config.getDefaultMemory());
 +    if (jvmArgs != null)
 +      jvmArgs2.addAll(jvmArgs);
 +    Process proc = _exec(clazz, jvmArgs2, args);
 +    cleanup.add(proc);
 +    return proc;
 +  }
 +
 +  private boolean containsSiteFile(File f) {
 +    return f.isDirectory() && f.listFiles(new FileFilter() {
 +
 +      @Override
 +      public boolean accept(File pathname) {
 +        return pathname.getName().endsWith("site.xml");
 +      }
 +    }).length > 0;
 +  }
 +
 +  private void append(StringBuilder classpathBuilder, URL url) throws URISyntaxException
{
 +    File file = new File(url.toURI());
 +    // do not include dirs containing hadoop or accumulo site files
 +    if (!containsSiteFile(file))
 +      classpathBuilder.append(File.pathSeparator).append(file.getAbsolutePath());
 +  }
 +
 +  private String getClasspath() throws IOException {
 +
 +    try {
 +      ArrayList<ClassLoader> classloaders = new ArrayList<ClassLoader>();
 +
 +      ClassLoader cl = this.getClass().getClassLoader();
 +
 +      while (cl != null) {
 +        classloaders.add(cl);
 +        cl = cl.getParent();
 +      }
 +
 +      Collections.reverse(classloaders);
 +
 +      StringBuilder classpathBuilder = new StringBuilder();
 +      classpathBuilder.append(config.getConfDir().getAbsolutePath());
 +
 +      if (config.getClasspathItems() == null) {
 +
 +        // assume 0 is the system classloader and skip it
 +        for (int i = 1; i < classloaders.size(); i++) {
 +          ClassLoader classLoader = classloaders.get(i);
 +
 +          if (classLoader instanceof URLClassLoader) {
 +
 +            URLClassLoader ucl = (URLClassLoader) classLoader;
 +
 +            for (URL u : ucl.getURLs()) {
 +              append(classpathBuilder, u);
 +            }
 +
 +          } else if (classLoader instanceof VFSClassLoader) {
 +
 +            VFSClassLoader vcl = (VFSClassLoader) classLoader;
 +            for (FileObject f : vcl.getFileObjects()) {
 +              append(classpathBuilder, f.getURL());
 +            }
 +          } else {
 +            throw new IllegalArgumentException("Unknown classloader type : " + classLoader.getClass().getName());
 +          }
 +        }
 +      } else {
 +        for (String s : config.getClasspathItems())
 +          classpathBuilder.append(File.pathSeparator).append(s);
 +      }
 +
 +      return classpathBuilder.toString();
 +
 +    } catch (URISyntaxException e) {
 +      throw new IOException(e);
 +    }
 +  }
 +
 +  private Process _exec(Class<?> clazz, List<String> extraJvmOpts, String...
args) throws IOException {
      String javaHome = System.getProperty("java.home");
      String javaBin = javaHome + File.separator + "bin" + File.separator + "java";
 -    String classpath = System.getProperty("java.class.path");
 -    
 -    classpath = confDir.getAbsolutePath() + File.pathSeparator + classpath;
 -    
 -    String className = clazz.getCanonicalName();
 -    
 +    String classpath = getClasspath();
 +
 +    String className = clazz.getName();
 +
      ArrayList<String> argList = new ArrayList<String>();
 -    
 -    argList.addAll(Arrays.asList(javaBin, "-cp", classpath, "-Xmx128m", "-XX:+UseConcMarkSweepGC",
"-XX:CMSInitiatingOccupancyFraction=75",
 -        "-Dapple.awt.UIElement=true", Main.class.getName(), className));
 -    
 +    argList.addAll(Arrays.asList(javaBin, "-Dproc=" + clazz.getSimpleName(), "-cp", classpath));
 +    argList.addAll(extraJvmOpts);
 +    for (Entry<String,String> sysProp : config.getSystemProperties().entrySet()) {
 +      argList.add(String.format("-D%s=%s", sysProp.getKey(), sysProp.getValue()));
 +    }
-     argList.addAll(Arrays.asList("-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75",
Main.class.getName(), className));
++    argList.addAll(Arrays.asList("-XX:+UseConcMarkSweepGC", "-XX:CMSInitiatingOccupancyFraction=75",
"-Dapple.awt.UIElement=true", Main.class.getName(), className));
      argList.addAll(Arrays.asList(args));
 -    
 +
      ProcessBuilder builder = new ProcessBuilder(argList);
 -    
 +
      builder.environment().put("ACCUMULO_HOME", config.getDir().getAbsolutePath());
 -    builder.environment().put("ACCUMULO_LOG_DIR", logDir.getAbsolutePath());
 -    
 +    builder.environment().put("ACCUMULO_LOG_DIR", config.getLogDir().getAbsolutePath());
 +    builder.environment().put("ACCUMULO_CLIENT_CONF_PATH", config.getClientConfFile().getAbsolutePath());
 +    String ldLibraryPath = StringUtil.join(Arrays.asList(config.getNativeLibPaths()), File.pathSeparator);
 +    builder.environment().put("LD_LIBRARY_PATH", ldLibraryPath);
 +    builder.environment().put("DYLD_LIBRARY_PATH", ldLibraryPath);
 +
      // if we're running under accumulo.start, we forward these env vars
      String env = System.getenv("HADOOP_PREFIX");
      if (env != null)


Mime
View raw message