vgritsenko    02/01/24 19:49:57

  Modified:    src/java/org/apache/cocoon/sitemap Handler.java Manager.java
                        SitemapManager.java
  Log:
  formatting
  
  Revision  Changes    Path
  1.4       +5 -6      xml-cocoon2/src/java/org/apache/cocoon/sitemap/Handler.java
  
  Index: Handler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Handler.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- Handler.java      19 Jan 2002 00:49:49 -0000      1.3
  +++ Handler.java      25 Jan 2002 03:49:57 -0000      1.4
  @@ -42,7 +42,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2002/01/19 00:49:49 $
  + * @version CVS $Revision: 1.4 $ $Date: 2002/01/25 03:49:57 $
    */
   public class Handler extends AbstractLoggable
   implements Runnable, Contextualizable, Composable, Processor, Disposable, 
SourceResolver {
  @@ -133,8 +133,12 @@
           SourceHandler oldSourceHandler = environment.getSourceHandler();
           try {
               environment.setSourceHandler(this.sourceHandler);
  +
  +            if (this.source != null) this.source.recycle();
               this.source = new DelayedRefreshSourceWrapper(
                   environment.resolve(this.sourceFileName), this.sitemapCheckDelay);
  +
  +            if (this.contextSource != null) this.contextSource.recycle();
               this.contextSource = environment.resolve("");
           } finally {
               environment.setSourceHandler(oldSourceHandler);
  @@ -144,20 +148,16 @@
               regeneration = new Thread(this);
   
               /* HACK for reducing class loader problems. */
  -
               /* example: xalan extensions fail if someone adds xalan jars in 
tomcat3.2.1/lib */
  -
               try {
                   
regeneration.setContextClassLoader(Thread.currentThread().getContextClassLoader());
               } catch (Exception e) {
               }
   
               /* clear old exception if any */
  -
               this.exception = null;
   
               /* start the thread */
  -
               regeneration.start();
           }
       }
  @@ -298,5 +298,4 @@
                                                   
.append(":").append(systemId).toString());
           return this.sourceHandler.getSource(null, context, systemId);
       }
  -
   }
  
  
  
  1.3       +14 -29    xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/Manager.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- Manager.java      19 Jan 2002 00:50:44 -0000      1.2
  +++ Manager.java      25 Jan 2002 03:49:57 -0000      1.3
  @@ -35,7 +35,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
  - * @version CVS $Revision: 1.2 $ $Date: 2002/01/19 00:50:44 $
  + * @version CVS $Revision: 1.3 $ $Date: 2002/01/25 03:49:57 $
    */
   public class Manager
           extends AbstractLoggable
  @@ -170,52 +170,37 @@
           return false;
       }
   
  -    /**
  -     * make sure the uri_prefix ends with a slash
  -     *
  -     * NOTE: Together 5 marks this as unused.  If verified, we need to remove it.
  -     */
  -    /*
  -    private String getPrefix(String uri_prefix) {
  -        if (uri_prefix.length() > 0) {
  -            return ((uri_prefix.charAt(uri_prefix.length() - 1) == '/') ? 
uri_prefix : uri_prefix + "/");
  -        } else {
  -            return uri_prefix;
  -        }
  -    }
  -    */
  -
       private Handler getHandler(final ComponentManager newManager, final Environment 
environment, final String source, final boolean check_reload,
           final boolean reload_asynchron) throws Exception {
               Handler sitemapHandler = (Handler)sitemaps.get(source);
               if (sitemapHandler != null) {
  -                // the following is a little bit complicated:
  +                // The following is a little bit complicated:
                   // If the sitemap handler is not available, it is regenerated
                   // If it is available:
                   //    The handler is only queried if it has changed if
                   //    the check_reload flag is true
                   if (sitemapHandler.available()) {
                       if (check_reload && sitemapHandler.hasChanged()) {
  -                        // the sitemap has changed.
  -                        // In asynchron mode the first request entering this
  -                        // starts the regeneration. All other request comming
  -                        // in, use the old sitemap until the new is generated.
  +                        // The sitemap has been changed.
                           if (reload_asynchron) {
  +                            // In asynchron mode the first request entering this
  +                            // starts the regeneration. All other request comming
  +                            // in, use the old sitemap until the new is generated.
                               if (!sitemapHandler.isRegenerating()) {
  -                            sitemapHandler.regenerateAsynchronously(environment);
  +                                
sitemapHandler.regenerateAsynchronously(environment);
                               }
  -                        // In synchron mode the first request starts the
  -                        // regeneration, all other requests are blocked
  -                        // until the regeneration is finished. This is done
  -                        // by the synchronized statement
                           } else {
  +                            // In synchron mode the first request starts the
  +                            // regeneration, all other requests are blocked
  +                            // until the regeneration is finished. This is done
  +                            // by the synchronized statement
                               if (!sitemapHandler.isRegenerating()) {
                                   synchronized (this) {
  -                            sitemapHandler.regenerate(environment);
  +                                    sitemapHandler.regenerate(environment);
                                   }
                               } else {
                                   synchronized (this) {
  -                                    // dummy statement
  +                                    // Dummy statement
                                       this.hashCode();
                                   }
                               }
  @@ -225,7 +210,7 @@
                       sitemapHandler.regenerate(environment);
                   }
               } else {
  -                // also this looks a little bit strange, it should work
  +                // Also this looks a little bit strange, it should work
                   // if no handler is available, the generation of the new
                   // handler is synchronized.
                   // The first incoming request creates the handler and blocks
  
  
  
  1.4       +2 -2      
xml-cocoon2/src/java/org/apache/cocoon/sitemap/SitemapManager.java
  
  Index: SitemapManager.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/SitemapManager.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- SitemapManager.java       22 Jan 2002 00:17:13 -0000      1.3
  +++ SitemapManager.java       25 Jan 2002 03:49:57 -0000      1.4
  @@ -38,7 +38,7 @@
    * to Java code.
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Sylvain Wallez</a>
  - * @version CVS $Revision: 1.3 $ $Date: 2002/01/22 00:17:13 $
  + * @version CVS $Revision: 1.4 $ $Date: 2002/01/25 03:49:57 $
    */
   public class SitemapManager extends Manager implements Processor, Configurable {
       
  @@ -92,7 +92,7 @@
               getLogger().error("Could not configure Cocoon environment", e);
               throw new ConfigurationException("Error trying to load configurations", 
e);
           } finally {
  -            this.manager.release(p);
  +            if (p != null) this.manager.release(p);
           }
       
           DefaultRoleManager sitemapRoleManager = new DefaultRoleManager();
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to