public class AsynchronousPartialSorter<E> extends UnilateralSortMerger<E>
AsynchronousPartialSorter is a simple sort implementation that sorts
bulks inside its buffers, and returns them directly, without merging them. Therefore,
it establishes an order within certain windows, but not across them.UnilateralSortMerger.ChannelWithBlockCount, UnilateralSortMerger.CircularElement<E>, UnilateralSortMerger.CircularQueues<E>, UnilateralSortMerger.InputDataCollector<E>, UnilateralSortMerger.ReadingThread<E>, UnilateralSortMerger.SortingThread<E>, UnilateralSortMerger.SpillingThread, UnilateralSortMerger.ThreadBase<E>closed, iterator, iteratorException, iteratorLock, MAX_NUM_WRITE_BUFFERS, memoryManager, MIN_NUM_SORT_MEM_SEGMENTS, MIN_NUM_WRITE_BUFFERS, sortReadMemory, writeMemory| Constructor and Description |
|---|
AsynchronousPartialSorter(MemoryManager memoryManager,
MutableObjectIterator<E> input,
AbstractInvokable parentTask,
TypeSerializerFactory<E> serializerFactory,
TypeComparator<E> comparator,
double memoryFraction) |
| Modifier and Type | Method and Description |
|---|---|
void |
close()
Shuts down all the threads initiated by this sort/merger.
|
protected UnilateralSortMerger.ThreadBase<E> |
getSpillingThread(ExceptionHandler<IOException> exceptionHandler,
UnilateralSortMerger.CircularQueues<E> queues,
AbstractInvokable parentTask,
MemoryManager memoryManager,
IOManager ioManager,
TypeSerializerFactory<E> serializerFactory,
TypeComparator<E> comparator,
List<MemorySegment> sortReadMemory,
List<MemorySegment> writeMemory,
int maxFileHandles) |
endMarker, getIterator, getReadingThread, getSortingThread, setResultIterator, setResultIteratorException, spillingMarker, startThreadspublic AsynchronousPartialSorter(MemoryManager memoryManager, MutableObjectIterator<E> input, AbstractInvokable parentTask, TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator, double memoryFraction) throws IOException, MemoryAllocationException
memoryManager - The memory manager from which to allocate the memory.input - The input that is sorted by this sorter.parentTask - The parent task, which owns all resources used by this sorter.serializerFactory - The type serializer.comparator - The type comparator establishing the order relation.memoryFraction - The fraction of memory dedicated to sorting.IOException - Thrown, if an error occurs initializing the resources for external sorting.MemoryAllocationException - Thrown, if not enough memory can be obtained from the memory manager to
perform the sort.public void close()
UnilateralSortMergerThe threads are set to exit directly, but depending on their operation, it may take a while to actually happen. The sorting thread will for example not finish before the current batch is sorted. This method attempts to wait for the working thread to exit. If it is however interrupted, the method exits immediately and is not guaranteed how long the threads continue to exist and occupy resources afterwards.
close in interface Closeableclose in interface AutoCloseableclose in class UnilateralSortMerger<E>Closeable.close()protected UnilateralSortMerger.ThreadBase<E> getSpillingThread(ExceptionHandler<IOException> exceptionHandler, UnilateralSortMerger.CircularQueues<E> queues, AbstractInvokable parentTask, MemoryManager memoryManager, IOManager ioManager, TypeSerializerFactory<E> serializerFactory, TypeComparator<E> comparator, List<MemorySegment> sortReadMemory, List<MemorySegment> writeMemory, int maxFileHandles)
getSpillingThread in class UnilateralSortMerger<E>Copyright © 2014 The Apache Software Foundation. All rights reserved.