Java Code Examples for org.apache.solr.core.CoreContainer#CoreLoadFailure

The following examples show how to use org.apache.solr.core.CoreContainer#CoreLoadFailure . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: StatusOp.java    From lucene-solr with Apache License 2.0 6 votes vote down vote up
@Override
public void execute(CoreAdminHandler.CallInfo it) throws Exception {
  SolrParams params = it.req.getParams();

  String cname = params.get(CoreAdminParams.CORE);
  String indexInfo = params.get(CoreAdminParams.INDEX_INFO);
  boolean isIndexInfoNeeded = Boolean.parseBoolean(null == indexInfo ? "true" : indexInfo);
  NamedList<Object> status = new SimpleOrderedMap<>();
  Map<String, Exception> failures = new HashMap<>();
  for (Map.Entry<String, CoreContainer.CoreLoadFailure> failure : it.handler.coreContainer.getCoreInitFailures().entrySet()) {
    failures.put(failure.getKey(), failure.getValue().exception);
  }
  if (cname == null) {
    for (String name : it.handler.coreContainer.getAllCoreNames()) {
      status.add(name, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, name, isIndexInfoNeeded));
    }
    it.rsp.add("initFailures", failures);
  } else {
    failures = failures.containsKey(cname)
        ? Collections.singletonMap(cname, failures.get(cname))
            : Collections.<String, Exception>emptyMap();
        it.rsp.add("initFailures", failures);
        status.add(cname, CoreAdminOperation.getCoreStatus(it.handler.coreContainer, cname, isIndexInfoNeeded));
  }
  it.rsp.add("status", status);
}
 
Example 2
Source File: SolrTestCaseJ4.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public static boolean hasInitException(String message) {
  for (Map.Entry<String, CoreContainer.CoreLoadFailure> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) {
    if (entry.getValue().exception.getMessage().contains(message))
      return true;
  }
  return false;
}
 
Example 3
Source File: SolrTestCaseJ4.java    From lucene-solr with Apache License 2.0 5 votes vote down vote up
public static boolean hasInitException(Class<? extends Exception> exceptionType) {
  for (Map.Entry<String, CoreContainer.CoreLoadFailure> entry : h.getCoreContainer().getCoreInitFailures().entrySet()) {
    if (exceptionType.isAssignableFrom(entry.getValue().exception.getClass()))
      return true;
  }
  return false;
}