Search in sources :

Example 1 with PriorityBuffer

use of org.apache.commons.collections.buffer.PriorityBuffer in project accumulo by apache.

the class MultiReader method seek.

public synchronized boolean seek(WritableComparable key) throws IOException {
    PriorityBuffer reheap = new PriorityBuffer(heap.size());
    boolean result = false;
    for (Object obj : heap) {
        Index index = (Index) obj;
        try {
            WritableComparable found = index.reader.getClosest(key, index.value, true);
            if (found != null && found.equals(key)) {
                result = true;
            }
        } catch (EOFException ex) {
        // thrown if key is beyond all data in the map
        }
        index.cached = false;
        reheap.add(index);
    }
    heap = reheap;
    return result;
}
Also used : WritableComparable(org.apache.hadoop.io.WritableComparable) EOFException(java.io.EOFException) PriorityBuffer(org.apache.commons.collections.buffer.PriorityBuffer)

Aggregations

EOFException (java.io.EOFException)1 PriorityBuffer (org.apache.commons.collections.buffer.PriorityBuffer)1 WritableComparable (org.apache.hadoop.io.WritableComparable)1