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. I have seen this PR now: Would it be also a good idea to replace the `IllegalStateException` for already closed `MemorySession` by some special exception? In Lucene we catch `IllegalStateException` in our IO layer and check if message contains "closed", example: - https://github.com/apache/lucene/blob/d182134bf88a44bf76ebd1c1d40b225ecdca1f4b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java#L137 (catch) - https://github.com/apache/lucene/blob/d182134bf88a44bf76ebd1c1d40b225ecdca1f4b/lucene/core/src/java/org/apache/lucene/store/MemorySegmentIndexInput.java#L93-L103 (that's the hack) The check using `ex.getMessage().contains("closed")` feels bad, especially if it may be translated to a locale. ------------- PR: https://git.openjdk.java.net/jdk/pull/8865