JDK-6758986 : Gervill: Turn SoftJitterCorrector, SoftAudioPusher threads into a daemon threads
Type:Bug
Component:client-libs
Sub-Component:javax.sound
Affected Version:OpenJDK6
Priority:P3
Status:Resolved
Resolution:Fixed
OS:generic
CPU:generic
Submitted:2008-10-13
Updated:2011-01-19
Resolved:2008-10-14
The Version table provides details related to the release that this issue/RFE will be addressed.
Unresolved : Release in which this issue/RFE will be addressed. Resolved: Release in which this issue/RFE has been resolved. Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.
The fix in question corrects a hang.
See also
http://icedtea.classpath.org/bugzilla/show_bug.cgi?id=213
Comments
SUGGESTED FIX
--- old/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Oct 13 22:01:45 2008
+++ new/src/share/classes/com/sun/media/sound/SoftAudioPusher.java Mon Oct 13 22:01:44 2008
@@ -54,6 +54,7 @@
return;
active = true;
audiothread = new Thread(this);
+ audiothread.setDaemon(true);
audiothread.setPriority(Thread.MAX_PRIORITY);
audiothread.start();
}
--- old/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Oct 13 22:01:46 2008
+++ new/src/share/classes/com/sun/media/sound/SoftJitterCorrector.java Mon Oct 13 22:01:46 2008
@@ -216,6 +216,7 @@
};
thread = new Thread(runnable);
+ thread.setDaemon(true);
thread.setPriority(Thread.MAX_PRIORITY);
thread.start();
}
--- /dev/null Mon Oct 13 22:01:48 2008
+++ new/test/javax/sound/midi/Gervill/EmergencySoundbank/TestCreateSoundbank.java Mon Oct 13 22:01:48 2008
@@ -0,0 +1,59 @@
+import java.io.File;
+
+import javax.sound.midi.Instrument;
+import javax.sound.midi.Patch;
+import javax.sound.midi.Soundbank;
+
+import com.sun.media.sound.EmergencySoundbank;
+import com.sun.media.sound.ModelInstrument;
+import com.sun.media.sound.ModelPatch;
+
+/*
+ * Copyright 2007 Sun Microsystems, Inc. All Rights Reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation. Sun designates this
+ * particular file as subject to the "Classpath" exception as provided
+ * by Sun in the LICENSE file that accompanied this code.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
+ * CA 95054 USA or visit www.sun.com if you need additional information or
+ * have any questions.
+ */
+
+/* @test
+ @summary Test EmergencySoundbank createSoundbank() method */
+
+public class TestCreateSoundbank {
+
+ public static void main(String[] args) throws Exception {
+
+ Soundbank soundbank = EmergencySoundbank.createSoundbank();
+ for (int i = 0; i < 128; i++) {
+ Patch patch = new ModelPatch(0, i, false);
+ ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch);
+ if(ins == null)
+ throw new Exception("Instrument " + i + " is missing!");
+ if(ins.getPerformers().length == 0)
+ throw new Exception("Instrument " + i + " doesn't have any performers!");
+ }
+ Patch patch = new ModelPatch(0, 0, true);
+ ModelInstrument ins = (ModelInstrument)soundbank.getInstrument(patch);
+ if(ins == null)
+ throw new Exception("Drumkit instrument is missing!");
+ if(ins.getPerformers().length == 0)
+ throw new Exception("Drumkit instrument doesn't have any performers!");
+ }
+}