cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/components/language/generator ProgramGeneratorImpl.java
Date Fri, 16 Feb 2001 16:29:28 GMT
bloritsch    01/02/16 08:29:26

  Modified:    src/org/apache/cocoon/components/language/generator Tag:
                        xml-cocoon2 ProgramGeneratorImpl.java
  Log:
  Provide an Early release on ProgramGenerator
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.1.2.28  +32 -31    xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java
  
  Index: ProgramGeneratorImpl.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/components/language/generator/Attic/ProgramGeneratorImpl.java,v
  retrieving revision 1.1.2.27
  retrieving revision 1.1.2.28
  diff -u -r1.1.2.27 -r1.1.2.28
  --- ProgramGeneratorImpl.java	2001/02/16 16:21:38	1.1.2.27
  +++ ProgramGeneratorImpl.java	2001/02/16 16:29:21	1.1.2.28
  @@ -45,7 +45,7 @@
   /**
    * The default implementation of <code>ProgramGenerator</code>
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version CVS $Revision: 1.1.2.27 $ $Date: 2001/02/16 16:21:38 $
  + * @version CVS $Revision: 1.1.2.28 $ $Date: 2001/02/16 16:29:21 $
    */
   public class ProgramGeneratorImpl extends AbstractLoggable implements ProgramGenerator,
Contextualizable, Composer, Configurable, ThreadSafe {
   
  @@ -141,32 +141,32 @@
               // Ensure no 2 requests for the same file overlap
               Class program = null;
               CompiledComponent programInstance = null;
  -            synchronized(filename.intern()) {
  -                // Attempt to load program object from cache
  +
  +            // Attempt to load program object from cache
  +            try {
  +                programInstance = (CompiledComponent) this.cache.select(filename);
  +                if (this.autoReload == false) return programInstance;
  +            } catch (Exception e) {
  +                getLogger().debug("The instance was not accessible, creating it now.");
                   try {
  -                    programInstance = (CompiledComponent) this.cache.select(filename);
  -                } catch (Exception e) {
  -                    getLogger().debug("The instance was not accessible, creating it now.");
  -                    try {
  -                        if (programInstance == null) {
  -                          /*
  -                             FIXME: Passing null as encoding may result in invalid
  -                             recompilation under certain circumstances!
  -                          */
  -
  -                            program = programmingLanguage.load(normalizedName, this.workDir,
null);
  -                            // Store loaded program in cache
  -                            this.cache.addGenerator(filename, program);
  -                        }
  -                        // Instantiate program
  -                        programInstance = programmingLanguage.instantiate(program);
  -                        if (programInstance instanceof Loggable) {
  -                            ((Loggable)programInstance).setLogger(getLogger());
  -                        }
  -                        programInstance.compose(this.manager);
  -                    } catch (LanguageException le) {
  -                        getLogger().debug("Language Exception", le);
  +                    if (programInstance == null) {
  +                      /*
  +                         FIXME: Passing null as encoding may result in invalid
  +                         recompilation under certain circumstances!
  +                      */
  +
  +                        program = programmingLanguage.load(normalizedName, this.workDir,
null);
  +                        // Store loaded program in cache
  +                        this.cache.addGenerator(filename, program);
                       }
  +                    // Instantiate program
  +                    programInstance = programmingLanguage.instantiate(program);
  +                    if (programInstance instanceof Loggable) {
  +                        ((Loggable)programInstance).setLogger(getLogger());
  +                    }
  +                    programInstance.compose(this.manager);
  +                } catch (LanguageException le) {
  +                    getLogger().debug("Language Exception", le);
                   }
   
                 /*
  @@ -174,13 +174,14 @@
                    be queried for changes!!!
                 */
   
  -                if (this.autoReload && programInstance != null && programInstance.modifiedSince(file.lastModified()))
{
  -                        // Unload program
  -                        programmingLanguage.unload(program, normalizedName, this.workDir);
  -                        // Invalidate previous program/instance pair
  -                        program = null;
  -                        programInstance = null;
  +                if (programInstance != null && programInstance.modifiedSince(file.lastModified()))
{
  +                    // Unload program
  +                    programmingLanguage.unload(program, normalizedName, this.workDir);
  +                    // Invalidate previous program/instance pair
  +                    program = null;
  +                    programInstance = null;
                   }
  +
                   if (program == null) {
                       // Generate code
                       String code = markupLanguage.generateCode(
  
  
  

Mime
View raw message