You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by tc...@apache.org on 2002/07/23 04:04:30 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/sitemap ContentAggregator.java

tcurdt      2002/07/22 19:04:30

  Modified:    src/java/org/apache/cocoon/sitemap ContentAggregator.java
  Log:
  fixed a raise condition
  
  Revision  Changes    Path
  1.8       +10 -3     xml-cocoon2/src/java/org/apache/cocoon/sitemap/ContentAggregator.java
  
  Index: ContentAggregator.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/sitemap/ContentAggregator.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ContentAggregator.java	4 Jun 2002 07:31:52 -0000	1.7
  +++ ContentAggregator.java	23 Jul 2002 02:04:30 -0000	1.8
  @@ -289,8 +289,15 @@
       public void recycle() {
           super.recycle();
           this.rootElement = null;
  -        for (Iterator i = this.parts.iterator(); i.hasNext();)
  -            this.resolver.release(((Part)i.next()).source);
  +        for(int i=0; i<this.parts.size();i++) {
  +            final Part current = (Part)this.parts.get(i);
  +            if (current.source != null) {
  +                if (getLogger().isDebugEnabled()) {
  +                    getLogger().debug("releasing " + String.valueOf(current.source));
  +                }
  +                this.resolver.release(current.source);
  +            }
  +        }
           this.parts.clear();
           this.currentElement = null;
           this.resolver = null;
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org


Re: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/sitemap ContentAggregator.java

Posted by Torsten Curdt <tc...@dff.st>.
On Tuesday 23 July 2002 05:00, Vadim Gritsenko wrote:
> > From: tcurdt@apache.org [mailto:tcurdt@apache.org]
> >
> > tcurdt      2002/07/22 19:04:30
> >
> >   Modified:    src/java/org/apache/cocoon/sitemap
>
> ContentAggregator.java
>
> >   Log:
> >   fixed a raise condition
>
> You mean race condition.

yes :)

> But, ContentAggregator is Recyclable, which means that it is Poolable,
> which means that it is allowed to be accessed by one thread only,
> *especially* in lifecycle methods (AFAIU Avalon - am I right?).

I got a NPE when trying with xerces... 

a "fixed possible NPE" would have been the right message ;-)
please bear with me it was 4:30am

> If you observe several threads in recycle() at once, it means that
> something is *really* wrong somewhere, and it is better to find reason
> of the real problem then mask its consequences.

should be fine...
--
Torsten

---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org


RE: cvs commit: xml-cocoon2/src/java/org/apache/cocoon/sitemap ContentAggregator.java

Posted by Vadim Gritsenko <va...@verizon.net>.
> From: tcurdt@apache.org [mailto:tcurdt@apache.org]
> 
> tcurdt      2002/07/22 19:04:30
> 
>   Modified:    src/java/org/apache/cocoon/sitemap
ContentAggregator.java
>   Log:
>   fixed a raise condition

You mean race condition.

But, ContentAggregator is Recyclable, which means that it is Poolable,
which means that it is allowed to be accessed by one thread only,
*especially* in lifecycle methods (AFAIU Avalon - am I right?).


If you observe several threads in recycle() at once, it means that
something is *really* wrong somewhere, and it is better to find reason
of the real problem then mask its consequences.


Vadim


> 
>   Revision  Changes    Path
>   1.8       +10 -3     xml-
> cocoon2/src/java/org/apache/cocoon/sitemap/ContentAggregator.java
> 
>   Index: ContentAggregator.java
>   ===================================================================
>   RCS file: /home/cvs/xml-
> cocoon2/src/java/org/apache/cocoon/sitemap/ContentAggregator.java,v
>   retrieving revision 1.7
>   retrieving revision 1.8
>   diff -u -r1.7 -r1.8
>   --- ContentAggregator.java	4 Jun 2002 07:31:52 -0000	1.7
>   +++ ContentAggregator.java	23 Jul 2002 02:04:30 -0000	1.8
>   @@ -289,8 +289,15 @@
>        public void recycle() {
>            super.recycle();
>            this.rootElement = null;
>   -        for (Iterator i = this.parts.iterator(); i.hasNext();)
>   -            this.resolver.release(((Part)i.next()).source);
>   +        for(int i=0; i<this.parts.size();i++) {
>   +            final Part current = (Part)this.parts.get(i);
>   +            if (current.source != null) {
>   +                if (getLogger().isDebugEnabled()) {
>   +                    getLogger().debug("releasing " +
> String.valueOf(current.source));
>   +                }
>   +                this.resolver.release(current.source);
>   +            }
>   +        }
>            this.parts.clear();
>            this.currentElement = null;
>            this.resolver = null;


---------------------------------------------------------------------
To unsubscribe, e-mail: cocoon-dev-unsubscribe@xml.apache.org
For additional commands, email: cocoon-dev-help@xml.apache.org