xmlgraphics-batik-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Joe <i...@objectleague.com>
Subject PNGTranscoder: reuse, multithreading
Date Tue, 13 Nov 2007 13:37:38 GMT
Hi all,

I am trying to embed the PNGTranscoder into a servlet
and have the following problem:

I have different threads working on the same document
and simultaneously requesting a png file for a
specific area of interest.

The first approach instantiated a PNGTranscoder instance for every thread.
This is a problematic approach because of high memory usage for
preparing the PNGTranscoder instance.
I am aware of that, but what I do not understand is why I get
strange exceptions that hint a multithreading issue deep down
under the hood of the ImageTranscoder.
This seems to be related to the Batik CSS engine and looks like so:

Exception:java.lang.NullPointerException
java.lang.NullPointerException
at org.apache.batik.css.parser.Parser.nextIgnoreSpaces
at org.apache.batik.css.parser.Parser.parseTerm
at org.apache.batik.css.parser.Parser.parseExpression
at org.apache.batik.css.parser.Parser.parsePropertyValueInternal
at org.apache.batik.css.parser.Parser.parsePropertyValue
at org.apache.batik.css.engine.CSSEngine.getCascadedStyleMap
at org.apache.batik.css.engine.CSSEngine.getComputedStyle
at org.apache.batik.bridge.CSSUtilities.getComputedStyle
at org.apache.batik.bridge.CSSUtilities.convertDisplay
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
at org.apache.batik.bridge.GVTBuilder.buildComposite
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
at org.apache.batik.bridge.GVTBuilder.buildComposite
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
at org.apache.batik.bridge.GVTBuilder.buildComposite
at org.apache.batik.bridge.GVTBuilder.buildGraphicsNode
at org.apache.batik.bridge.GVTBuilder.buildComposite
at org.apache.batik.bridge.GVTBuilder.build
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode
at org.apache.batik.transcoder.image.ImageTranscoder.transcode
at org.apache.batik.transcoder.XMLAbstractTranscoder.transcode
at org.apache.batik.transcoder.SVGAbstractTranscoder.transcode

Does anybody have an explanation for this behavior?


An alternative approach would be to reuse the PNGTranscoder
instance (after setting it up for a specific document)

The thing is I do not know if ImageTranscoder instances are prepared
for this and I guess the odds for making one PNGTranscoder instance
work with multiple threads w/o synchronizing don't look good given
the exception above.

I guess the big question here is how to integrate an ImageTranscoder
instance(s) into a servlet environment in order to achieve
maximum troughput for image generation for the same/different
document(s). 

Eventually I would like to have a couple of threads generate an image for
document A and another thread group generate images for document B all
concurrently with minumum memory overhead and execution speeds.

Thankful for any input on this,
Joe 


---------------------------------------------------------------------
To unsubscribe, e-mail: batik-users-unsubscribe@xmlgraphics.apache.org
For additional commands, e-mail: batik-users-help@xmlgraphics.apache.org


Mime
View raw message