cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Vadim Gritsenko" <vadim.gritse...@verizon.net>
Subject RE: NPE in URLSource under high load
Date Mon, 04 Feb 2002 16:43:58 GMT
> From: Chris Newland [mailto:chris.newland@emorphia.com]
> 
> Hi All,
> 
> I'm encountering a null pointer exception in the
> org.apache.cocoon.components.source.URLSource file when I run a stress
test
> of my Cocoon 2 system:
> 
> java.lang.NullPointerException
> 	at
>
org.apache.cocoon.components.source.URLSource.getInfos(URLSource.java:95
)
> 	at
>
org.apache.cocoon.components.source.URLSource.getLastModified(URLSource.
java
> :110)
> 	at org.apache.cocoon.Cocoon.modifiedSince(Cocoon.java:376)
> 	at
 
<snip>
 
> Looking at the code makes me think this might be a
threading/synchronization
> bug as IMHO 'this.connection' is null and should have thrown the NPE
on the
> previous line.

It *is* threading bug. URLSource is not intended to be used by multiple
threads simultaneously. However, Cocoon.java uses it exactly this way.


> I'll do my best to trace the problem's origin but I'm out of the
country for
> 3 weeks as of tomorrow.

The quick (==bad performance) fix will be to surround call with
synchronized:

    public boolean modifiedSince(long date) {
        synchronized(this.configurationFile) {
            this.configurationFile.refresh();
            return date < this.configurationFile.getLastModified();
        }
    }

The better solution is to use ActiveMonitor. There was a discussion
about it but I do not remember the results of it.

Regards,
Vadim


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


Mime
View raw message