Re: Calabash: cache the compiled pipeline

Op 17-11-2010 13:57, Florent Georges schreef:
> On 17 November 2010 10:37, Edwin de Jong wrote:
>
>> When a request comes in, a (synchronized) flyweight object is returned,
>> possibly cached pipelines are found or a pipeline is compiled and
>> subsequently executed.
>    Interesting.  That's what I am trying to do.  But what kind of
> objects are you caching in the pool?
>
I chose a wrapper class, wrapping com.xmlcalabash.core.XProcRuntime, 
adding references to the cached pipelines (XPipeline objects). 
Subclassing XProcRuntime would have been an option, but I don't like 
implementation inheritance, as I try to avoid a future break when 
Calabash updates the implementation. To create new XProcRuntimes and 
configure them, I added an XProcRuntimeBuilder as a parameter to the 
pool (thus it functions as a Factory as well). Perhaps separating these 
concerns would have been called for, but time is sometimes a constraint.

So, basically, the seperation of concerns is: WebApp -> Pool 
(initialized with builder) -> XProcRuntimeWrapper -> XProcRuntime and 
(0..*) XPipeline

Then, WebApp calls pool asking for a XProcRuntimeWrapper, an XPipeline 
(possibly cached), WebApp executes pipeline in runtime.

Please note that when you create a Saxon document from the request, you 
need to wrap it with the same DocumentBuilder as is defined in the 
XProcRuntime (which makes it a bit awkward).


Met vriendelijke groet,

Edwin de Jong


Exxellence Group | www.exxellence.nl
Bezoekadres: Welbergweg 80-84 | 7556 PE Hengelo (ov.)
Postadres: Postbus 768 | 7550 AT Hengelo (ov.)
Tel. +31 (74) 25 94 008 | fax. +31 (74) 25 66 424

Received on Wednesday, 17 November 2010 13:13:11 UTC