lucene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Michael Braun (JIRA)" <>
Subject [jira] [Commented] (LUCENE-8434) Use shared instance of CollectionTerminatedException
Date Fri, 27 Jul 2018 22:06:00 GMT


Michael Braun commented on LUCENE-8434:

Thanks [~thetaphi] - did not know about the OmitStackTraceInFastThrow optimization! When I
have some free time I'll look to see if this is kicking in for all practical cases. 

In general though, as to using a RuntimeException as an alternative to adjusting signatures
- where has the balance been found between representing an alternate scenario with an Exception
versus a representative return value containing that it happened? It could have been represented
as part of a return value that clients would need to deal with as opposed to a RuntimeException
they'd need to catch. 

> Use shared instance of CollectionTerminatedException
> ----------------------------------------------------
>                 Key: LUCENE-8434
>                 URL:
>             Project: Lucene - Core
>          Issue Type: Improvement
>            Reporter: Michael Braun
>            Priority: Minor
> Creating exceptions and filling in the stack is expensive (see SOLR-11242 and SOLR-11314
for two such examples). CollectionTerminatedException is used as a signaling mechanism - there
are zero instances in code that actually log that it occurred or make use of anything other
than the fact that it occurred (unlike Solr's EarlyTerminatingCollectorException, for instance).
 Exceptions really should be for something exceptional - the use of CollectionTerminatedException
is in place of polluting return values with this condition and is just used as a signal to
> Because CollectionTerminatedException is never inspected directly and is effectively
a different return condition, it doesn't make as much sense to generate new Exceptions with
fresh stack traces every time - either change the signatures or share the object. 

This message was sent by Atlassian JIRA

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message