Class ConcurrentGrouper<KeyType>

  • All Implemented Interfaces:
    Closeable, AutoCloseable, Grouper<KeyType>

    public class ConcurrentGrouper<KeyType>
    extends Object
    implements Grouper<KeyType>
    Grouper based around a set of underlying SpillingGrouper instances. Thread-safe.

    The passed-in buffer is cut up into concurrencyHint slices, and each slice is passed to a different underlying grouper. Access to each slice is separately synchronized. As long as the result set fits in memory, keys are partitioned between buffers based on their hash, and multiple threads can write into the same buffer. When it becomes clear that the result set does not fit in memory, the table switches to a mode where each thread gets its own buffer and its own spill files on disk.