JDK-4094337 : Daemon thread created for playing .mid sounds, but not .wav
  • Type: Bug
  • Component: client-libs
  • Sub-Component: javax.sound
  • Affected Version: 1.2.0
  • Priority: P4
  • Status: Closed
  • Resolution: Not an Issue
  • OS: windows_nt
  • CPU: x86
  • Submitted: 1997-11-20
  • Updated: 2002-04-13
  • Resolved: 2002-04-13
Related Reports
Relates :  
Description

Name: gvC48267			Date: 11/20/97


Playing a .mid file created a daemon thread, meaning Java runtime never exited. 
Playing a .wav file didn't, meaning I had to 'sleep' until I thought the sound 
file was done playing.
Personally, I don't care which way it works. All I want is a consistent one.
Either always create a daemon thread, or never. 
This is now more important as applications can play sound files with pure java 
(w/o mucking with the sun.* classes).
(Review ID: 20197)
======================================================================

Comments
EVALUATION yes, the behaviour should be consistent, but i don't think this problem is a regression from anything supported in previous releases, and it's easy to work around the issue using sleep(). changing from P3 to P4. kara.kytle@Eng 1998-04-15 ###@###.### 2002-04-12 This bug does not apply anymore. MIDI and audio will both create a non-daemon thread, which will prevent the VM from exiting. See bug 4435394: Sound API prevent JVM from exiting. Closed as "not a bug", but in fact, it is fixed.
11-06-2004

WORK AROUND Name: gvC48267 Date: 11/20/97 Source: import java.applet.*; import java.net.*; public class MyMy { public static void main (String args[]) throws Exception { URL url = new URL ("http://localhost/tada.wav"); // URL url = new URL ("http://localhost/canyon.mid"); AudioClip ac = Applet.newAudioClip(url); ac.play(); // Thread.currentThread().sleep (100000); } } - .wav file requires sleep - .mid file doesn't ======================================================================
11-06-2004