Source:
<code>public void executeQuery( final SearchRequest request, final ServerSession session, final Subject subject) { final Search search = new Search(request, actionRegistry); final Map<String, Result> results = Collections.synchronizedMap(new HashMap<String, Result>()); final Future<FilteringSolrIndex> solrIndexFuture; if (shouldNormalizeRelevance(request)) { solrIndexFuture = executorService.submit(new FilteringSolrIndexCallable(request, filterAdapter)); } else { solrIndexFuture = Futures.immediateFuture(null); } final Future cacheFuture; if (!cacheDisabled) { cacheFuture = executorService.submit( new CacheQueryRunnable( this, request, subject, search, session, results, solrIndexFuture)); } else { cacheFuture = Futures.immediateFuture(null); } long deadline = System.currentTimeMillis() + request.getQuery().getTimeoutMillis(); Map<String, Future> futures = new HashMap<>(request.getSourceIds().size()); for (final String sourceId : request.getSourceIds()) { futures.put( sourceId, executorService.submit( new SourceQueryRunnable( this, sourceId, request, subject, results, search, session, cacheFuture, solrIndexFuture))); } for (Map.Entry<String, Future> entry : futures.entrySet()) { executorService.submit( () -> { String sourceId = entry.getKey(); Future future = entry.getValue(); try { long timeRemaining = Math.max(0, deadline - System.currentTimeMillis()); future.get(timeRemaining, TimeUnit.MILLISECONDS); } catch (TimeoutException e) { LOGGER.info("Query timed out for source {}", sourceId, e); failSource(request, session, search, sourceId, e); } catch (ExecutionException e) { LOGGER.info("Query failed for source {}", sourceId, e.getCause()); failSource(request, session, search, sourceId, e); } catch (InterruptedException e) { LOGGER.info("Query interrupted for source {}", sourceId, e); <START> failSource(request, session, search, sourceId, e); <END> } }); } }</code><technical_language>thread's interrupted flag set well</technical_language>

Target:
public void executeQuery( final SearchRequest request, final ServerSession session, final Subject subject) { final Search search = new Search(request, actionRegistry); final Map<String, Result> results = Collections.synchronizedMap(new HashMap<String, Result>()); final Future<FilteringSolrIndex> solrIndexFuture; if (shouldNormalizeRelevance(request)) { solrIndexFuture = executorService.submit(new FilteringSolrIndexCallable(request, filterAdapter)); } else { solrIndexFuture = Futures.immediateFuture(null); } final Future cacheFuture; if (!cacheDisabled) { cacheFuture = executorService.submit( new CacheQueryRunnable( this, request, subject, search, session, results, solrIndexFuture)); } else { cacheFuture = Futures.immediateFuture(null); } long deadline = System.currentTimeMillis() + request.getQuery().getTimeoutMillis(); Map<String, Future> futures = new HashMap<>(request.getSourceIds().size()); for (final String sourceId : request.getSourceIds()) { futures.put( sourceId, executorService.submit( new SourceQueryRunnable( this, sourceId, request, subject, results, search, session, cacheFuture, solrIndexFuture))); } for (Map.Entry<String, Future> entry : futures.entrySet()) { executorService.submit( () -> { String sourceId = entry.getKey(); Future future = entry.getValue(); try { long timeRemaining = Math.max(0, deadline - System.currentTimeMillis()); future.get(timeRemaining, TimeUnit.MILLISECONDS); } catch (InterruptedException e) { LOGGER.info("Query interrupted for source {}", sourceId, e); failSource(request, session, search, sourceId, e); } catch (TimeoutException e) { LOGGER.info("Query timed out for source {}", sourceId, e); failSource(request, session, search, sourceId, e); } catch (ExecutionException e) { LOGGER.info("Query failed for source {}", sourceId, e.getCause()); failSource(request, session, search, sourceId, e); } }); } }