Aklakan commented on issue #3755:
URL: https://github.com/apache/jena/issues/3755#issuecomment-3909469102

   > Are there any in the service enhancer?
   
   The 'old' service enhancer still ignores cancel, the revised one with PR 
https://github.com/apache/jena/pull/3706 should not block if the underlying 
iterators don't block.
   
   > `private void possibleCancellation()`
   
   Isn't this the logic that is effectively already in place in 
`QueryIteratorBase` that is a super class of `QueryIterPlainWrapper`?
   If so, then this change in `QueryIterPlainWrapper` should be sufficient:
   
   ```diff
        @Override
        protected void requestCancel()
   -    { closeIterator(); }
   +    { }
   ```
   And the removal of the `synchronized` from `closeIterator`.
   
   Excerpt from `QueryIteratorBase`:
   
   ```java
       private boolean requestingCancel() {
           return (requestingCancel != null && requestingCancel.get()) || 
Thread.currentThread().isInterrupted() ;
       }
   
         @Override
       public final Binding nextBinding() {
           try {
               // Need to make sure to only read this once per iteration
               boolean shouldCancel = requestingCancel();
   
               if ( shouldCancel ) {
                   // Try to close first to release resources (in case the user
                   // doesn't have a close() call in a finally block)
                   close();
                   throw new QueryCancelledException();
               }
           // ...
           }
       }
   ```


-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to