You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@jena.apache.org by "afs (via GitHub)" <gi...@apache.org> on 2026/02/15 20:37:54 UTC
Re: [I] `QueryIterPlainWrapper` concurrency on `close`/`cancelRequest` [jena]
afs commented on issue #3755:
URL: https://github.com/apache/jena/issues/3755#issuecomment-3905146269
> All iterators involved in query execution should ideally be abortable
the work of the abort wil be on the query execution thread (which maybe inside a transaction, and the signal is from outside). For `QueryIterAbortable` it can be part of `close`.
`QueryIterPlainWrapperCloseOnAbort` is what `QueryIterAbortable` is trying to be for clear-up, not interrupt, style abort.
The query execution thread has to throw `QueryCancelledException` so that it works it way up through the transaction mechanism and to the `QueryExec`.
It is possible there are, or will be operations, that are in middle of something when the cancel signal is set and need to be poked c.f. thread interrupt.
I can't think of any in the ARQ/DBOE/TDB code. Are there any in the service enhancer?
Otherwise, it's a similar situation (not quite as serious as it isn't potentially VM or retaining locks) to `Thread.stop`.
Using the execution context cancel:
```java
@Override
protected boolean hasNextBinding() {
possibleCancellation();
return iterator.hasNext();
}
private void possibleCancellation() {
ExecutionContext execCxt = super.getExecContext();
if ( execCxt == null )
return;
AtomicBoolean cancelSignal = execCxt.getCancelSignal();
if ( cancelSignal != null && cancelSignal.get() ) {
closeIterator();
throw new QueryCancelledException();
}
}
```
(`AtomicBoolean` may be stronger then needed).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@jena.apache.org
For additional commands, e-mail: issues-help@jena.apache.org