use of org.apache.solr.servlet.SolrDispatchFilter in project lucene-solr by apache.
the class JettySolrRunner method waitForLoadingCoresToFinish.
private void waitForLoadingCoresToFinish(long timeoutMs) {
if (dispatchFilter != null) {
SolrDispatchFilter solrFilter = (SolrDispatchFilter) dispatchFilter.getFilter();
CoreContainer cores = solrFilter.getCores();
if (cores != null) {
cores.waitForLoadingCoresToFinish(timeoutMs);
}
}
}
use of org.apache.solr.servlet.SolrDispatchFilter in project stanbol by apache.
the class SolrServerPublishingComponent method updateFilter.
/**
* A change was made to the tracked CoreContainer (adding ,removal, ranking change).
* This removes and re-add the Servlet filter to apply such changes.
* @param name The name of the filter to be updated
* @param ref The serviceReference for the new CoreContainer to be added for
* the parsed name. <code>null</code> if the filter for that name needs only
* to be removed
* @param server The {@link CoreContainer} may be parsed in cases a reference
* is already available. If not the {@link #tracker} is used to look it up
* based on the parsed reference. This is basically a workaround for the
* fact that if the call originates form
* {@link ServiceTrackerCustomizer#addingService(ServiceReference)} the
* {@link CoreContainer} is not yet available via the tracker.
*/
protected void updateFilter(String name, ServiceReference ref, CoreContainer server) {
String serverPrefix = gloablPrefix + name;
Filter filter = published.remove(name);
if (filter != null) {
extHttpService.unregisterFilter(filter);
filter = null;
log.info("removed ServletFilter for SolrServer {} and prefix {}", name, serverPrefix);
}
// else no current filter for that name
if (ref != null || server != null) {
if (server == null) {
server = (CoreContainer) tracker.getService(ref);
}
ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
Thread.currentThread().setContextClassLoader(CoreContainer.class.getClassLoader());
try {
filter = new SolrFilter(server);
} finally {
Thread.currentThread().setContextClassLoader(classLoader);
}
Dictionary<String, Object> filterPrpoerties = new Hashtable<String, Object>();
filterPrpoerties.put("path-prefix", serverPrefix);
String filterPrefix = serverPrefix + "/.*";
try {
extHttpService.registerFilter(filter, filterPrefix, filterPrpoerties, 0, null);
} catch (ServletException e) {
throw new IllegalStateException("Unable to register SolrDispatchFilter for" + "CoreContainer with name" + name + " (prefix: " + filterPrefix + "| properties: " + filterPrpoerties + ").", e);
}
log.info("added ServletFilter for SolrServer {} and prefix {}", name, serverPrefix);
}
// else no new filter to add
}
use of org.apache.solr.servlet.SolrDispatchFilter in project lucene-solr by apache.
the class ChaosMonkey method stopJettySolrRunner.
private static void stopJettySolrRunner(JettySolrRunner jetty) throws Exception {
assert (jetty != null);
monkeyLog("stop jetty! " + jetty.getLocalPort());
SolrDispatchFilter sdf = jetty.getSolrDispatchFilter();
if (sdf != null) {
try {
sdf.destroy();
} catch (Throwable t) {
log.error("", t);
}
}
try {
jetty.stop();
} catch (InterruptedException e) {
log.info("Jetty stop interrupted - should be a test caused interruption, we will try again to be sure we shutdown");
}
if (!jetty.isStopped()) {
jetty.stop();
}
if (!jetty.isStopped()) {
throw new RuntimeException("could not stop jetty");
}
}
Aggregations