You are viewing a plain text version of this content. The canonical link for it is here.
Posted to fop-users@xmlgraphics.apache.org by David Gerdt <Dg...@bju.edu> on 2008/06/05 00:22:17 UTC

Multithreading and PCL

According to the website documentation on multithreading:
 
"There is also a known issue with fonts being jumbled between threads when using the Java2D/AWT renderer (which is used by the -awt and -print output options). In general, you cannot safely run multiple threads through the AWT renderer."
 
Three questions:
1. Am I correct in my cursory observation that this is also true for the PCL renderer?
 
2. If it is the case that the PCL renderer also suffers, can someone elaborate on the cause of these problems? A high level, very basic understanding is all I'm curious for. I'm definitely inexperienced with thread related programming, but from what I gather, the AWT java classes are thread safe, correct? Am I making an illogical jump from reading "AWT renderer" in the FOP docs and assuming that the problem has something to do with the AWT classes in Java?
 
3. Any general pointers on how to use multithreading profitably with the PCL renderer? Right now, the app I wrote (standalone socket server) is multithreaded but synchronizes access to the Transformer class which seems to solve my problem from #1 but basically makes it a single thread program again.
 
Thanks for any insight.

Re: Multithreading and PCL

Posted by fabien v <f....@laposte.net>.
The right bug link is : 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6611637 
http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6611637  


-- 
View this message in context: http://www.nabble.com/Multithreading-and-PCL-tp17658051p18870154.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Multithreading and PCL

Posted by fabien v <f....@laposte.net>.
Hello David,

I have faced the same problem and made multiple investigations.
Here are the 3 steps that seem to fix the multithreading issues with FOP /
PCL :

(1) Fix a bug in sun.font.GlyphLayout, see 
bugs.sun.com/bugdatabase/view_bug.do?bug_id=6367148
bugs.sun.com/bugdatabase/view_bug.do?bug_id=6367148  (using the endorsed
mechanism).

(2) The first FOP warnings appear in the fop layout manager. To avoid this,
I use the fop intermediate format (see 
http://xmlgraphics.apache.org/fop/0.94/intermediate.html
http://xmlgraphics.apache.org/fop/0.94/intermediate.html ). So the
generation sequence is : XSLFO => FOP AREA TREE => FOP PCL.

(3) Then some texts have a wrong place on the generated page. Setting a lock
mechanism in org.apache.fop.render.pcl.PCLRenderer class on the
renderSpace() method have fixed the problem. I don't know exactly why, but
it seems that some resources used by this method have thread-unsafe
operations.

Pfieeewww =^D ! Perhaps someone will have the courage to make further
investigations. No matter what, FOP is really a great tool =) !

Fabien


David Gerdt wrote:
> 
> According to the website documentation on multithreading:
>  
> "There is also a known issue with fonts being jumbled between threads when
> using the Java2D/AWT renderer (which is used by the -awt and -print output
> options). In general, you cannot safely run multiple threads through the
> AWT renderer."
>  
> Three questions:
> 1. Am I correct in my cursory observation that this is also true for the
> PCL renderer?
>  
> 2. If it is the case that the PCL renderer also suffers, can someone
> elaborate on the cause of these problems? A high level, very basic
> understanding is all I'm curious for. I'm definitely inexperienced with
> thread related programming, but from what I gather, the AWT java classes
> are thread safe, correct? Am I making an illogical jump from reading "AWT
> renderer" in the FOP docs and assuming that the problem has something to
> do with the AWT classes in Java?
>  
> 3. Any general pointers on how to use multithreading profitably with the
> PCL renderer? Right now, the app I wrote (standalone socket server) is
> multithreaded but synchronizes access to the Transformer class which seems
> to solve my problem from #1 but basically makes it a single thread program
> again.
>  
> Thanks for any insight.
> 
> 

-- 
View this message in context: http://www.nabble.com/Multithreading-and-PCL-tp17658051p18870089.html
Sent from the FOP - Users mailing list archive at Nabble.com.


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


Re: Multithreading and PCL

Posted by Jeremias Maerki <de...@jeremias-maerki.ch>.
On 05.06.2008 00:22:17 David Gerdt wrote:
> According to the website documentation on multithreading:
>  
> "There is also a known issue with fonts being jumbled between threads
> when using the Java2D/AWT renderer (which is used by the -awt and
> -print output options). In general, you cannot safely run multiple threads
> through the AWT renderer."
>  
> Three questions:
> 1. Am I correct in my cursory observation that this is also true for
> the PCL renderer?

Possibly, as the PCL renderer uses AWT to handle non-standard fonts.

> 2. If it is the case that the PCL renderer also suffers, can someone
> elaborate on the cause of these problems? A high level, very basic
> understanding is all I'm curious for. I'm definitely inexperienced with
> thread related programming, but from what I gather, the AWT java
> classes are thread safe, correct? 

That's what they say, yes. But I'm not 100% sure that applies to the
Java2D infrastructure which is part of AWT (Graphics2D, Font etc.). I
have never done any multi-threading tests on the Java2D-based renderers
myself (I only regularly check PDF and PS).

> Am I making an illogical jump from reading
> "AWT renderer" in the FOP docs and assuming that the problem has
> something to do with the AWT classes in Java?

Not necessarily. I can't tell with 100% confidence that any
multi-threading problems in our Java2D-based renderer cannot come from
bugs in FOP (i.e. our misusing the AWT/Java2D classes).

> 3. Any general pointers on how to use multithreading profitably with
> the PCL renderer? Right now, the app I wrote (standalone socket server) is
> multithreaded but synchronizes access to the Transformer class which
> seems to solve my problem from #1 but basically makes it a single
> thread program again.

Not really. I guess, if you experience any problems in this area, some
debugging may be necessary. Rereading the Javadocs for the AWT classes
in use will also be a good idea. The whole thing might require a full
code review.

> Thanks for any insight.

HTH


Jeremias Maerki


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