<Sound Dev> [11] Review Request: 8202264 Race condition in AudioClip.loop()

Sergey Bylokhov Sergey.Bylokhov at oracle.com
Tue Jul 10 10:40:07 UTC 2018

On 10/07/2018 01:44, Phil Race wrote:
> Looks ok.
> Are you sure the test does not need to be marked as headful ?
> I'm OK if you need to make that change to not send an updated webrev.

Yes, AudioClip ignores all exceptions(at least it should), and the test 
does not check that the new thread actually created. So even if there 
are no audio device the test will pass.

> -phil.
> On 07/09/2018 04:25 AM, Sergey Bylokhov wrote:
>> Hello, Audio Guru.
>> Please review the fix for jdk11.
>> Bug: https://bugs.openjdk.java.net/browse/JDK-8202264
>> Webrev: http://cr.openjdk.java.net/~serb/8202264/webrev.00
>> Our implementation of "java.applet.AudioClip" is a wrapper for 
>> "javax.sound.sampled.Line", which should be closed after usage.
>> We close the line in two situations:
>>  1. When finalize() is called for the AudioClip.
>>  2. When the AudioClip is inactive 5 seconds after creation(at the 
>> moment of check).
>> The second case has some issues:
>>  - The clip can be closed automatically not after 5 seconds from the 
>> last activity, but even if the clip is actively used but inactive 
>> exactly at 5 seconds after creation.
>>  - The clip can be closed automatically when(or immediately after) the 
>> user will try to play some sounds.
>> In the fix I have disabled auto-closing, when the user tries to play 
>> the sounds. As a side effect we will close the clip after 5 seconds of 
>> inactivity.

Best regards, Sergey.

More information about the sound-dev mailing list