ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
Subject cvs commit: jakarta-ant/proposal/myrmidon/src/xdocs classloader.xml
Date Sat, 02 Mar 2002 00:55:31 GMT
donaldp     02/03/01 16:55:31

  Added:       proposal/myrmidon/src/xdocs classloader.xml
  Start to document the Containers ClassLoader
  hierarchy. Adapted terminology from Catalina
  as that terminology is more widely used.
  Punt on antlib ClassLoader structure as that
  is defined via library specific mechanisms
  Revision  Changes    Path
  1.1                  jakarta-ant/proposal/myrmidon/src/xdocs/classloader.xml
  Index: classloader.xml
  <?xml version="1.0"?>
      <title>On ClassLoaders in Ant2</title>
      <author email="">Peter Donald</author>
  <section name="ClassLoader Management">
  <p>In many ways Ant2 needs to follow rules similar to a number of 
  different application servers with respect to ClassLoader management. 
  Ant2 will create a number of different ClassLoaders that have access 
  to different sets of resources (and thus Classes). The main reason
  for this arrangment is to partition different sections of the 
  application such as the Container, the Task API, task/type libraries 
  and support libraries.</p>
  <p>The recomended structure for ClassLoader relationships is a hierarchy.
  When a ClassLoader is asked for a resource (or a class) it first delegates
  to it's parent to ask for the resource. If the resource is not present in 
  its parent ClassLoader then the ClassLoader attempts to locate the resource
  in it's own store. In practice this means that all the classes (and static 
  variables defined by said classes) in a parent ClassLoader are shared with 
  the child ClassLoaders.</p>
  <p>Using kooky ascii art, the specific ClassLoader structure for Ant2 is as 
        /      \
   Container  Shared
               /   \
          Antlib1  Antlib2 ... 
      The <strong>Bootstrap</strong> ClassLoader contains the classes and resources

      provided by the Java runtime.
      The <strong>System</strong> ClassLoader contains the classes that were made
      via the CLASSPATH environment variable. If the standard ant script was used then this

      should only contain the classes that are used to bootstrap the ant runtime. ie 
      The <strong>Common</strong> ClassLoader contains the classes and resources

      that are made visible to both the Container and to all the ant type librarys. This 
      contains all the classes that the Container uses to communicate with tasks and other
      supporting infrastructure. In particular it contains the following APIs;
          <em>Task API</em> - Contains the classes that are part of the API used
          to define tasks.
          <em>ProjectListener API</em> - Contains the classes necessary to define
          <em>Aspect API</em> - Contains the classes that are used to define Aspects

          of the container.
          <em>Container API</em> - Contains the interfaces that are required to
          with the objects deep within the container. <strong>NOTE</strong>: These
          are not to be used by user tasks but are made available so that certain tasks (such

          as &lt;antcall/&gt;) can be implemented. However they are subject to change
          notice between between different ant2 versions.
        These classes are loaded from all the jars present in the <code>$ANT_HOME/lib</code>
      The <strong>Container</strong> ClassLoader contains all the classes and
      that are part of the actual implementation of the Container. These classes are not
      directly accessible to any Ant library or task. Some of the classes are indirectly 
      accessible to tasks and other elements defined in the ant librarys as they implement

      interfaces defined in the <strong>Common</strong> ClassLoader. The classes
that are 
      stored in jars in the <code>$ANT_HOME/bin/lib/</code> directory.
      The <strong>Shared</strong> ClassLoader contains all the classes and resources
      that are shared across all of the ant librarys (unless they are als needed by the
      container in which case they should be placed int the <strong>Container</strong>

      ClassLoader). This ClassLoader is populated by all the jars that are contained in
      the <code>$ANT_HOME/shared/</code> directory.
      The <strong>AntLib</strong> ClassLoaders each contain the classes and resources
      that required by that particular library. Note that in some cases a single Ant 
      Library will manifest as a single ClassLoader containing a single jar. However 
      in some cases it is possible for one Ant Library to have multiple jars in its 
      ClassLoader or even have multiple ClassLoaders. See XXXX for further details.

To unsubscribe, e-mail:   <>
For additional commands, e-mail: <>

View raw message