cziegeler    01/09/18 06:45:14

  Modified:    src/org/apache/cocoon/sitemap Tag: cocoon_20_branch
                        Manager.java
  Log:
  Synchron sitemap generation always works now
  PR: bug #3579
  
  Revision  Changes    Path
  No                   revision
  
  
  No                   revision
  
  
  1.2.2.14  +26 -2     xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java
  
  Index: Manager.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/sitemap/Manager.java,v
  retrieving revision 1.2.2.13
  retrieving revision 1.2.2.14
  diff -u -r1.2.2.13 -r1.2.2.14
  --- Manager.java      2001/09/05 22:18:15     1.2.2.13
  +++ Manager.java      2001/09/18 13:45:14     1.2.2.14
  @@ -36,7 +36,7 @@
    * checking regeneration of the sub <code>Sitemap</code>
    *
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
  - * @version CVS $Revision: 1.2.2.13 $ $Date: 2001/09/05 22:18:15 $
  + * @version CVS $Revision: 1.2.2.14 $ $Date: 2001/09/18 13:45:14 $
    */
   public class Manager
           extends AbstractLoggable
  @@ -178,12 +178,36 @@
           final boolean reload_asynchron) throws Exception {
               Handler sitemapHandler = (Handler)sitemaps.get(source);
               if (sitemapHandler != null) {
  +                // 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() && 
!sitemapHandler.isRegenerating()) {
  +                    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.
                           if (reload_asynchron) {
  +                            if (!sitemapHandler.isRegenerating()) {
                               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 {
  +                            if (!sitemapHandler.isRegenerating()) {
  +                                synchronized (this) {
                               sitemapHandler.regenerate(environment);
  +                                }
  +                            } else {
  +                                synchronized (this) {
  +                                    // dummy statement
  +                                    this.hashCode();
  +                                }
  +                            }
                           }
                       }
                   } else {
  
  
  

----------------------------------------------------------------------
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