On Fri, 14 Apr 2023 07:54:39 GMT, Alan Bateman <al...@openjdk.org> wrote:

>> With the removal of the AltFinalizer mechanism from `FileInputStream` and 
>> `FileOutputStream` in 
>> [JDK-8192939](https://bugs.openjdk.org/browse/JDK-8192939), this portion of 
>> the Implementation Requirement in the class JavaDoc is no longer true:
>> 
>>> If this FileOutputStream has been subclassed and the close() method has 
>>> been overridden, the close() method will be called when the FileInputStream 
>>> is unreachable."
>> 
>> The class doc, and the doc for close(), are updated to correctly reflect 
>> current behavior, and guidance for subclasses is clarified.
>
> src/java.base/share/classes/java/io/FileInputStream.java line 50:
> 
>> 48:  * Subclasses are responsible for the cleanup of resources acquired by 
>> the subclass.
>> 49:  * Subclasses requiring that resource cleanup take place after a stream 
>> becomes
>> 50:  * unreachable should use the {@link java.lang.ref.Cleaner} mechanism.
> 
> This is in the style of an API note for implementors so implSpec is 
> appropriate here.

Perhaps add "or other mechanisms" or similar advice.  
There should be some room to use other kinds of queues or polling to do the 
cleanup.
For example, there are some maps that check for cleanups when doing other 
operations.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13437#discussion_r1166849142

Reply via email to