[XSL-LIST Mailing List Archive Home] [By Thread] [By Date] [Recent Entries] [Reply To This Message] Re: Wide Finder in XSLT --> deriving new requirements
On 10/11/2007, Michael Kay <mike@xxxxxxxxxxxx> wrote: > and allocate the processing of the items in the input sequence to the N > threads in a round-robin fashion. the challenge being of course how to > marshal the output of the N threads, stitching it back together as a > sequence in the right order, without using a lot of extra memory and > creating a lot of extra coordination overhead. The ideal would be that if > the input sequence is streamed, the output sequence should be streamed too. Streaming aside (because I've no idea about what that involves), but just in case you weren't aware..... In Java 5 you can create FutureTask's which implement "Callable" (like Runnable but allows a parameterized return type) which you can give to a fixed size thread pool ExecutorService... you can maintain the order in an ordered collection, and then just call get() on each one in turn to construct the output in the right order. The ExecutorService takes care of managing the thread pool, Callable allows a return type so you don't have to mess around there, and get() blocks until complete so again you don't have to worry about managing that. Hopefully thats helpful, cheers -- Andrew Welch http://andrewjwelch.com Kernow: http://kernowforsaxon.sf.net/
|
PURCHASE STYLUS STUDIO ONLINE TODAY!Purchasing Stylus Studio from our online shop is Easy, Secure and Value Priced! Download The World's Best XML IDE!Accelerate XML development with our award-winning XML IDE - Download a free trial today! Subscribe in XML format
|