cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From pruss...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon ComponentFactory.java DefaultComponentManager.java
Date Sat, 02 Dec 2000 13:40:05 GMT
prussell    00/12/02 05:40:05

  Modified:    src/org/apache/cocoon Tag: xml-cocoon2 ComponentFactory.java
                        DefaultComponentManager.java
  Log:
  Added debug logging to component managment framework so we can
  make sure pooling etc is working effectively.
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.4   +10 -1     xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java
  
  Index: ComponentFactory.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/ComponentFactory.java,v
  retrieving revision 1.1.2.3
  retrieving revision 1.1.2.4
  diff -u -r1.1.2.3 -r1.1.2.4
  --- ComponentFactory.java	2000/11/26 21:48:01	1.1.2.3
  +++ ComponentFactory.java	2000/12/02 13:40:05	1.1.2.4
  @@ -17,11 +17,16 @@
   import org.apache.avalon.Composer;
   import org.apache.avalon.ThreadSafe;
   
  +import org.apache.log.Logger;
  +import org.apache.log.LogKit;
  +
   /** Factory for Cocoon components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.3 $ $Date: 2000/11/26 21:48:01 $
  + * @version CVS $Revision: 1.1.2.4 $ $Date: 2000/12/02 13:40:05 $
    */
   public class ComponentFactory implements ObjectFactory, ThreadSafe {
  +    private Logger log = LogKit.getLoggerFor("cocoon");
  +	
   	/** The class which this <code>ComponentFactory</code>
   	 * should create.
   	 */
  @@ -48,6 +53,10 @@
   
   	public Poolable newInstance() throws Exception {
   		Poolable comp = (Poolable)componentClass.newInstance();
  +
  +        log.debug("ComponentFactory creating new instance of "
  +            + componentClass.getName() + "."
  +        );
   		
   		if ( comp instanceof Configurable ) {
   			((Configurable)comp).configure(this.conf);
  
  
  
  1.1.2.7   +13 -1     xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java
  
  Index: DefaultComponentManager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/Attic/DefaultComponentManager.java,v
  retrieving revision 1.1.2.6
  retrieving revision 1.1.2.7
  diff -u -r1.1.2.6 -r1.1.2.7
  --- DefaultComponentManager.java	2000/11/30 21:40:32	1.1.2.6
  +++ DefaultComponentManager.java	2000/12/02 13:40:05	1.1.2.7
  @@ -35,7 +35,7 @@
   
   /** Default component manager for Cocoon's non sitemap components.
    * @author <a href="mailto:paul@luminas.co.uk">Paul Russell</a>
  - * @version CVS $Revision: 1.1.2.6 $ $Date: 2000/11/30 21:40:32 $
  + * @version CVS $Revision: 1.1.2.7 $ $Date: 2000/12/02 13:40:05 $
    */
   public class DefaultComponentManager implements ComponentManager {
   
  @@ -94,6 +94,7 @@
                   throw new ComponentNotFoundException("Could not find component for role
'" + role + "'.");
               } else {
                   // we found an individual instance of a component.
  +				log.debug("DefaultComponentManager returned instance for role " + role + ".");
                   return component;
               }
           }
  @@ -108,11 +109,18 @@
   
           // Work out what class of component we're dealing with.
           if ( ThreadSafe.class.isAssignableFrom(componentClass) ) {
  +			log.debug("DefaultComponentManager using threadsafe instance of " + componentClass.getName()
+ " for role " + role + ".");
               component = getThreadsafeComponent(componentClass);
           } else if ( Poolable.class.isAssignableFrom(componentClass) ) {
  +            log.debug("DefaultComponentManager using poolable instance of "
  +                + componentClass.getName() + " for role " + role + "."
  +            );
               component = getPooledComponent(componentClass);
           } else if ( SingleThreaded.class.isAssignableFrom(componentClass) ) {
               try {
  +                log.debug("DefaultComponentManager using new instance of single threaded
component "
  +                    + componentClass.getName() + "for role " + role + "."
  +                );
                   component = (Component)componentClass.newInstance();
               } catch ( InstantiationException e ) {
                   log.error("Could not create new instance of SingleThreaded " + role, e);
  @@ -133,6 +141,9 @@
                * classes, treat as normal.
                */
               try {
  +                log.debug("DefaultComponentManager using new instance of unmarked component
"
  +                    + componentClass.getName() + " for role " + role + "."
  +                );
                   component = (Component)componentClass.newInstance();
               } catch ( InstantiationException e ) {
                   log.error("Could not create new instance of class " + componentClass.getName(),
e);
  @@ -192,6 +203,7 @@
   
           if ( pool == null ) {
               try {
  +                log.debug("Creating new component pool for " + componentClass.getName()
+ ".");
                   pool = new ComponentPool(
                       new ComponentFactory(componentClass, (Configuration)configurations.get(componentClass),
this),
                       new ComponentPoolController()
  
  
  

Mime
View raw message