Skip to content

Commit 040e40b

Browse files
authored
GH-5732: fix application specific thread context in federated service (#5733)
2 parents 25640d3 + 51b441d commit 040e40b

1 file changed

Lines changed: 12 additions & 1 deletion

File tree

core/repository/sparql/src/main/java/org/eclipse/rdf4j/repository/sparql/federation/RepositoryFederatedService.java

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public BatchingServiceIteration(CloseableIteration<BindingSet> inputBindings,
8686
// See: https://github.com/eclipse-rdf4j/rdf4j/discussions/5120
8787
// Test case: https://github.com/tkuhn/rdf4j-timeout-test
8888
try {
89-
querySubmissionTask = threadExecutor.submit(this::run);
89+
querySubmissionTask = threadExecutor.submit(wrap(this::run));
9090
} catch (Exception e) {
9191
throw new QueryEvaluationException("Failed to start a thread for batched federated query submission",
9292
e);
@@ -661,4 +661,15 @@ private static void closeQuietly(RepositoryConnection conn) {
661661
logger.debug("Details: ", t);
662662
}
663663
}
664+
665+
/**
666+
* Callback to wrap the runnable prior to passing it to the background Executor. Can be used by specializations to
667+
* apply context.
668+
*
669+
* @param runnable the runnable
670+
* @return the runnable
671+
*/
672+
protected Runnable wrap(Runnable runnable) {
673+
return runnable;
674+
}
664675
}

0 commit comments

Comments
 (0)