{
futures[i] = (Future<Res>)_executorService.submit(new Callable<Res>()
{
public Res call() throws Exception
{
Timer timer = getTimer(partition);
Res res = timer.time(new Callable<Res>(){
@Override
public Res call() throws Exception {
return handleRequest(senseiReq, readerFactory, _core.getQueryBuilderFactory(), indexReaderCache);
}
});
long end = System.currentTimeMillis();
res.setTime(end - start);
logger.info("searching partition: " + partition + " browse took: " + res.getTime());
return res;
}
});
} catch (Exception e)
{
senseiReq.addError(new SenseiError(e.getMessage(), ErrorType.BoboExecutionError));
logger.error(e.getMessage(), e);
}
}
else // Reuse current thread.
{
try
{
Timer timer = getTimer(partition);
Res res = timer.time(new Callable<Res>(){
@Override
public Res call() throws Exception {
return handleRequest(senseiReq, readerFactory, _core.getQueryBuilderFactory(), indexReaderCache);
}