Why are providers instantiated multiple times by AudioSystem / MidiSystem?
In JDK versions up to 1.4.2, each time AudioSystem or MidiSystem needs a list of providers, it calls sun.misc.Service.providers(), which reads the configuration files, and returns an Enumeration object, than, when used, instantiates the providers (lazy instantiation). In the JDK 1.5, a cacheing mechanism was introduced. The lists of providers are instantiated completely and cached for 60 seconds. The recommended way to deal with multiple instantiations of MixerProvider and MidiDeviceProvider subclasses is is to implement some type of singleton behaviour. For instance, information gathered at instantiation could be stored in static members, and the initialisation guarded by a flag. The other types of providers (AudioFileReader, AudioFileWriter, FormatConversionProvider, MidiFileReader, MidiFileWriter, SoundbankReader) are typically so simple that the constructor is empty anyway.