You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@lucene.apache.org by GitBox <gi...@apache.org> on 2021/02/17 07:52:45 UTC

[GitHub] [lucene-solr] donnerpeter commented on pull request #2378: LUCENE-9779: Hunspell: add an API to interrupt long computations

donnerpeter commented on pull request #2378:
URL: https://github.com/apache/lucene-solr/pull/2378#issuecomment-780373942


   > Control-flow by exception is something I'm not particularly fond of, to be honest... I'd rather see a predicate (and graceful return) or leverage of existing Java mechanisms (Thread.checkInterrupted) to implement this. I realise a generic Runnable throwing an unchecked exception works in this case too (and is convenient for catching up the stack) but would you consider just resorting to checking the thread's interrupted status? The IDE can catch interrupted exception or wrap and rethrow as needed.
   
   I've considered a `BooleanSupplier` and I couldn't decide which results to produce in `spell`/`suggest` during graceful return, and how to prevent callers from caching them (incorrectly). Exception solves both problems :)
   
   There's no `Thread.checkInterrupted` in my JDK 11, did you mean something else? Anyway, `InterruptedException` is a checked one, and I'd prefer innocent clients not to care about that, so then one would have to decide which unchecked exception to use instead. Besides, the IDE that I have in mind has complicated relations with interrupted threads, which have a history of corrupting caches there. It's not unsolvable, but requires some care that not everybody has :(


----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@lucene.apache.org
For additional commands, e-mail: issues-help@lucene.apache.org