Hey Fabien-
I must have missed your message when you posted to the list. I actually just 
happened to find it a few days ago while looking through the archives.
 
Thanks for the tips. Unfortunately I still experienced problems after 
implementing your suggestions. I was not getting the NPEs mentioned in the bug 
for sun.font.GlyphLayout, so I didn't attempt to fix that. I'm running IBM's 
Java 1.4.2 on AIX, so perhaps that makes the difference. (I did, however, 
experience NPE problems with sun.awt.font.AdvanceCache.get. I was able to work 
around those.)
 
Even after making org.apache.fop.render.pcl.PCLRenderer.renderSpace a 
synchronized method I am still getting incorrect spacing at times and the wrong 
typeface at other times.
 
Thanks for the investigation though!
 
Dave
 
 
>>>>>>>>>>>>>>>>>>>>>>>>
 
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: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL 
PROTECTED] 

Reply via email to