On Fri, 23 May 2025 22:37:35 GMT, Phil Race <p...@openjdk.org> wrote:
>For me, once the end of "main()" is reached the VM exits. Even if a sound is >playing and looping. >And even then, are you suggesting this would block System.exit() ? >Where have you actually seen this problem or why are you sure it is a problem ? It does not prevent the application from exiting via `System.exit()`, but it does prevent it from exiting naturally when the main method completes. This is consistent with how AWT behaves (as [documented here](https://github.com/openjdk/jdk/blob/fdda7661906eab63d939e9f482449e21cc143c8f/src/java.desktop/share/classes/java/awt/doc-files/AWTThreadIssues.html#L108)): the application should dispose of all Windows/Frames to be shutdown. Similarly, this new API appears to follow the same logic: all playable clips must be stopped, otherwise the application will keep running indefinitely. I tested this behavior on macOS using [this MIDI file](https://en.wikipedia.org/wiki/File:MIDI_sample.mid?oldformat=true). import java.io.File; import javax.sound.SoundClip; public final class TestClip { public static void main(String[] args) throws Exception { SoundClip soundClip = SoundClip.createSoundClip(new File("MIDI_sample.mid")); soundClip.loop(); System.out.println("end main"); } } ------------- PR Comment: https://git.openjdk.org/jdk/pull/24991#issuecomment-2906346048