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 Nicolas Baumann <ni...@free.fr> on 2007/09/12 12:24:53 UTC

FOP instanciation

Hello,

I'm using FOP 0.93.

I've tried to isolate the instanciation part (the newFop method) from the 
transformation part, but when I try to reuse the instance, I get this :

"FOTreeBuilder (and the Fop class) cannot be reused. Please instantiate a new 
instance."

Why does the newFOP method takes so long the first time that it has to timeout ?
Can't this instance be created once as the server loads ?

Thanks,
Nicolas


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


Re: FOP instanciation

Posted by Andreas L Delmelle <a_...@pandora.be>.
On Sep 12, 2007, at 12:24, Nicolas Baumann wrote:

Hi

> I'm using FOP 0.93.
>
> I've tried to isolate the instanciation part (the newFop method)  
> from the
> transformation part, but when I try to reuse the instance, I get  
> this :
>
> "FOTreeBuilder (and the Fop class) cannot be reused. Please  
> instantiate a new
> instance."

Because the Fop and FOTreeBuilder instances contain references to  
information that is specific to one particular rendering run.
The FopFactory and FOUserAgent, on the other hand, are there to make  
sure that most info that can be re-used will also be re-used (like  
font information for all the renderers, for example, or the image cache)

> Why does the newFOP method takes so long the first time that it has  
> to timeout ?

Do you have any evidence that this is specific to FOP? As far as I  
know, this phenomenon is quite common: the first time a particular  
method is called, there may be referenced classes that still need to  
be loaded, for instance. Depends a bit on the JVM, but it's not  
something I would be worried about.

> Can't this instance be created once as the server loads ?

That would be a no, but if I interpret you correctly, then it only  
takes a long time the /first/ time, and so, running that method only  
once would save you very little in overhead. As a possible route for  
improving performance, you may want to take a look at instantiating  
the FopFactory only once, as the server loads (if that is not the  
case, yet). That should be enough to make sure that all but the very  
first call to FopFactory.newFop() run quicker.


HTH! If not, just yell for more info.

Cheers

Andreas


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