Index: oak-solr-core/pom.xml
===================================================================
--- oak-solr-core/pom.xml (revision 1574838)
+++ oak-solr-core/pom.xml (working copy)
@@ -121,12 +121,6 @@
tests
- javax.servlet
- servlet-api
- 2.5
- test
-
- org.apache.jackrabbitoak-mk${project.version}
Index: oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/RequestCachingSolrServer.java
===================================================================
--- oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/RequestCachingSolrServer.java (revision 0)
+++ oak-solr-core/src/main/java/org/apache/jackrabbit/oak/plugins/index/solr/server/RequestCachingSolrServer.java (working copy)
@@ -0,0 +1,128 @@
+/*
+ * 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.jackrabbit.oak.plugins.index.solr.server;
+
+import java.io.IOException;
+import java.util.Queue;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ConcurrentLinkedQueue;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Future;
+import org.apache.solr.client.solrj.SolrRequest;
+import org.apache.solr.client.solrj.SolrServer;
+import org.apache.solr.client.solrj.SolrServerException;
+import org.apache.solr.common.util.NamedList;
+
+/**
+ * A {@link org.apache.solr.client.solrj.SolrServer} wrapper which caches requests if the Solr instance / cluster,
+ * represented by a 'root' {@link org.apache.solr.client.solrj.SolrServer}, is not reachable.
+ */
+public class RequestCachingSolrServer extends SolrServer {
+ private final SolrServer solrServer;
+ private final ExecutorService executorService;
+ private final Queue queue = new ConcurrentLinkedQueue();
+ private final boolean blocking;
+
+ public RequestCachingSolrServer(SolrServer solrServer, ExecutorService executorService, boolean blocking) {
+ this.solrServer = solrServer;
+ this.executorService = executorService;
+ this.blocking = blocking;
+ }
+
+ public RequestCachingSolrServer(SolrServer solrServer, ExecutorService executorService) {
+ this.solrServer = solrServer;
+ this.executorService = executorService;
+ blocking = true;
+ }
+
+ private boolean isSolrReachable() {
+ try {
+ return 0 == solrServer.ping().getStatus();
+ } catch (Exception e) {
+ return false;
+ }
+ }
+
+ @Override
+ public NamedList