Re: Using multiple instances of Saxon processors

My knee jerk reaction is don't do it.
Once you go singleton you can't go back.
Callers could still make your class a singleton but I have been bit hard by libraries that make the assumption that they are the only center of the world 

Sent from my iPad (excuse the terseness) 
David A Lee
dlee@calldei.com


> On Dec 14, 2013, at 11:13 AM, "Norman Walsh" <ndw@nwalsh.com> wrote:
> 
> Hi,
> 
> In the architecture of XML Calabash V2, there's a different API.
> There's an XProcEngine (name's kind of awful but whatever) that
> contains the Saxon processor and other "global" configuration data.
> You obtain a pipeline compiler and runtime from the engine.
> 
> I am sorely tempted to make the engine a singleton. The only drawback
> that I can see is that it wouldn't then be possible to write a program
> that ran multiple pipelines with different Saxon configurations (Saxon
> HE and EE, for example) or with different implementations of the same
> step.
> 
> The advantage is API simplification. Everywhere that the Saxon
> processor or some other bit of global configuration is needed, it has
> to be passed around either as part of the constructor for an object or
> as a parameter to static methods because there's no way other way to
> get at it. With a singleton engine object, it would always be
> available.
> 
> Most users would never notice, but I know some folks have used the XML
> Calabash APIs to build larger systems.
> 
> Anyone feel like pushing back on the singleton idea?
> 
>                                        Be seeing you,
>                                          norm
> 
> -- 
> Norman Walsh
> Lead Engineer
> MarkLogic Corporation
> Phone: +1 512 761 6676
> www.marklogic.com

Received on Saturday, 14 December 2013 17:01:01 UTC