On Tue, 24 May 2022 09:26:44 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
> This patch tweaks the foreign API to use the newly added > `WrongThreadException` instead of `IllegalStateException` to report > confinement errors. > Thinking more about it: `IllegalStateException` is fine for a closed > `MemorySession`. If used by wrong thread the exception was indeed confusing. > Now that the abiguity is gone, I can change our (Lucene) code and just > transform every ISE to an already closed in our code. I just wanted to bring > up that issue here. > > PR is here: [apache/lucene#912](https://github.com/apache/lucene/pull/912) I've been thinking something similar. I'd suggest to keep the API as is, and maybe revise it at a later point if lack of a specific exception for the "already closed" case proves to be too cumbersome to workaround. ------------- PR: https://git.openjdk.java.net/jdk/pull/8865