On Mon, 16 Jun 2025 08:56:17 GMT, Volkan Yazici <vyaz...@openjdk.org> wrote:

>> Jaikiran Pai has updated the pull request incrementally with one additional 
>> commit since the last revision:
>> 
>>   minor change to test's log message
>
> test/jdk/com/sun/net/httpserver/Test12.java line 113:
> 
>> 111:                 executor.shutdown ();
>> 112:             Files.delete(smallFilePath);
>> 113:             Files.delete(largeFilePath);
> 
> Instead of removing the file cleanup, IMHO, _good practice_, can't we use 
> `shutdown() + awaitTermination()` or `shutdownNow()` for the executor?

Hello Volkan, the issue here's isn't about not waiting for the tasks to 
complete. They in fact do complete. The actual issue is that the tasks have no 
way to know if the server side has actually done a `FileInputStream.close()` 
for the fixed length case, because the `InputStream` handed out to those tasks 
doesn't wait to receive a EOF from the server side for the fixed length case. 
Instead since the InputStream knows how many bytes to expect, once it receives 
those many bytes, it immediately returns. The server side (in 
FileServerHandler) would have transmitted those bytes and would be in the 
process of closing the FileInputStream, but the client side task would already 
be completed. So adding a `awaitTermination()` on the executor will not help.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/25820#discussion_r2149460968

Reply via email to