87 88 MidiDevice[] getDeviceCache() { return devices; } 89 void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; } 90 Info[] getInfoCache() { return infos; } 91 void setInfoCache(Info[] infos) { MidiOutDeviceProvider.infos = infos; } 92 93 94 // INNER CLASSES 95 96 /** 97 * Info class for MidiOutDevices. Adds the 98 * provider's Class to keep the provider class from being 99 * unloaded. Otherwise, at least on JDK1.1.7 and 1.1.8, 100 * the provider class can be unloaded. Then, then the provider 101 * is next invoked, the static block is executed again and a new 102 * instance of the device object is created. Even though the 103 * previous instance may still exist and be open / in use / etc., 104 * the new instance will not reflect that state... 105 */ 106 static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info { 107 private final Class providerClass; 108 109 private MidiOutDeviceInfo(int index, Class providerClass) { 110 super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index); 111 this.providerClass = providerClass; 112 } 113 114 } // class MidiOutDeviceInfo 115 116 117 // NATIVE METHODS 118 119 private static native int nGetNumDevices(); 120 private static native String nGetName(int index); 121 private static native String nGetVendor(int index); 122 private static native String nGetDescription(int index); 123 private static native String nGetVersion(int index); 124 } | 87 88 MidiDevice[] getDeviceCache() { return devices; } 89 void setDeviceCache(MidiDevice[] devices) { MidiOutDeviceProvider.devices = devices; } 90 Info[] getInfoCache() { return infos; } 91 void setInfoCache(Info[] infos) { MidiOutDeviceProvider.infos = infos; } 92 93 94 // INNER CLASSES 95 96 /** 97 * Info class for MidiOutDevices. Adds the 98 * provider's Class to keep the provider class from being 99 * unloaded. Otherwise, at least on JDK1.1.7 and 1.1.8, 100 * the provider class can be unloaded. Then, then the provider 101 * is next invoked, the static block is executed again and a new 102 * instance of the device object is created. Even though the 103 * previous instance may still exist and be open / in use / etc., 104 * the new instance will not reflect that state... 105 */ 106 static final class MidiOutDeviceInfo extends AbstractMidiDeviceProvider.Info { 107 private final Class<?> providerClass; 108 109 private MidiOutDeviceInfo(int index, Class<?> providerClass) { 110 super(nGetName(index), nGetVendor(index), nGetDescription(index), nGetVersion(index), index); 111 this.providerClass = providerClass; 112 } 113 114 } // class MidiOutDeviceInfo 115 116 117 // NATIVE METHODS 118 119 private static native int nGetNumDevices(); 120 private static native String nGetName(int index); 121 private static native String nGetVendor(int index); 122 private static native String nGetDescription(int index); 123 private static native String nGetVersion(int index); 124 } |