List of usage examples for org.apache.solr.handler.loader ContentStreamLoader load
public abstract void load(SolrQueryRequest req, SolrQueryResponse rsp, ContentStream stream, UpdateRequestProcessor processor) throws Exception;
From source file:org.codeexample.jeffery.solr.ThreadedUpdateRequestHandler.java
License:Apache License
private void submitTask(final SolrQueryRequest req, final SolrQueryResponse rsp, final UpdateRequestProcessorChain processorChain, ExecutorService executor, final ContentStream stream, final List<Map<String, Object>> rspResult) { Thread thread = new Thread() { public void run() { Map<String, Object> map = new LinkedHashMap<String, Object>(); map.put("start_time", new Date().toString()); if (stream instanceof ContentStreamBase.FileStream) { map.put("Import File: ", ((ContentStreamBase.FileStream) stream).getName()); }/*from w w w. java 2s . c om*/ try { UpdateRequestProcessor processor = null; try { processor = processorChain.createProcessor(req, rsp); ContentStreamLoader documentLoader = newLoader(req, processor); documentLoader.load(req, rsp, stream, processor); System.err.println(rsp); } finally { if (processor != null) { // finish the request processor.finish(); } } } catch (Exception e) { rsp.setException(e); } finally { map.put("end_time", new Date().toString()); if (rsp.getException() != null) { map.put("exception", rsp.getException()); } rspResult.add(map); } }; }; executor.execute(thread); }