Other than using futures and callables? Runnables ;-) Other than that you
will need async request (ie. client).

But in case sb else is looking for an easy-recipe for the server-side async:


public void handleRequestBody(.....) {
   if (isBusy()) {
rsp.add("message", "Batch processing is already running...");
 rsp.add("status", "busy");
return;
  }
   runAsynchronously(new LocalSolrQueryRequest(req.getCore(),
req.getParams()));
}
private void runAsynchronously(SolrQueryRequest req) {

final SolrQueryRequest request = req;
 thread = new Thread(new Runnable() {
public void run() {
try {
 while (queue.hasMore()) {
runSynchronously(queue, request);
}
 } catch (Exception e) {
log.error(e.getLocalizedMessage());
} finally {
 request.close();
                                        setBusy(false);
}
 }
});

thread.start();
}


On Tue, Jul 9, 2013 at 1:10 AM, Learner <bbar...@gmail.com> wrote:

>
> I wrote a custom data import handler to import data from files. I am trying
> to figure out a way to make asynchronous call instead of waiting for the
> data import response. Is there an easy way to invoke asynchronously  (other
> than using futures and callables) ?
>
> public class CustomFileImportHandler extends RequestHandlerBase implements
> SolrCoreAware{
>         public void handleRequestBody(SolrQueryRequest arg0,
> SolrQueryResponse
> arg1){
>        indexer a= new indexer(""); // constructor
>        String status= a.Index(); // method to do indexing, trying to make
> it
> async
> }
> }
>
>
>
>
> --
> View this message in context:
> http://lucene.472066.n3.nabble.com/Best-way-to-call-asynchronously-Custom-data-import-handler-tp4076475.html
> Sent from the Solr - User mailing list archive at Nabble.com.
>

Reply via email to