Project

Profile

Help

XQuery callback from Java extension (threads)

Added by Anonymous about 16 years ago

Legacy ID: #4926399 Legacy Poster: Chapman Flack (jcflack)

Hi, I would like to write a Java extension function that will accept a prepared expression to use as a callback. The Java code will supply the context item and $p1..$p9 parameters when making the callback. I would like the callback expression to have the caller's defined functions in scope. (saxon:expression arranges that, right?) It seems likely that I could get a start on this by imitating the code for saxon:sort. That code doesn't pass anything for $p1 .. $p9, but I think I see how to do that. Here's the question: the Java extension function will be invoking the callback from another thread. Are there environment pieces (like Controller, whose docs say it's not thread-safe) that I will need to clone or recreate in order to stay out of trouble? And what is the right way to do that so that the necessary static context for the prepared expression is preserved? Thanks, Chapman Flack


Replies (1)

RE: XQuery callback from Java extension (thre - Added by Anonymous about 16 years ago

Legacy ID: #4928794 Legacy Poster: Michael Kay (mhkay)

I'm afraid you're largely on your own here: you'll have to work out what works and what doesn't from looking at the source code. Generally the Controller and the XPathContext, as well as transient classes like a Receiver, are written on the assumption that they will only exist in a single thread, and if you use them in multiple threads then you will have to be very careful to understand what you are doing.

    (1-1/1)

    Please register to reply