RE: Antwort: Re: Antwort: Fop and multithreading.

2003-02-11 Thread frederic . kieffer
Like Reto, EJBs have been chosen to be strategic technology in my company.
Having tested Fop in Servlets I designed (generating pdf an opening it in
the client's browser) causes no problem ; 
in this case, the renderer I use is the PDF one.
But when I want to print directly (using the printer configured on the unix
box), I render the output through a class which extends AWTRenderer
which, and as Reto said, is not thread safe, because of the classe it uses.
So I was able to reproduce the issues outside EJBs.
I will try to write a testCase that reproduces the problems too.

Thanks.
Frédéric

-Message d'origine-
De: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
Date: lundi 10 février 2003 16:16
À: [EMAIL PROTECTED]
Objet: Antwort: Re: Antwort: Fop and multithreading.



Hi Jeremias,

I do agree very much with you about the concerns on EJB usage, though
unfortunately drop the EJB idea is not an option.
EJB is the chosen environment in this company (my client). Since XSL:FO has
also been chosen as strategic technology, we are bound to find a way for
the two to coexist.  Having a special service for the rendering may be an
option, but in the end this comes down to the same issues than doing it
inside the EJB using seperate ThreadPools, JMS and the like, this is a
long-discussed topic in EJB lists...

It seems obvious that you have not noticed the problems we see, because the
issue is most probably in AWTRenderer and its use of AWT classes
(java.awt.Font, java.awt.FontMetrics, java.awt.graphics).

Your suggestion is a good way forward: I will try write a TestCase that
reproduces the problems outside EJB and we see how we can go on from there.

Is the testcase you used in november available as a starter?

merci,
Reto


___

CSS Versicherung
Reto Blunschi EXTERNE
Rösslimattstrasse 40
CH-6002 Luzern
Telefon  ++41 (0)41 369 1236
Telefax  ++41 (0)41 369 1212
[EMAIL PROTECTED]
www.css.ch




Jeremias Maerki [EMAIL PROTECTED] on 10.02.2003 14:08:11

Bitte antworten an [EMAIL PROTECTED]

An:  [EMAIL PROTECTED]
Kopie:

Thema:   Re: Antwort: Fop and multithreading.

Frédéric and Reto,

having read the 24.1.2 Programming restrictions of the EJB 2.0
specification, I'd recommend you guys don't call FOP from an EJB. The
programming restrictions forbid among other things the following:
- Reading or writing of static variables (FOP still does this too often)
- Use of thread synchronization primitives (FOP does that mostly because
  of the static variables)
- Use of AWT functionality
- Use of java.io package to access files (which obviously happens as
  well)

So the singleton may also be a bad idea. I recommend you don't use FOP
within EJBs. Use a Servlet, a WebService or a custom-built server
service instead.

I've done some serious debugging of multithreading issues last November
by writing a test application that uses FOP in a multi-threaded fashion
(PDF only, no AWT). I haven't had the symptoms you describe so I can
only imagine it has to do with the enviroment (EJBs). Of course, it
could be that my test application was suboptimal, so maybe you two can
come up with a test application that triggers your symptoms outside an
EJB server. That would help track the error down. If you can't reproduce
the bug outside the EJB server I recommend you drop the EJB idea.

You can find the spec mentioned above here:
http://java.sun.com/products/ejb/docs.html#specs

Good luck!


On 10.02.2003 13:00:56 frederic.kieffer wrote:
 Thanks for your help.
 In addition, I'm in the same kind of situation as you are (multiprocessor
 Unix box, executing FOP in a Message Driven EJB on JBoss).
 I designed a singleton class which is used by this ejb each time a
message
 is being consumed.
 I'm going to try to synchronize its methods. Maybe this will help.


Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]









-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Antwort: Re: Antwort: Fop and multithreading.

2003-02-11 Thread Jeremias Maerki
Ok, I've put together a ZIP and put it under the URL below:
http://cvs.apache.org/~jeremias/FOPMTTestbed.zip

I hope you don't mind that it's heavily relying on Avalon (especially
Fortress). I've put all the necessary JARs in the lib directory. I
didn't include fop.jar and batik.jar which you can take from your local
FOP. I've also done a little Ant build.xml to make it easy to have some
fast results. You just have to adjust the FOP location in build.xml to
your local environment so it compiles.

To configure the whole thing look at FOPTestbed.xconf. There you can
specify the number of concurrent threads, which files to transform etc.

And finally, to test multithreading with the AWT Renderer just change
FOProcessorImpl.java accordingly. It currently generates PDF.

If you have questions, fire away. Happy debugging!

On 10.02.2003 16:50:18 Jeremias Maerki wrote:
  Is the testcase you used in november available as a starter?
 
 I have it here. Just give me a little time to get it running again (I've
 got to check if it's still compatible with the latest Avalon Fortress
 version. I'll post a URL when I'm finished.



Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Antwort: Re: Antwort: Fop and multithreading.

2003-02-10 Thread Jeremias Maerki

On 10.02.2003 16:15:48 reto.blunschi wrote:
 I do agree very much with you about the concerns on EJB usage, though
 unfortunately drop the EJB idea is not an option.
 EJB is the chosen environment in this company (my client). Since XSL:FO has
 also been chosen as strategic technology, we are bound to find a way for
 the two to coexist.  Having a special service for the rendering may be an
 option, but in the end this comes down to the same issues than doing it
 inside the EJB using seperate ThreadPools, JMS and the like, this is a
 long-discussed topic in EJB lists...

I know CSS (the company, not the style thingy) makes use of CORBA
services. Maybe you could wrap FOP as a CORBA service and call that one
from your MDB. But I think the Servlet idea could be a good approach
because you'll most likely have servlet support in your J2EE container.
That could save you a lot of trouble and is easy to implement.

 It seems obvious that you have not noticed the problems we see, because the
 issue is most probably in AWTRenderer and its use of AWT classes
 (java.awt.Font, java.awt.FontMetrics, java.awt.graphics).

I've just now realized that you guys don't talk about the PDF renderer
at all. Frédéric probably got it wrong to say he was producing PDF in
his first mail. 

 Your suggestion is a good way forward: I will try write a TestCase that
 reproduces the problems outside EJB and we see how we can go on from there.
 
 Is the testcase you used in november available as a starter?

I have it here. Just give me a little time to get it running again (I've
got to check if it's still compatible with the latest Avalon Fortress
version. I'll post a URL when I'm finished.

Jeremias Maerki


-
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]