Heads Up :
The post you are writing will appear in a public forum. Please ensure all content is appropriate for public consumption. Review the employee guidelines for the community here.
Created by: null on 24-09-2004 01:01:40 PM Is there any detailed documentation on how the classloaders work? I have looked through all the documentation, but need more detail. For instance:
-what is the difference in the way classes are loaded from util versus from application?
-Are there any explicit load locations that will load a package even if it exists in a lower classloader?
-How many classloaders are there in an application?
Thanks, Paul
Subject: RE: ClassLoaders Replied by: null on 27-09-2004 03:52:09 PM Hi Paul,
Page 35 in the Programmers Guide (Audium 3.3) goes into classloaders briefly in explaining how elements are affected by classloaders. The Audium documentation does not talk in more detail about how classloaders work, I would suggest a good Java tutorial on classloaders (there are quite a few good ones online). I will attempt to answer your individual questions here:
As mentioned in the Programmers Guide, the Audium classloader loads all classes in java/application folder and includes the java/util folder into its CLASSPATH. That is the difference between the two folders - anything in a Java CLASSPATH is loaded as needed where content in the java/application folder is explicitly loaded.
No, there are no locations you can place Java files that will reload a class that has already been loaded - Java classloaders just don't work that way. If a class is already loaded, it will not load it again. The only way to reload the class is to create a new classloader (which the Audium updateApp and updateCommonClasses scripts do). So you should architect your system so that the same class is not found in both the Audium common folder as well as the java/application folder of an application. If it is, its no big deal, the class in the common folder would be loaded first and the one in the applicaton would not be loaded.
There is only one classloader per Audium application.
Here is a quick description of the classloaders that are involved in a typical Audium installation. There is nothing a developer can do to change this as it is specified in Java and the application servers. This following list will go in the order of creation (each one being the parent classloader of the one that follows):
1) The JVM has its own classloader or classloaders. 2) The application server has its own classloader or classloaders. This is, for example, where Apache Tomcat loads from its common folder. 3) Each web application has its own classloader. The Audium Server, since it is a web application, therefore gets its own classloader. 4) Audium itself creates a new classloader and loads from its common folder. 5) Audium creates a separate classloader for each Audium application. This loads the java/application content. This is the classloader that will be used by developers when they write custom code for Audium.
Find answers to your questions by entering keywords or phrases in the Search bar above. New here? Use these resources to familiarize yourself with the community: