We have a Transformer that takes many seconds to instantiate, so we want
to create it once, clone it several times, and store the clones in a
Vector to use as a pool.
Does cloning a Transformer work like this?
From: Daniel Parker <danielaparker@sy...> - 2002-11-05 00:01:33
MessageMessage----- Original Message -----
From: David Hooker
Sent: Monday, November 04, 2002 4:29 PM
Subject: [saxon] Cloning transformers
> We have a Transformer that takes many seconds to instantiate, so we want
> to create it once, clone it several times, and store the clones in a
> Vector to use as a pool.
> Does cloning a Transformer work like this?
How are you creating the transformer?
(*) Transformer transformer =
or like this
(**) Templates templates =
Transformer transformer = templates.newTransformer();
If your code looks like (*), change it to (**) and cache the Templates
objects in a Map. The only thing that could be taking several seconds in
your case is parsing the stylesheet. You don't want to cache Transformer
objects, they are not intended to be reused and are inexpensive to create.
Get latest updates about Open Source Projects, Conferences and News.