public class MergeSortBuffer<S extends Storable> extends java.util.AbstractCollection<S> implements SortBuffer<S>
The following system properties can be set to change the default performance characteristics of the merge sort. Each property name must be prefixed with "com.amazon.carbonado.cursor.MergeSortBuffer."
Property Default Notes
------------------- ---------- ----------------------------------------------
maxArrayCapacity 8192 Larger value greatly improves performance, but
more memory is used for each running sort.
maxOpenFileCount 100 Larger value may reduce the amount of file
merges, but there is an increased risk of
running out of file descriptors.
outputBufferSize 10000 Larger value may improve performance of file
writing, but not by much.
tmpdir Merge sort files by default are placed in the
Java temp directory. Override to place them
somewhere else.
SortedCursor| Constructor and Description |
|---|
MergeSortBuffer() |
MergeSortBuffer(Query.Controller controller) |
MergeSortBuffer(Storage<S> storage) |
MergeSortBuffer(Storage<S> storage,
Query.Controller controller) |
MergeSortBuffer(Storage<S> storage,
java.lang.String tempDir) |
MergeSortBuffer(Storage<S> storage,
java.lang.String tempDir,
int maxArrayCapacity) |
MergeSortBuffer(Storage<S> storage,
java.lang.String tempDir,
int maxArrayCapacity,
Query.Controller controller) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
add(S storable) |
void |
clear() |
void |
close()
Clear and close buffer.
|
java.util.Iterator<S> |
iterator() |
void |
prepare(java.util.Comparator<S> comparator)
Clears buffer and assigns a comparator for sorting.
|
int |
size() |
void |
sort()
Finish sorting buffer.
|
addAll, contains, containsAll, isEmpty, remove, removeAll, retainAll, toArray, toArray, toStringpublic MergeSortBuffer()
public MergeSortBuffer(Query.Controller controller)
controller - optional controller which can abort query operationpublic MergeSortBuffer(Storage<S> storage)
storage - storage for elements; if null use first Storable to
prepare reloaded Storablespublic MergeSortBuffer(Storage<S> storage, Query.Controller controller)
storage - storage for elements; if null use first Storable to
prepare reloaded Storablescontroller - optional controller which can abort query operationpublic MergeSortBuffer(Storage<S> storage, java.lang.String tempDir)
storage - storage for elements; if null use first Storable to
prepare reloaded StorablestempDir - directory to store temp files for merging, or null for defaultpublic MergeSortBuffer(Storage<S> storage, java.lang.String tempDir, int maxArrayCapacity)
storage - storage for elements; if null use first Storable to
prepare reloaded StorablestempDir - directory to store temp files for merging, or null for defaultmaxArrayCapacity - maximum amount of storables to keep in an array
before serializing to a filejava.lang.IllegalArgumentException - if storage is nullpublic MergeSortBuffer(Storage<S> storage, java.lang.String tempDir, int maxArrayCapacity, Query.Controller controller)
storage - storage for elements; if null use first Storable to
prepare reloaded StorablestempDir - directory to store temp files for merging, or null for defaultmaxArrayCapacity - maximum amount of storables to keep in an array
before serializing to a filecontroller - optional controller which can abort query operationjava.lang.IllegalArgumentException - if storage is nullpublic void prepare(java.util.Comparator<S> comparator)
SortBufferprepare in interface SortBuffer<S extends Storable>public boolean add(S storable)
public int size()
public java.util.Iterator<S> iterator()
public void clear()
public void sort()
SortBuffersort in interface SortBuffer<S extends Storable>public void close()
SortBufferclose in interface SortBuffer<S extends Storable>Copyright © 2006-2013 Amazon Technologies, Inc.. All Rights Reserved.