You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucene.apache.org by da...@apache.org on 2018/10/23 00:06:10 UTC

[49/52] [abbrv] [partial] lucene-solr:jira/gradle: Add gradle support for Solr

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
deleted file mode 100644
index 81cf374..0000000
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/EmbeddedSolrServer.java
+++ /dev/null
@@ -1,322 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.client.solrj.embedded;
-
-import java.io.ByteArrayInputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.nio.file.Path;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashSet;
-import java.util.Set;
-
-import com.google.common.base.Strings;
-import org.apache.commons.io.output.ByteArrayOutputStream;
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.SolrRequest;
-import org.apache.solr.client.solrj.SolrServerException;
-import org.apache.solr.client.solrj.StreamingResponseCallback;
-import org.apache.solr.client.solrj.impl.BinaryRequestWriter;
-import org.apache.solr.client.solrj.impl.BinaryRequestWriter.BAOS;
-import org.apache.solr.client.solrj.request.ContentStreamUpdateRequest;
-import org.apache.solr.client.solrj.request.RequestWriter;
-import org.apache.solr.common.SolrDocument;
-import org.apache.solr.common.SolrDocumentList;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.params.CommonParams;
-import org.apache.solr.common.params.ModifiableSolrParams;
-import org.apache.solr.common.params.SolrParams;
-import org.apache.solr.common.util.ContentStream;
-import org.apache.solr.common.util.ContentStreamBase;
-import org.apache.solr.common.util.JavaBinCodec;
-import org.apache.solr.common.util.NamedList;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.NodeConfig;
-import org.apache.solr.core.SolrCore;
-import org.apache.solr.core.SolrXmlConfig;
-import org.apache.solr.request.SolrQueryRequest;
-import org.apache.solr.request.SolrRequestHandler;
-import org.apache.solr.request.SolrRequestInfo;
-import org.apache.solr.response.BinaryResponseWriter;
-import org.apache.solr.response.ResultContext;
-import org.apache.solr.response.SolrQueryResponse;
-import org.apache.solr.servlet.SolrRequestParsers;
-
-import static org.apache.solr.common.params.CommonParams.PATH;
-
-/**
- * SolrClient that connects directly to a CoreContainer.
- *
- * @since solr 1.3
- */
-public class EmbeddedSolrServer extends SolrClient {
-
-  protected final CoreContainer coreContainer;
-  protected final String coreName;
-  private final SolrRequestParsers _parser;
-
-  /**
-   * Create an EmbeddedSolrServer using a given solr home directory
-   *
-   * @param solrHome        the solr home directory
-   * @param defaultCoreName the core to route requests to by default
-   */
-  public EmbeddedSolrServer(Path solrHome, String defaultCoreName) {
-    this(load(new CoreContainer(SolrXmlConfig.fromSolrHome(solrHome))), defaultCoreName);
-  }
-
-  /**
-   * Create an EmbeddedSolrServer using a NodeConfig
-   *
-   * @param nodeConfig      the configuration
-   * @param defaultCoreName the core to route requests to by default
-   */
-  public EmbeddedSolrServer(NodeConfig nodeConfig, String defaultCoreName) {
-    this(load(new CoreContainer(nodeConfig)), defaultCoreName);
-  }
-
-  private static CoreContainer load(CoreContainer cc) {
-    cc.load();
-    return cc;
-  }
-
-  /**
-   * Create an EmbeddedSolrServer wrapping a particular SolrCore
-   */
-  public EmbeddedSolrServer(SolrCore core) {
-    this(core.getCoreContainer(), core.getName());
-  }
-
-  /**
-   * Create an EmbeddedSolrServer wrapping a CoreContainer.
-   * <p>
-   * Note that EmbeddedSolrServer will shutdown the wrapped CoreContainer when
-   * {@link #close()} is called.
-   *
-   * @param coreContainer the core container
-   * @param coreName      the core to route requests to by default
-   */
-  public EmbeddedSolrServer(CoreContainer coreContainer, String coreName) {
-    if (coreContainer == null) {
-      throw new NullPointerException("CoreContainer instance required");
-    }
-    if (Strings.isNullOrEmpty(coreName))
-      throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "Core name cannot be empty");
-    this.coreContainer = coreContainer;
-    this.coreName = coreName;
-    _parser = new SolrRequestParsers(null);
-  }
-
-  // TODO-- this implementation sends the response to XML and then parses it.
-  // It *should* be able to convert the response directly into a named list.
-
-  @Override
-  public NamedList<Object> request(SolrRequest request, String coreName) throws SolrServerException, IOException {
-
-    String path = request.getPath();
-    if (path == null || !path.startsWith("/")) {
-      path = "/select";
-    }
-
-    SolrRequestHandler handler = coreContainer.getRequestHandler(path);
-    if (handler != null) {
-      try {
-        SolrQueryRequest req = _parser.buildRequestFrom(null, request.getParams(), getContentStreams(request));
-        req.getContext().put("httpMethod", request.getMethod().name());
-        req.getContext().put(PATH, path);
-        SolrQueryResponse resp = new SolrQueryResponse();
-        handler.handleRequest(req, resp);
-        checkForExceptions(resp);
-        return BinaryResponseWriter.getParsedResponse(req, resp);
-      } catch (IOException | SolrException iox) {
-        throw iox;
-      } catch (Exception ex) {
-        throw new SolrServerException(ex);
-      }
-    }
-
-    if (coreName == null)
-      coreName = this.coreName;
-
-    // Check for cores action
-    SolrQueryRequest req = null;
-    try (SolrCore core = coreContainer.getCore(coreName)) {
-
-      if (core == null) {
-        throw new SolrException(SolrException.ErrorCode.SERVER_ERROR, "No such core: " + coreName);
-      }
-
-      SolrParams params = request.getParams();
-      if (params == null) {
-        params = new ModifiableSolrParams();
-      }
-
-      // Extract the handler from the path or params
-      handler = core.getRequestHandler(path);
-      if (handler == null) {
-        if ("/select".equals(path) || "/select/".equalsIgnoreCase(path)) {
-          String qt = params.get(CommonParams.QT);
-          handler = core.getRequestHandler(qt);
-          if (handler == null) {
-            throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "unknown handler: " + qt);
-          }
-        }
-      }
-
-      if (handler == null) {
-        throw new SolrException(SolrException.ErrorCode.BAD_REQUEST, "unknown handler: " + path);
-      }
-
-      req = _parser.buildRequestFrom(core, params, getContentStreams(request));
-      req.getContext().put(PATH, path);
-      req.getContext().put("httpMethod", request.getMethod().name());
-      SolrQueryResponse rsp = new SolrQueryResponse();
-      SolrRequestInfo.setRequestInfo(new SolrRequestInfo(req, rsp));
-
-      core.execute(handler, req, rsp);
-      checkForExceptions(rsp);
-
-      // Check if this should stream results
-      if (request.getStreamingResponseCallback() != null) {
-        try {
-          final StreamingResponseCallback callback = request.getStreamingResponseCallback();
-          BinaryResponseWriter.Resolver resolver =
-              new BinaryResponseWriter.Resolver(req, rsp.getReturnFields()) {
-                @Override
-                public void writeResults(ResultContext ctx, JavaBinCodec codec) throws IOException {
-                  // write an empty list...
-                  SolrDocumentList docs = new SolrDocumentList();
-                  docs.setNumFound(ctx.getDocList().matches());
-                  docs.setStart(ctx.getDocList().offset());
-                  docs.setMaxScore(ctx.getDocList().maxScore());
-                  codec.writeSolrDocumentList(docs);
-
-                  // This will transform
-                  writeResultsBody(ctx, codec);
-                }
-              };
-
-
-          try (ByteArrayOutputStream out = new ByteArrayOutputStream()) {
-            createJavaBinCodec(callback, resolver).setWritableDocFields(resolver).marshal(rsp.getValues(), out);
-
-            try (InputStream in = out.toInputStream()) {
-              return (NamedList<Object>) new JavaBinCodec(resolver).unmarshal(in);
-            }
-          }
-        } catch (Exception ex) {
-          throw new RuntimeException(ex);
-        }
-      }
-
-      // Now write it out
-      NamedList<Object> normalized = BinaryResponseWriter.getParsedResponse(req, rsp);
-      return normalized;
-    } catch (IOException | SolrException iox) {
-      throw iox;
-    } catch (Exception ex) {
-      throw new SolrServerException(ex);
-    } finally {
-      if (req != null) req.close();
-      SolrRequestInfo.clearRequestInfo();
-    }
-  }
-
-  private Set<ContentStream> getContentStreams(SolrRequest request) throws IOException {
-    if (request.getMethod() == SolrRequest.METHOD.GET) return null;
-    if (request instanceof ContentStreamUpdateRequest) {
-      ContentStreamUpdateRequest csur = (ContentStreamUpdateRequest) request;
-      Collection<ContentStream> cs = csur.getContentStreams();
-      if (cs != null) return new HashSet<>(cs);
-    }
-    RequestWriter.ContentWriter contentWriter = request.getContentWriter(CommonParams.JAVABIN_MIME);
-    final String cType = contentWriter == null ? CommonParams.JAVABIN_MIME : contentWriter.getContentType();
-
-    return Collections.singleton(new ContentStreamBase() {
-
-      @Override
-      public InputStream getStream() throws IOException {
-        BAOS baos = new BAOS();
-        if (contentWriter != null) {
-          contentWriter.write(baos);
-        } else {
-          new BinaryRequestWriter().write(request, baos);
-        }
-        return new ByteArrayInputStream(baos.toByteArray());
-      }
-
-      @Override
-      public String getContentType() {
-        return cType;
-
-      }
-    });
-  }
-
-  private JavaBinCodec createJavaBinCodec(final StreamingResponseCallback callback, final BinaryResponseWriter.Resolver resolver) {
-    return new JavaBinCodec(resolver) {
-
-      @Override
-      public void writeSolrDocument(SolrDocument doc) {
-        callback.streamSolrDocument(doc);
-        //super.writeSolrDocument( doc, fields );
-      }
-
-      @Override
-      public void writeSolrDocumentList(SolrDocumentList docs) throws IOException {
-        if (docs.size() > 0) {
-          SolrDocumentList tmp = new SolrDocumentList();
-          tmp.setMaxScore(docs.getMaxScore());
-          tmp.setNumFound(docs.getNumFound());
-          tmp.setStart(docs.getStart());
-          docs = tmp;
-        }
-        callback.streamDocListInfo(docs.getNumFound(), docs.getStart(), docs.getMaxScore());
-        super.writeSolrDocumentList(docs);
-      }
-
-    };
-  }
-
-  private static void checkForExceptions(SolrQueryResponse rsp) throws Exception {
-    if (rsp.getException() != null) {
-      if (rsp.getException() instanceof SolrException) {
-        throw rsp.getException();
-      }
-      throw new SolrServerException(rsp.getException());
-    }
-
-  }
-
-  /**
-   * Shutdown all cores within the EmbeddedSolrServer instance
-   */
-  @Override
-  public void close() throws IOException {
-    coreContainer.shutdown();
-  }
-
-  /**
-   * Getter method for the CoreContainer
-   *
-   * @return the core container
-   */
-  public CoreContainer getCoreContainer() {
-    return coreContainer;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettyConfig.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettyConfig.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettyConfig.java
deleted file mode 100644
index 28c3cdf..0000000
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettyConfig.java
+++ /dev/null
@@ -1,131 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.client.solrj.embedded;
-
-import org.eclipse.jetty.servlet.ServletHolder;
-
-import javax.servlet.Filter;
-import java.util.LinkedHashMap;
-import java.util.Map;
-import java.util.TreeMap;
-
-public class JettyConfig {
-
-  public final int port;
-
-  public final String context;
-
-  public final boolean stopAtShutdown;
-  
-  public final Long waitForLoadingCoresToFinishMs;
-
-  public final Map<ServletHolder, String> extraServlets;
-
-  public final Map<Class<? extends Filter>, String> extraFilters;
-
-  public final SSLConfig sslConfig;
-
-  private JettyConfig(int port, String context, boolean stopAtShutdown, Long waitForLoadingCoresToFinishMs, Map<ServletHolder, String> extraServlets,
-                      Map<Class<? extends Filter>, String> extraFilters, SSLConfig sslConfig) {
-    this.port = port;
-    this.context = context;
-    this.stopAtShutdown = stopAtShutdown;
-    this.waitForLoadingCoresToFinishMs = waitForLoadingCoresToFinishMs;
-    this.extraServlets = extraServlets;
-    this.extraFilters = extraFilters;
-    this.sslConfig = sslConfig;
-  }
-
-  public static Builder builder() {
-    return new Builder();
-  }
-
-  public static Builder builder(JettyConfig other) {
-    Builder builder = new Builder();
-    builder.port = other.port;
-    builder.context = other.context;
-    builder.stopAtShutdown = other.stopAtShutdown;
-    builder.extraServlets = other.extraServlets;
-    builder.extraFilters = other.extraFilters;
-    builder.sslConfig = other.sslConfig;
-    return builder;
-  }
-
-  public static class Builder {
-
-    int port = 0;
-    String context = "/solr";
-    boolean stopAtShutdown = true;
-    Long waitForLoadingCoresToFinishMs = 300000L;
-    Map<ServletHolder, String> extraServlets = new TreeMap<>();
-    Map<Class<? extends Filter>, String> extraFilters = new LinkedHashMap<>();
-    SSLConfig sslConfig = null;
-
-    public Builder setPort(int port) {
-      this.port = port;
-      return this;
-    }
-
-    public Builder setContext(String context) {
-      this.context = context;
-      return this;
-    }
-
-    public Builder stopAtShutdown(boolean stopAtShutdown) {
-      this.stopAtShutdown = stopAtShutdown;
-      return this;
-    }
-    
-    public Builder waitForLoadingCoresToFinish(Long waitForLoadingCoresToFinishMs) {
-      this.waitForLoadingCoresToFinishMs = waitForLoadingCoresToFinishMs;
-      return this;
-    }
-
-    public Builder withServlet(ServletHolder servlet, String pathSpec) {
-      extraServlets.put(servlet, pathSpec);
-      return this;
-    }
-
-    public Builder withServlets(Map<ServletHolder, String> servlets) {
-      if (servlets != null)
-        extraServlets.putAll(servlets);
-      return this;
-    }
-
-    public Builder withFilter(Class<? extends Filter> filterClass, String pathSpec) {
-      extraFilters.put(filterClass, pathSpec);
-      return this;
-    }
-
-    public Builder withFilters(Map<Class<? extends Filter>, String> filters) {
-      if (filters != null)
-        extraFilters.putAll(filters);
-      return this;
-    }
-
-    public Builder withSSLConfig(SSLConfig sslConfig) {
-      this.sslConfig = sslConfig;
-      return this;
-    }
-
-    public JettyConfig build() {
-      return new JettyConfig(port, context, stopAtShutdown, waitForLoadingCoresToFinishMs, extraServlets, extraFilters, sslConfig);
-    }
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
deleted file mode 100644
index 5fdec0f..0000000
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/JettySolrRunner.java
+++ /dev/null
@@ -1,586 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.client.solrj.embedded;
-
-import javax.servlet.DispatcherType;
-import javax.servlet.Filter;
-import javax.servlet.FilterChain;
-import javax.servlet.FilterConfig;
-import javax.servlet.ServletException;
-import javax.servlet.ServletRequest;
-import javax.servlet.ServletResponse;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.net.MalformedURLException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.EnumSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Random;
-import java.util.concurrent.TimeUnit;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.solr.client.solrj.SolrClient;
-import org.apache.solr.client.solrj.impl.HttpSolrClient;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.servlet.SolrDispatchFilter;
-import org.eclipse.jetty.server.Connector;
-import org.eclipse.jetty.server.HttpConfiguration;
-import org.eclipse.jetty.server.HttpConnectionFactory;
-import org.eclipse.jetty.server.SecureRequestCustomizer;
-import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.ServerConnector;
-import org.eclipse.jetty.server.SslConnectionFactory;
-import org.eclipse.jetty.server.handler.gzip.GzipHandler;
-import org.eclipse.jetty.server.session.DefaultSessionIdManager;
-import org.eclipse.jetty.servlet.FilterHolder;
-import org.eclipse.jetty.servlet.ServletContextHandler;
-import org.eclipse.jetty.servlet.ServletHolder;
-import org.eclipse.jetty.servlet.Source;
-import org.eclipse.jetty.util.component.LifeCycle;
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-import org.eclipse.jetty.util.thread.QueuedThreadPool;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.slf4j.MDC;
-
-/**
- * Run solr using jetty
- * 
- * @since solr 1.3
- */
-public class JettySolrRunner {
-
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-  private static final int THREAD_POOL_MAX_THREADS = 10000;
-  // NOTE: needs to be larger than SolrHttpClient.threadPoolSweeperMaxIdleTime
-  private static final int THREAD_POOL_MAX_IDLE_TIME_MS = 120000;
-  
-  Server server;
-
-  FilterHolder dispatchFilter;
-  FilterHolder debugFilter;
-
-  private boolean waitOnSolr = false;
-  private int jettyPort = -1;
-
-  private final JettyConfig config;
-  private final String solrHome;
-  private final Properties nodeProperties;
-
-  private volatile boolean startedBefore = false;
-
-  private LinkedList<FilterHolder> extraFilters;
-
-  private static final String excludePatterns = "/css/.+,/js/.+,/img/.+,/tpl/.+";
-
-  private int proxyPort = -1;
-
-  public static class DebugFilter implements Filter {
-    private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-    private AtomicLong nRequests = new AtomicLong();
-    
-    List<Delay> delays = new ArrayList<>();
-
-    public long getTotalRequests() {
-      return nRequests.get();
-
-    }
-    
-    /**
-     * Introduce a delay of specified milliseconds for the specified request.
-     *
-     * @param reason Info message logged when delay occurs
-     * @param count The count-th request will experience a delay
-     * @param delay There will be a delay of this many milliseconds
-     */
-    public void addDelay(String reason, int count, int delay) {
-      delays.add(new Delay(reason, count, delay));
-    }
-    
-    /**
-     * Remove any delay introduced before.
-     */
-    public void unsetDelay() {
-      delays.clear();
-    }
-
-
-    @Override
-    public void init(FilterConfig filterConfig) throws ServletException { }
-
-    @Override
-    public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
-      nRequests.incrementAndGet();
-      executeDelay();
-      filterChain.doFilter(servletRequest, servletResponse);
-    }
-
-    @Override
-    public void destroy() { }
-    
-    private void executeDelay() {
-      int delayMs = 0;
-      for (Delay delay: delays) {
-        this.log.info("Delaying "+delay.delayValue+", for reason: "+delay.reason);
-        if (delay.counter.decrementAndGet() == 0) {
-          delayMs += delay.delayValue;
-        }        
-      }
-
-      if (delayMs > 0) {
-        this.log.info("Pausing this socket connection for " + delayMs + "ms...");
-        try {
-          Thread.sleep(delayMs);
-        } catch (InterruptedException e) {
-          throw new RuntimeException(e);
-        }
-        this.log.info("Waking up after the delay of " + delayMs + "ms...");
-      }
-    }
-
-  }
-
-  /**
-   * Create a new JettySolrRunner.
-   *
-   * After construction, you must start the jetty with {@link #start()}
-   *
-   * @param solrHome the solr home directory to use
-   * @param context the context to run in
-   * @param port the port to run on
-   */
-  public JettySolrRunner(String solrHome, String context, int port) {
-    this(solrHome, JettyConfig.builder().setContext(context).setPort(port).build());
-  }
-
-
-  /**
-   * Construct a JettySolrRunner
-   *
-   * After construction, you must start the jetty with {@link #start()}
-   *
-   * @param solrHome    the base path to run from
-   * @param config the configuration
-   */
-  public JettySolrRunner(String solrHome, JettyConfig config) {
-    this(solrHome, new Properties(), config);
-  }
-
-  /**
-   * Construct a JettySolrRunner
-   *
-   * After construction, you must start the jetty with {@link #start()}
-   *
-   * @param solrHome            the solrHome to use
-   * @param nodeProperties      the container properties
-   * @param config         the configuration
-   */
-  public JettySolrRunner(String solrHome, Properties nodeProperties, JettyConfig config) {
-
-    this.solrHome = solrHome;
-    this.config = config;
-    this.nodeProperties = nodeProperties;
-
-    this.init(this.config.port);
-  }
-  
-  private void init(int port) {
-
-    QueuedThreadPool qtp = new QueuedThreadPool();
-    qtp.setMaxThreads(THREAD_POOL_MAX_THREADS);
-    qtp.setIdleTimeout(THREAD_POOL_MAX_IDLE_TIME_MS);
-    qtp.setStopTimeout((int) TimeUnit.MINUTES.toMillis(1));
-    server = new Server(qtp);
-    server.manage(qtp);
-    server.setStopAtShutdown(config.stopAtShutdown);
-
-    if (System.getProperty("jetty.testMode") != null) {
-      // if this property is true, then jetty will be configured to use SSL
-      // leveraging the same system properties as java to specify
-      // the keystore/truststore if they are set unless specific config
-      // is passed via the constructor.
-      //
-      // This means we will use the same truststore, keystore (and keys) for
-      // the server as well as any client actions taken by this JVM in
-      // talking to that server, but for the purposes of testing that should 
-      // be good enough
-      final SslContextFactory sslcontext = SSLConfig.createContextFactory(config.sslConfig);
-      
-      ServerConnector connector;
-      if (sslcontext != null) {
-        HttpConfiguration configuration = new HttpConfiguration();
-        configuration.setSecureScheme("https");
-        configuration.addCustomizer(new SecureRequestCustomizer());
-        connector = new ServerConnector(server, new SslConnectionFactory(sslcontext, "http/1.1"),
-            new HttpConnectionFactory(configuration));
-      } else {
-        connector = new ServerConnector(server, new HttpConnectionFactory());
-      }
-
-      connector.setReuseAddress(true);
-      connector.setSoLingerTime(-1);
-      connector.setPort(port);
-      connector.setHost("127.0.0.1");
-      connector.setIdleTimeout(THREAD_POOL_MAX_IDLE_TIME_MS);
-      
-      server.setConnectors(new Connector[] {connector});
-      server.setSessionIdManager(new DefaultSessionIdManager(server, new Random()));
-    } else {
-      ServerConnector connector = new ServerConnector(server, new HttpConnectionFactory());
-      connector.setPort(port);
-      connector.setSoLingerTime(-1);
-      connector.setIdleTimeout(THREAD_POOL_MAX_IDLE_TIME_MS);
-      server.setConnectors(new Connector[] {connector});
-    }
-
-    // Initialize the servlets
-    final ServletContextHandler root = new ServletContextHandler(server, config.context, ServletContextHandler.SESSIONS);
-
-    server.addLifeCycleListener(new LifeCycle.Listener() {
-
-      @Override
-      public void lifeCycleStopping(LifeCycle arg0) {
-      }
-
-      @Override
-      public void lifeCycleStopped(LifeCycle arg0) {}
-
-      @Override
-      public void lifeCycleStarting(LifeCycle arg0) {
-        synchronized (JettySolrRunner.this) {
-          waitOnSolr = true;
-          JettySolrRunner.this.notify();
-        }
-      }
-
-      @Override
-      public void lifeCycleStarted(LifeCycle arg0) {
-
-        jettyPort = getFirstConnectorPort();
-        int port = jettyPort;
-        if (proxyPort != -1) port = proxyPort;
-        nodeProperties.setProperty("hostPort", Integer.toString(port));
-        nodeProperties.setProperty("hostContext", config.context);
-
-        root.getServletContext().setAttribute(SolrDispatchFilter.PROPERTIES_ATTRIBUTE, nodeProperties);
-        root.getServletContext().setAttribute(SolrDispatchFilter.SOLRHOME_ATTRIBUTE, solrHome);
-
-        log.info("Jetty properties: {}", nodeProperties);
-
-        debugFilter = root.addFilter(DebugFilter.class, "*", EnumSet.of(DispatcherType.REQUEST) );
-        extraFilters = new LinkedList<>();
-        for (Class<? extends Filter> filterClass : config.extraFilters.keySet()) {
-          extraFilters.add(root.addFilter(filterClass, config.extraFilters.get(filterClass),
-              EnumSet.of(DispatcherType.REQUEST)));
-        }
-
-        for (ServletHolder servletHolder : config.extraServlets.keySet()) {
-          String pathSpec = config.extraServlets.get(servletHolder);
-          root.addServlet(servletHolder, pathSpec);
-        }
-        dispatchFilter = root.getServletHandler().newFilterHolder(Source.EMBEDDED);
-        dispatchFilter.setHeldClass(SolrDispatchFilter.class);
-        dispatchFilter.setInitParameter("excludePatterns", excludePatterns);
-        root.addFilter(dispatchFilter, "*", EnumSet.of(DispatcherType.REQUEST));
-      }
-
-      @Override
-      public void lifeCycleFailure(LifeCycle arg0, Throwable arg1) {
-        System.clearProperty("hostPort");
-      }
-    });
-
-    // for some reason, there must be a servlet for this to get applied
-    root.addServlet(Servlet404.class, "/*");
-    GzipHandler gzipHandler = new GzipHandler();
-    gzipHandler.setHandler(root);
-
-    gzipHandler.setMinGzipSize(0);
-    gzipHandler.setCheckGzExists(false);
-    gzipHandler.setCompressionLevel(-1);
-    gzipHandler.setExcludedAgentPatterns(".*MSIE.6\\.0.*");
-    gzipHandler.setIncludedMethods("GET");
-
-    server.setHandler(gzipHandler);
-  }
-
-  /**
-   * @return the {@link SolrDispatchFilter} for this node
-   */
-  public SolrDispatchFilter getSolrDispatchFilter() { return (SolrDispatchFilter) dispatchFilter.getFilter(); }
-
-  /**
-   * @return the {@link CoreContainer} for this node
-   */
-  public CoreContainer getCoreContainer() {
-    if (getSolrDispatchFilter() == null || getSolrDispatchFilter().getCores() == null) {
-      return null;
-    }
-    return getSolrDispatchFilter().getCores();
-  }
-
-  public String getNodeName() {
-    return getCoreContainer().getZkController().getNodeName();
-  }
-
-  public boolean isRunning() {
-    return server.isRunning();
-  }
-  
-  public boolean isStopped() {
-    return server.isStopped();
-  }
-
-  // ------------------------------------------------------------------------------------------------
-  // ------------------------------------------------------------------------------------------------
-
-  /**
-   * Start the Jetty server
-   *
-   * If the server has been started before, it will restart using the same port
-   *
-   * @throws Exception if an error occurs on startup
-   */
-  public void start() throws Exception {
-    start(true);
-  }
-
-  /**
-   * Start the Jetty server
-   *
-   * @param reusePort when true, will start up on the same port as used by any
-   *                  previous runs of this JettySolrRunner.  If false, will use
-   *                  the port specified by the server's JettyConfig.
-   *
-   * @throws Exception if an error occurs on startup
-   */
-  public void start(boolean reusePort) throws Exception {
-    // Do not let Jetty/Solr pollute the MDC for this thread
-    Map<String, String> prevContext = MDC.getCopyOfContextMap();
-    MDC.clear();
-    try {
-      // if started before, make a new server
-      if (startedBefore) {
-        waitOnSolr = false;
-        int port = reusePort ? jettyPort : this.config.port;
-        init(port);
-      } else {
-        startedBefore = true;
-      }
-
-      if (!server.isRunning()) {
-        server.start();
-      }
-      synchronized (JettySolrRunner.this) {
-        int cnt = 0;
-        while (!waitOnSolr) {
-          this.wait(100);
-          if (cnt++ == 5) {
-            throw new RuntimeException("Jetty/Solr unresponsive");
-          }
-        }
-      }
-      
-      if (config.waitForLoadingCoresToFinishMs != null && config.waitForLoadingCoresToFinishMs > 0L) waitForLoadingCoresToFinish(config.waitForLoadingCoresToFinishMs);
-    } finally {
-      if (prevContext != null)  {
-        MDC.setContextMap(prevContext);
-      } else {
-        MDC.clear();
-      }
-    }
-  }
-
-  /**
-   * Stop the Jetty server
-   *
-   * @throws Exception if an error occurs on shutdown
-   */
-  public void stop() throws Exception {
-    // Do not let Jetty/Solr pollute the MDC for this thread
-    Map<String, String> prevContext = MDC.getCopyOfContextMap();
-    MDC.clear();
-    try {
-      Filter filter = dispatchFilter.getFilter();
-
-      server.stop();
-
-      if (server.getState().equals(Server.FAILED)) {
-        filter.destroy();
-        if (extraFilters != null) {
-          for (FilterHolder f : extraFilters) {
-            f.getFilter().destroy();
-          }
-        }
-      }
-
-      server.join();
-    } finally {
-      if (prevContext != null)  {
-        MDC.setContextMap(prevContext);
-      } else {
-        MDC.clear();
-      }
-    }
-  }
-
-  /**
-   * Returns the Local Port of the jetty Server.
-   * 
-   * @exception RuntimeException if there is no Connector
-   */
-  private int getFirstConnectorPort() {
-    Connector[] conns = server.getConnectors();
-    if (0 == conns.length) {
-      throw new RuntimeException("Jetty Server has no Connectors");
-    }
-    return ((ServerConnector) conns[0]).getLocalPort();
-  }
-  
-  /**
-   * Returns the Local Port of the jetty Server.
-   * 
-   * @exception RuntimeException if there is no Connector
-   */
-  public int getLocalPort() {
-    if (jettyPort == -1) {
-      throw new IllegalStateException("You cannot get the port until this instance has started");
-    }
-    return (proxyPort != -1) ? proxyPort : jettyPort;
-  }
-  
-  /**
-   * Sets the port of a local socket proxy that sits infront of this server; if set
-   * then all client traffic will flow through the proxy, giving us the ability to
-   * simulate network partitions very easily.
-   */
-  public void setProxyPort(int proxyPort) {
-    this.proxyPort = proxyPort;
-  }
-
-  /**
-   * Returns a base URL consisting of the protocol, host, and port for a
-   * Connector in use by the Jetty Server contained in this runner.
-   */
-  public URL getBaseUrl() {
-    String protocol = null;
-    try {
-      Connector[] conns = server.getConnectors();
-      if (0 == conns.length) {
-        throw new IllegalStateException("Jetty Server has no Connectors");
-      }
-      ServerConnector c = (ServerConnector) conns[0];
-      if (c.getLocalPort() < 0) {
-        throw new IllegalStateException("Jetty Connector is not open: " + 
-                                        c.getLocalPort());
-      }
-      protocol = c.getDefaultProtocol().startsWith("SSL")  ? "https" : "http";
-      return new URL(protocol, c.getHost(), c.getLocalPort(), config.context);
-
-    } catch (MalformedURLException e) {
-      throw new  IllegalStateException
-        ("Java could not make sense of protocol: " + protocol, e);
-    }
-  }
-
-  public SolrClient newClient() {
-    return new HttpSolrClient.Builder(getBaseUrl().toString()).build();
-  }
-  
-  public SolrClient newClient(int connectionTimeoutMillis, int socketTimeoutMillis) {
-    return new HttpSolrClient.Builder(getBaseUrl().toString())
-        .withConnectionTimeout(connectionTimeoutMillis)
-        .withSocketTimeout(socketTimeoutMillis)
-        .build();
-  }
-
-  public DebugFilter getDebugFilter() {
-    return (DebugFilter)debugFilter.getFilter();
-  }
-
-  // --------------------------------------------------------------
-  // --------------------------------------------------------------
-
-  /**
-   * This is a stupid hack to give jetty something to attach to
-   */
-  public static class Servlet404 extends HttpServlet {
-    @Override
-    public void service(HttpServletRequest req, HttpServletResponse res)
-        throws IOException {
-      res.sendError(404, "Can not find: " + req.getRequestURI());
-    }
-  }
-
-  /**
-   * A main class that starts jetty+solr This is useful for debugging
-   */
-  public static void main(String[] args) {
-    try {
-      JettySolrRunner jetty = new JettySolrRunner(".", "/solr", 8983);
-      jetty.start();
-    } catch (Exception ex) {
-      ex.printStackTrace();
-    }
-  }
-
-  /**
-   * @return the Solr home directory of this JettySolrRunner
-   */
-  public String getSolrHome() {
-    return solrHome;
-  }
-
-  /**
-   * @return this node's properties
-   */
-  public Properties getNodeProperties() {
-    return nodeProperties;
-  }
-
-  private void waitForLoadingCoresToFinish(long timeoutMs) {
-    if (dispatchFilter != null) {
-      SolrDispatchFilter solrFilter = (SolrDispatchFilter) dispatchFilter.getFilter();
-      CoreContainer cores = solrFilter.getCores();
-      if (cores != null) {
-        cores.waitForLoadingCoresToFinish(timeoutMs);
-      }
-    }
-  }
-  
-  static class Delay {
-    final AtomicInteger counter;
-    final int delayValue;
-    final String reason;
-    
-    public Delay(String reason, int counter, int delay) {
-      this.reason = reason;
-      this.counter = new AtomicInteger(counter);
-      this.delayValue = delay;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
deleted file mode 100644
index 62c9024..0000000
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/SSLConfig.java
+++ /dev/null
@@ -1,166 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.client.solrj.embedded;
-
-import org.eclipse.jetty.util.ssl.SslContextFactory;
-
-/** 
- * Encapsulates settings related to SSL Configuration for an embedded Jetty Server.
- * NOTE: all other settings are ignored if {@link #isSSLMode} is false.
- * @see #setUseSSL
- */
-public class SSLConfig {
-  
-  private boolean useSsl;
-  private boolean clientAuth;
-  private String keyStore;
-  private String keyStorePassword;
-  private String trustStore;
-  private String trustStorePassword;
-
-  /** NOTE: all other settings are ignored if useSSL is false; trustStore settings are ignored if clientAuth is false */
-  public SSLConfig(boolean useSSL, boolean clientAuth, String keyStore, String keyStorePassword, String trustStore, String trustStorePassword) {
-    this.useSsl = useSSL;
-    this.clientAuth = clientAuth;
-    this.keyStore = keyStore;
-    this.keyStorePassword = keyStorePassword;
-    this.trustStore = trustStore;
-    this.trustStorePassword = trustStorePassword;
-  }
-  
-  public void setUseSSL(boolean useSSL) {
-    this.useSsl = useSSL;
-  }
-  
-  public void setClientAuth(boolean clientAuth) {
-    this.clientAuth = clientAuth;
-  }
-  
-  /** All other settings on this object are ignored unless this is true */
-  public boolean isSSLMode() {
-    return useSsl;
-  }
-  
-  public boolean isClientAuthMode() {
-    return clientAuth;
-  }
-
-  public String getKeyStore() {
-    return keyStore;
-  }
-
-  public String getKeyStorePassword() {
-    return keyStorePassword;
-  }
-
-  public String getTrustStore() {
-    return trustStore;
-  }
-
-  public String getTrustStorePassword() {
-    return trustStorePassword;
-  }
-
-  /**
-   * Returns an SslContextFactory that should be used by a jetty server based on the specified 
-   * SSLConfig param which may be null.
-   *
-   * if the SSLConfig param is non-null, then this method will return the results of 
-   * {@link #createContextFactory()}.
-   * 
-   * If the SSLConfig param is null, then this method will return null unless the 
-   * <code>tests.jettySsl</code> system property is true, in which case standard "javax.net.ssl.*" 
-   * system properties will be used instead, along with "tests.jettySsl.clientAuth".
-   * 
-   * @see #createContextFactory()
-   */
-  public static SslContextFactory createContextFactory(SSLConfig sslConfig) {
-
-    if (sslConfig != null) {
-      return sslConfig.createContextFactory();
-    }
-    // else...
-    if (Boolean.getBoolean("tests.jettySsl")) {
-      return configureSslFromSysProps();
-    }
-    // else...
-    return null;
-  }
-  
-  /**
-   * Returns an SslContextFactory that should be used by a jetty server based on this SSLConfig instance, 
-   * or null if SSL should not be used.
-   *
-   * The default implementation generates a simple factory according to the keystore, truststore, 
-   * and clientAuth properties of this object.
-   *
-   * @see #getKeyStore
-   * @see #getKeyStorePassword
-   * @see #isClientAuthMode
-   * @see #getTrustStore
-   * @see #getTrustStorePassword
-   */
-  public SslContextFactory createContextFactory() {
-
-    if (! isSSLMode()) {
-      return null;
-    }
-    // else...
-    
-    SslContextFactory factory = new SslContextFactory(false);
-    if (getKeyStore() != null)
-      factory.setKeyStorePath(getKeyStore());
-    if (getKeyStorePassword() != null)
-      factory.setKeyStorePassword(getKeyStorePassword());
-    
-    factory.setNeedClientAuth(isClientAuthMode());
-    
-    if (isClientAuthMode()) {
-      if (getTrustStore() != null)
-        factory.setTrustStorePath(getTrustStore());
-      if (getTrustStorePassword() != null)
-        factory.setTrustStorePassword(getTrustStorePassword());
-    }
-    return factory;
-
-  }
-
-  private static SslContextFactory configureSslFromSysProps() {
-
-    SslContextFactory sslcontext = new SslContextFactory(false);
-
-    if (null != System.getProperty("javax.net.ssl.keyStore")) {
-      sslcontext.setKeyStorePath
-          (System.getProperty("javax.net.ssl.keyStore"));
-    }
-    if (null != System.getProperty("javax.net.ssl.keyStorePassword")) {
-      sslcontext.setKeyStorePassword
-          (System.getProperty("javax.net.ssl.keyStorePassword"));
-    }
-    if (null != System.getProperty("javax.net.ssl.trustStore")) {
-      sslcontext.setTrustStorePath
-          (System.getProperty("javax.net.ssl.trustStore"));
-    }
-    if (null != System.getProperty("javax.net.ssl.trustStorePassword")) {
-      sslcontext.setTrustStorePassword
-          (System.getProperty("javax.net.ssl.trustStorePassword"));
-    }
-    sslcontext.setNeedClientAuth(Boolean.getBoolean("tests.jettySsl.clientAuth"));
-
-    return sslcontext;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/client/solrj/embedded/package-info.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/client/solrj/embedded/package-info.java b/solr/core/src/java/org/apache/solr/client/solrj/embedded/package-info.java
deleted file mode 100644
index a74c745..0000000
--- a/solr/core/src/java/org/apache/solr/client/solrj/embedded/package-info.java
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
- 
-/** 
- * SolrJ client implementations for embedded solr access.
- * <p>
- * See {@link org.apache.solr.client.solrj} for additional details.
- */
-package org.apache.solr.client.solrj.embedded;
-
-

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/ActionThrottle.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ActionThrottle.java b/solr/core/src/java/org/apache/solr/cloud/ActionThrottle.java
deleted file mode 100644
index 1724b53..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/ActionThrottle.java
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.lang.invoke.MethodHandles;
-
-import java.util.concurrent.TimeUnit;
-
-import org.apache.solr.common.util.TimeSource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-// this class may be accessed by multiple threads, but only one at a time
-public class ActionThrottle {
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  
-  private volatile Long lastActionStartedAt;
-  private volatile Long minMsBetweenActions;
-
-  private final String name;
-  private final TimeSource timeSource;
-
-  public ActionThrottle(String name, long minMsBetweenActions) {
-    this(name, minMsBetweenActions, TimeSource.NANO_TIME);
-  }
-  
-  public ActionThrottle(String name, long minMsBetweenActions, TimeSource timeSource) {
-    this.name = name;
-    this.minMsBetweenActions = minMsBetweenActions;
-    this.timeSource = timeSource;
-  }
-
-  public ActionThrottle(String name, long minMsBetweenActions, long lastActionStartedAt)  {
-    this(name, minMsBetweenActions, lastActionStartedAt, TimeSource.NANO_TIME);
-  }
-
-  public ActionThrottle(String name, long minMsBetweenActions, long lastActionStartedAt, TimeSource timeSource)  {
-    this.name = name;
-    this.minMsBetweenActions = minMsBetweenActions;
-    this.lastActionStartedAt = lastActionStartedAt;
-    this.timeSource = timeSource;
-  }
-
-  public void reset() {
-    lastActionStartedAt = null;
-  }
-
-  public void markAttemptingAction() {
-    lastActionStartedAt = timeSource.getTimeNs();
-  }
-  
-  public void minimumWaitBetweenActions() {
-    if (lastActionStartedAt == null) {
-      return;
-    }
-    long diff = timeSource.getTimeNs() - lastActionStartedAt;
-    int diffMs = (int) TimeUnit.MILLISECONDS.convert(diff, TimeUnit.NANOSECONDS);
-    long minNsBetweenActions = TimeUnit.NANOSECONDS.convert(minMsBetweenActions, TimeUnit.MILLISECONDS);
-    log.debug("The last {} attempt started {}ms ago.", name, diffMs);
-    int sleep = 0;
-    
-    if (diffMs > 0 && diff < minNsBetweenActions) {
-      sleep = (int) TimeUnit.MILLISECONDS.convert(minNsBetweenActions - diff, TimeUnit.NANOSECONDS);
-    } else if (diffMs == 0) {
-      sleep = minMsBetweenActions.intValue();
-    }
-    
-    if (sleep > 0) {
-      log.info("Throttling {} attempts - waiting for {}ms", name, sleep);
-      try {
-        timeSource.sleep(sleep);
-      } catch (InterruptedException e) {
-        Thread.currentThread().interrupt();
-      }
-    }
-  }
-
-  public Long getLastActionStartedAt() {
-    return lastActionStartedAt;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/ActiveReplicaWatcher.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/ActiveReplicaWatcher.java b/solr/core/src/java/org/apache/solr/cloud/ActiveReplicaWatcher.java
deleted file mode 100644
index c6bd807..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/ActiveReplicaWatcher.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.Set;
-
-import org.apache.solr.common.SolrCloseableLatch;
-import org.apache.solr.common.cloud.CollectionStateWatcher;
-import org.apache.solr.common.cloud.DocCollection;
-import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.common.cloud.Slice;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-/**
- * Watch for replicas to become {@link org.apache.solr.common.cloud.Replica.State#ACTIVE}. Watcher is
- * terminated (its {@link #onStateChanged(Set, DocCollection)} method returns false) when all listed
- * replicas become active.
- * <p>Additionally, the provided {@link SolrCloseableLatch} instance can be used to await
- * for all listed replicas to become active.</p>
- */
-public class ActiveReplicaWatcher implements CollectionStateWatcher {
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  private final String collection;
-  private final List<String> replicaIds = new ArrayList<>();
-  private final List<String> solrCoreNames = new ArrayList<>();
-  private final List<Replica> activeReplicas = new ArrayList<>();
-
-  private int lastZkVersion = -1;
-
-  private SolrCloseableLatch latch;
-
-  /**
-   * Construct the watcher. At least one replicaId or solrCoreName must be provided.
-   * @param collection collection name
-   * @param replicaIds list of replica id-s
-   * @param solrCoreNames list of SolrCore names
-   * @param latch optional latch to await for all provided replicas to become active. This latch will be
-   *                       counted down by at most the number of provided replica id-s / SolrCore names.
-   */
-  public ActiveReplicaWatcher(String collection, List<String> replicaIds, List<String> solrCoreNames, SolrCloseableLatch latch) {
-    if (replicaIds == null && solrCoreNames == null) {
-      throw new IllegalArgumentException("Either replicaId or solrCoreName must be provided.");
-    }
-    if (replicaIds != null) {
-      this.replicaIds.addAll(replicaIds);
-    }
-    if (solrCoreNames != null) {
-      this.solrCoreNames.addAll(solrCoreNames);
-    }
-    if (this.replicaIds.isEmpty() && this.solrCoreNames.isEmpty()) {
-      throw new IllegalArgumentException("At least one replicaId or solrCoreName must be provided");
-    }
-    this.collection = collection;
-    this.latch = latch;
-  }
-
-  /**
-   * Collection name.
-   */
-  public String getCollection() {
-    return collection;
-  }
-
-  /**
-   * Return the list of active replicas found so far.
-   */
-  public List<Replica> getActiveReplicas() {
-    return activeReplicas;
-  }
-
-  /**
-   * Return the list of replica id-s that are not active yet (or unverified).
-   */
-  public List<String> getReplicaIds() {
-    return replicaIds;
-  }
-
-  /**
-   * Return a list of SolrCore names that are not active yet (or unverified).
-   */
-  public List<String> getSolrCoreNames() {
-    return solrCoreNames;
-  }
-
-  @Override
-  public String toString() {
-    return "ActiveReplicaWatcher@" + Long.toHexString(hashCode()) + "{" +
-        "collection='" + collection + '\'' +
-        ", replicaIds=" + replicaIds +
-        ", solrCoreNames=" + solrCoreNames +
-        ", latch=" + (latch != null ? latch.getCount() : "null") + "," +
-        ", activeReplicas=" + activeReplicas +
-        '}';
-  }
-
-  // synchronized due to SOLR-11535
-  @Override
-  public synchronized boolean onStateChanged(Set<String> liveNodes, DocCollection collectionState) {
-    log.debug("-- onStateChanged@" + Long.toHexString(hashCode()) + ": replicaIds=" + replicaIds + ", solrCoreNames=" + solrCoreNames +
-        (latch != null ? "\nlatch count=" + latch.getCount() : "") +
-        "\ncollectionState=" + collectionState);
-    if (collectionState == null) { // collection has been deleted - don't wait
-      log.debug("-- collection deleted, decrementing latch by " + replicaIds.size() + solrCoreNames.size());
-      if (latch != null) {
-        for (int i = 0; i < replicaIds.size() + solrCoreNames.size(); i++) {
-          latch.countDown();
-        }
-      }
-      replicaIds.clear();
-      solrCoreNames.clear();
-      return true;
-    }
-    if (replicaIds.isEmpty() && solrCoreNames.isEmpty()) {
-      log.debug("-- already done, exiting...");
-      return true;
-    }
-    if (collectionState.getZNodeVersion() == lastZkVersion) {
-      log.debug("-- spurious call with already seen zkVersion=" + lastZkVersion + ", ignoring...");
-      return false;
-    }
-    lastZkVersion = collectionState.getZNodeVersion();
-
-    for (Slice slice : collectionState.getSlices()) {
-      for (Replica replica : slice.getReplicas()) {
-        if (replicaIds.contains(replica.getName())) {
-          if (replica.isActive(liveNodes)) {
-            activeReplicas.add(replica);
-            replicaIds.remove(replica.getName());
-            if (latch != null) {
-              latch.countDown();
-            }
-          }
-        } else if (solrCoreNames.contains(replica.getStr(ZkStateReader.CORE_NAME_PROP))) {
-          if (replica.isActive(liveNodes)) {
-            activeReplicas.add(replica);
-            solrCoreNames.remove(replica.getStr(ZkStateReader.CORE_NAME_PROP));
-            if (latch != null) {
-              latch.countDown();
-            }
-          }
-        }
-      }
-    }
-    log.debug("-- " + Long.toHexString(hashCode()) + " now latch count=" + latch.getCount());
-    if (replicaIds.isEmpty() && solrCoreNames.isEmpty()) {
-      return true;
-    } else {
-      return false;
-    }
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java b/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
deleted file mode 100644
index 9b16d23..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/CloudConfigSetService.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.lang.invoke.MethodHandles;
-
-import org.apache.solr.cloud.api.collections.CreateCollectionCmd;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.core.ConfigSetService;
-import org.apache.solr.core.CoreDescriptor;
-import org.apache.solr.core.SolrResourceLoader;
-import org.apache.zookeeper.KeeperException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class CloudConfigSetService extends ConfigSetService {
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-  
-  private final ZkController zkController;
-
-  public CloudConfigSetService(SolrResourceLoader loader, ZkController zkController) {
-    super(loader);
-    this.zkController = zkController;
-  }
-
-  @Override
-  public SolrResourceLoader createCoreResourceLoader(CoreDescriptor cd) {
-    try {
-      // for back compat with cores that can create collections without the collections API
-      if (!zkController.getZkClient().exists(ZkStateReader.COLLECTIONS_ZKNODE + "/" + cd.getCollectionName(), true)) {
-        CreateCollectionCmd.createCollectionZkNode(zkController.getSolrCloudManager().getDistribStateManager(), cd.getCollectionName(), cd.getCloudDescriptor().getParams());
-      }
-    } catch (KeeperException e) {
-      SolrException.log(log, null, e);
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
-      SolrException.log(log, null, e);
-    }
-
-    String configName = zkController.getZkStateReader().readConfigName(cd.getCollectionName());
-    return new ZkSolrResourceLoader(cd.getInstanceDir(), configName, parentLoader.getClassLoader(),
-        cd.getSubstitutableProperties(), zkController);
-  }
-
-  @Override
-  public String configName(CoreDescriptor cd) {
-    return "collection " + cd.getCloudDescriptor().getCollectionName();
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java b/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
deleted file mode 100644
index 068191e..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/CloudDescriptor.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.Properties;
-
-import org.apache.solr.common.StringUtils;
-import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.core.CoreDescriptor;
-import org.apache.solr.util.PropertiesUtil;
-
-import com.google.common.base.Strings;
-
-public class CloudDescriptor {
-
-  private final CoreDescriptor cd;
-  private String shardId;
-  private String collectionName;
-  private String roles = null;
-  private Integer numShards;
-  private String nodeName = null;
-  private Map<String,String> collectionParams = new HashMap<>();
-
-  private volatile boolean isLeader = false;
-  
-  // set to true once a core has registered in zk
-  // set to false on detecting a session expiration
-  private volatile boolean hasRegistered = false;
-  private volatile Replica.State lastPublished = Replica.State.ACTIVE;
-
-  public static final String NUM_SHARDS = "numShards";
-  
-  public static final String REPLICA_TYPE = "replicaType";
-  
-  /**
-   * The type of replica this core hosts
-   */
-  private final Replica.Type replicaType;
-
-  public CloudDescriptor(String coreName, Properties props, CoreDescriptor cd) {
-    this.cd = cd;
-    this.shardId = props.getProperty(CoreDescriptor.CORE_SHARD, null);
-    if (Strings.isNullOrEmpty(shardId))
-      this.shardId = null;
-    // If no collection name is specified, we default to the core name
-    this.collectionName = props.getProperty(CoreDescriptor.CORE_COLLECTION, coreName);
-    this.roles = props.getProperty(CoreDescriptor.CORE_ROLES, null);
-    this.nodeName = props.getProperty(CoreDescriptor.CORE_NODE_NAME);
-    if (Strings.isNullOrEmpty(nodeName))
-      this.nodeName = null;
-    this.numShards = PropertiesUtil.toInteger(props.getProperty(CloudDescriptor.NUM_SHARDS), null);
-    String replicaTypeStr = props.getProperty(CloudDescriptor.REPLICA_TYPE);
-    if (Strings.isNullOrEmpty(replicaTypeStr)) {
-      this.replicaType = Replica.Type.NRT;
-    } else {
-      this.replicaType = Replica.Type.valueOf(replicaTypeStr);
-    }
-    for (String propName : props.stringPropertyNames()) {
-      if (propName.startsWith(ZkController.COLLECTION_PARAM_PREFIX)) {
-        collectionParams.put(propName.substring(ZkController.COLLECTION_PARAM_PREFIX.length()), props.getProperty(propName));
-      }
-    }
-  }
-  
-  public boolean requiresTransactionLog() {
-    return this.replicaType != Replica.Type.PULL;
-  }
-  
-  public Replica.State getLastPublished() {
-    return lastPublished;
-  }
-
-  public void setLastPublished(Replica.State state) {
-    lastPublished = state;
-  }
-
-  public boolean isLeader() {
-    return isLeader;
-  }
-  
-  public void setLeader(boolean isLeader) {
-    this.isLeader = isLeader;
-  }
-  
-  public boolean hasRegistered() {
-    return hasRegistered;
-  }
-  
-  public void setHasRegistered(boolean hasRegistered) {
-    this.hasRegistered = hasRegistered;
-  }
-
-  public void setShardId(String shardId) {
-    this.shardId = shardId;
-  }
-  
-  public String getShardId() {
-    return shardId;
-  }
-  
-  public String getCollectionName() {
-    return collectionName;
-  }
-
-  public void setCollectionName(String collectionName) {
-    this.collectionName = collectionName;
-  }
-
-  public String getRoles(){
-    return roles;
-  }
-  
-  public void setRoles(String roles){
-    this.roles = roles;
-  }
-  
-  /** Optional parameters that can change how a core is created. */
-  public Map<String, String> getParams() {
-    return collectionParams;
-  }
-
-  // setting only matters on core creation
-  public Integer getNumShards() {
-    return numShards;
-  }
-  
-  public void setNumShards(int numShards) {
-    this.numShards = numShards;
-  }
-  
-  public String getCoreNodeName() {
-    return nodeName;
-  }
-
-  public void setCoreNodeName(String nodeName) {
-    this.nodeName = nodeName;
-    if(nodeName==null) cd.getPersistableStandardProperties().remove(CoreDescriptor.CORE_NODE_NAME);
-    else cd.getPersistableStandardProperties().setProperty(CoreDescriptor.CORE_NODE_NAME, nodeName);
-  }
-
-  public void reload(CloudDescriptor reloadFrom) {
-    if (reloadFrom == null) return;
-
-    setShardId(StringUtils.isEmpty(reloadFrom.getShardId()) ? getShardId() : reloadFrom.getShardId());
-    setCollectionName(StringUtils.isEmpty(reloadFrom.getCollectionName()) ? getCollectionName() : reloadFrom.getCollectionName());
-    setRoles(StringUtils.isEmpty(reloadFrom.getRoles()) ? getRoles() : reloadFrom.getRoles());
-    if (reloadFrom.getNumShards() != null) {
-      setNumShards(reloadFrom.getNumShards());
-    }
-    setCoreNodeName(StringUtils.isEmpty(reloadFrom.getCoreNodeName()) ? getCoreNodeName() : reloadFrom.getCoreNodeName());
-    setLeader(reloadFrom.isLeader);
-    setHasRegistered(reloadFrom.hasRegistered);
-    setLastPublished(reloadFrom.getLastPublished());
-
-    for (Map.Entry<String, String> ent : reloadFrom.getParams().entrySet()) {
-      collectionParams.put(ent.getKey(), ent.getValue());
-    }
-  }
-
-  public Replica.Type getReplicaType() {
-    return replicaType;
-  }
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java b/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
deleted file mode 100644
index 302703b..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/CloudUtil.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.io.File;
-import java.io.IOException;
-import java.lang.invoke.MethodHandles;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.commons.io.FileUtils;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
-import org.apache.solr.common.cloud.ClusterState;
-import org.apache.solr.common.cloud.DocCollection;
-import org.apache.solr.common.cloud.Replica;
-import org.apache.solr.common.cloud.Slice;
-import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.common.cloud.ZkStateReader;
-import org.apache.solr.core.CoreContainer;
-import org.apache.solr.core.CoreDescriptor;
-import org.apache.solr.core.SolrResourceLoader;
-import org.apache.zookeeper.KeeperException;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-
-public class CloudUtil {
-  private static final Logger log = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
-
-
-  /**
-   * See if coreNodeName has been taken over by another baseUrl and unload core
-   * + throw exception if it has been.
-   */
-  public static void checkSharedFSFailoverReplaced(CoreContainer cc, CoreDescriptor desc) {
-    if (!cc.isSharedFs(desc)) return;
-
-    ZkController zkController = cc.getZkController();
-    String thisCnn = zkController.getCoreNodeName(desc);
-    String thisBaseUrl = zkController.getBaseUrl();
-
-    log.debug("checkSharedFSFailoverReplaced running for coreNodeName={} baseUrl={}", thisCnn, thisBaseUrl);
-
-    // if we see our core node name on a different base url, unload
-    final DocCollection docCollection = zkController.getClusterState().getCollectionOrNull(desc.getCloudDescriptor().getCollectionName());
-    if (docCollection != null && docCollection.getSlicesMap() != null) {
-      Map<String,Slice> slicesMap = docCollection.getSlicesMap();
-      for (Slice slice : slicesMap.values()) {
-        for (Replica replica : slice.getReplicas()) {
-
-          String cnn = replica.getName();
-          String baseUrl = replica.getStr(ZkStateReader.BASE_URL_PROP);
-          log.debug("compare against coreNodeName={} baseUrl={}", cnn, baseUrl);
-
-          if (thisCnn != null && thisCnn.equals(cnn)
-              && !thisBaseUrl.equals(baseUrl)) {
-            if (cc.getLoadedCoreNames().contains(desc.getName())) {
-              cc.unload(desc.getName());
-            }
-
-            try {
-              FileUtils.deleteDirectory(desc.getInstanceDir().toFile());
-            } catch (IOException e) {
-              SolrException.log(log, "Failed to delete instance dir for core:"
-                  + desc.getName() + " dir:" + desc.getInstanceDir());
-            }
-            log.error("", new SolrException(ErrorCode.SERVER_ERROR,
-                "Will not load SolrCore " + desc.getName()
-                    + " because it has been replaced due to failover."));
-            throw new SolrException(ErrorCode.SERVER_ERROR,
-                "Will not load SolrCore " + desc.getName()
-                    + " because it has been replaced due to failover.");
-          }
-        }
-      }
-    }
-  }
-
-  public static boolean replicaExists(ClusterState clusterState, String collection, String shard, String coreNodeName) {
-    DocCollection docCollection = clusterState.getCollectionOrNull(collection);
-    if (docCollection != null) {
-      Slice slice = docCollection.getSlice(shard);
-      if (slice != null) {
-        return slice.getReplica(coreNodeName) != null;
-      }
-    }
-    return false;
-  }
-
-  /**
-   * Returns a displayable unified path to the given resource. For non-solrCloud that will be the
-   * same as getConfigDir, but for Cloud it will be getConfigSetZkPath ending in a /
-   * <p>
-   * <b>Note:</b> Do not use this to generate a valid file path, but for debug printing etc
-   * @param loader Resource loader instance
-   * @return a String of path to resource
-   */
-  public static String unifiedResourcePath(SolrResourceLoader loader) {
-    return (loader instanceof ZkSolrResourceLoader) ?
-            ((ZkSolrResourceLoader) loader).getConfigSetZkPath() + "/" :
-            loader.getConfigDir() + File.separator;
-  }
-
-  /**Read the list of public keys from ZK
-   */
-
-  public static Map<String, byte[]> getTrustedKeys(SolrZkClient zk, String dir) {
-    Map<String, byte[]> result = new HashMap<>();
-    try {
-      List<String> children = zk.getChildren("/keys/" + dir, null, true);
-      for (String key : children) {
-        if (key.endsWith(".der")) result.put(key, zk.getData("/keys/" + dir +
-            "/" + key, null, null, true));
-      }
-    } catch (KeeperException.NoNodeException e) {
-      log.info("Error fetching key names");
-      return Collections.EMPTY_MAP;
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
-      throw new SolrException(ErrorCode.SERVER_ERROR,"Unable to read crypto keys",e );
-    } catch (KeeperException e) {
-      throw new SolrException(ErrorCode.SERVER_ERROR,"Unable to read crypto keys",e );
-    }
-    return result;
-
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/CurrentCoreDescriptorProvider.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/CurrentCoreDescriptorProvider.java b/solr/core/src/java/org/apache/solr/cloud/CurrentCoreDescriptorProvider.java
deleted file mode 100644
index 29d0751..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/CurrentCoreDescriptorProvider.java
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.util.List;
-
-import org.apache.solr.core.CoreDescriptor;
-
-/**
- * Provide the current list of registered {@link CoreDescriptor}s.
- */
-public abstract class CurrentCoreDescriptorProvider {
-  public abstract List<CoreDescriptor> getCurrentDescriptors();
-}

http://git-wip-us.apache.org/repos/asf/lucene-solr/blob/0ae21ad0/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
----------------------------------------------------------------------
diff --git a/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java b/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
deleted file mode 100644
index c9f12e9..0000000
--- a/solr/core/src/java/org/apache/solr/cloud/DistributedMap.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.apache.solr.cloud;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-import org.apache.solr.common.SolrException;
-import org.apache.solr.common.SolrException.ErrorCode;
-import org.apache.solr.common.cloud.SolrZkClient;
-import org.apache.solr.common.cloud.ZkCmdExecutor;
-import org.apache.zookeeper.CreateMode;
-import org.apache.zookeeper.KeeperException;
-import org.apache.zookeeper.KeeperException.NodeExistsException;
-import org.apache.zookeeper.data.Stat;
-
-/**
- * A distributed map.
- * This supports basic map functions e.g. get, put, contains for interaction with zk which
- * don't have to be ordered i.e. DistributedQueue.
- */
-public class DistributedMap {
-  protected final String dir;
-
-  protected SolrZkClient zookeeper;
-
-  protected static final String PREFIX = "mn-";
-
-  public DistributedMap(SolrZkClient zookeeper, String dir) {
-    this.dir = dir;
-
-    ZkCmdExecutor cmdExecutor = new ZkCmdExecutor(zookeeper.getZkClientTimeout());
-    try {
-      cmdExecutor.ensureExists(dir, zookeeper);
-    } catch (KeeperException e) {
-      throw new SolrException(ErrorCode.SERVER_ERROR, e);
-    } catch (InterruptedException e) {
-      Thread.currentThread().interrupt();
-      throw new SolrException(ErrorCode.SERVER_ERROR, e);
-    }
-
-    this.zookeeper = zookeeper;
-  }
-
-
-  public void put(String trackingId, byte[] data) throws KeeperException, InterruptedException {
-    zookeeper.makePath(dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, false, true);
-  }
-  
-  /**
-   * Puts an element in the map only if there isn't one with the same trackingId already
-   * @return True if the the element was added. False if it wasn't (because the key already exists)
-   */
-  public boolean putIfAbsent(String trackingId, byte[] data) throws KeeperException, InterruptedException {
-    try {
-      zookeeper.makePath(dir + "/" + PREFIX + trackingId, data, CreateMode.PERSISTENT, null, true, true);
-      return true;
-    } catch (NodeExistsException e) {
-      return false;
-    }
-  }
-
-  public byte[] get(String trackingId) throws KeeperException, InterruptedException {
-    return zookeeper.getData(dir + "/" + PREFIX + trackingId, null, null, true);
-  }
-
-  public boolean contains(String trackingId) throws KeeperException, InterruptedException {
-    return zookeeper.exists(dir + "/" + PREFIX + trackingId, true);
-  }
-
-  public int size() throws KeeperException, InterruptedException {
-    Stat stat = new Stat();
-    zookeeper.getData(dir, null, stat, true);
-    return stat.getNumChildren();
-  }
-
-  /**
-   * return true if the znode was successfully deleted
-   *        false if the node didn't exist and therefore not deleted
-   *        exception an exception occurred while deleting
-   */
-  public boolean remove(String trackingId) throws KeeperException, InterruptedException {
-    try {
-      zookeeper.delete(dir + "/" + PREFIX + trackingId, -1, true);
-    } catch (KeeperException.NoNodeException e) {
-      return false;
-    }
-    return true;
-  }
-
-  /**
-   * Helper method to clear all child nodes for a parent node.
-   */
-  public void clear() throws KeeperException, InterruptedException {
-    List<String> childNames = zookeeper.getChildren(dir, null, true);
-    for(String childName: childNames) {
-      zookeeper.delete(dir + "/" + childName, -1, true);
-    }
-
-  }
-  
-  /**
-   * Returns the keys of all the elements in the map
-   */
-  public Collection<String> keys() throws KeeperException, InterruptedException {
-    List<String> childs = zookeeper.getChildren(dir, null, true);
-    final List<String> ids = new ArrayList<>(childs.size());
-    childs.stream().forEach((child) -> ids.add(child.substring(PREFIX.length())));
-    return ids;
-
-  }
-
-}