public class MultithreadedItemMappingIterator<F extends Item<?>,T extends Item<?>> extends ItemMappingIterator<F,T>
ATOMIZING, GROUNDED, LAST_POSITION_FINDER, LOOKAHEAD
Constructor and Description |
---|
MultithreadedItemMappingIterator(SequenceIterator<F> base,
ItemMappingFunction<F,T> action) |
Modifier and Type | Method and Description |
---|---|
void |
close()
The user of a
SequenceIterator is encouraged to call the close() method if
no further items are required from the sequence of items delivered by the SequenceIterator . |
protected int |
getMaxThreads()
Overridable method that decides how many threads to use.
|
protected java.util.concurrent.ExecutorService |
makeExecutorService(int maxThreads)
Overridable method to create an
ExecutorService with a given concurrency |
T |
next()
Get the next item in the sequence.
|
getBaseIterator, getLength, getMappingFunction, getProperties, hasNext, isOneToOne, setOneToOne
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEachOrFail, materialize
public MultithreadedItemMappingIterator(SequenceIterator<F> base, ItemMappingFunction<F,T> action) throws XPathException
XPathException
protected int getMaxThreads()
Runtime.getRuntime().availableProcessors()
, or 1 if greater.protected java.util.concurrent.ExecutorService makeExecutorService(int maxThreads)
ExecutorService
with a given concurrencymaxThreads
- the maximum number of threads to be usedExecutorService
public T next() throws XPathException
SequenceIterator
next
in interface SequenceIterator<T extends Item<?>>
next
in class ItemMappingIterator<F extends Item<?>,T extends Item<?>>
XPathException
- if an error occurs retrieving the next itempublic void close()
SequenceIterator
is encouraged to call the close()
method if
no further items are required from the sequence of items delivered by the SequenceIterator
.
This allows resources to be released. A SequenceIterator
is NOT normally closed explicitly
if it has been read to completion. This implementation of the close()
method shuts down
the ExecutorService
used to schedule threads.close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
close
in interface SequenceIterator<T extends Item<?>>
close
in class ItemMappingIterator<F extends Item<?>,T extends Item<?>>
Copyright (c) 2004-2020 Saxonica Limited. All rights reserved.