Question related to the transform (xslt) interceptor

11 views
Skip to first unread message

mats....@yahoo.com

unread,
May 21, 2017, 3:36:14 PM5/21/17
to membrane-monitor
Hi,

Was just glancing at the source code for the xslt transform interceptor, and wondering about the way the implementation deals with concurrency. 

Other implementations I have seen uses Templates objects to perform thread-safe transformations with precompiled stylesheets.

Is there a reason why this class is not leveraged in the mentioned implementation?

/ Mats


Tobias Polley

unread,
May 28, 2017, 3:10:30 AM5/28/17
to membrane-monitor
Hi Mats,


Was just glancing at the source code for the xslt transform interceptor, and wondering about the way the implementation deals with concurrency. 

the class service-proxy\core\src\main\java\com\predic8\membrane\core\interceptor\xslt\XSLTTransformer.java has a ArrayBlockingQueue<Transformer> with a bunch of non-thread-safe Transformers in there.

Every time a thread needs to do a XSLT transformation, it take()s a Transformer from the queue (potentially blocking until one becomes available), does the transformation, and put()s the Transformer back into the queue.
 
Other implementations I have seen uses Templates objects to perform thread-safe transformations with precompiled stylesheets.

Is there a reason why this class is not leveraged in the mentioned implementation?

No. We include several libraries into Membrane Service Proxy (XSLT Transformation, Groovy Scripts, etc). Whenever the instances are not thread-safe, we use the pattern described above.

Best
Tobias
Reply all
Reply to author
Forward
0 new messages