Java 类org.apache.hadoop.hbase.regionserver.handler.ParallelSeekHandler 实例源码

项目:ditb    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 *
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv       the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner> scanners, final Cell kv)
    throws IOException {
  if (scanners.isEmpty()) return;
  int storeFileScannerCount = scanners.size();
  CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
  List<ParallelSeekHandler> handlers = new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
  for (KeyValueScanner scanner : scanners) {
    if (scanner instanceof StoreFileScanner) {
      ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv, this.readPt, latch);
      executor.submit(seekHandler);
      handlers.add(seekHandler);
    } else {
      scanner.seek(kv);
      latch.countDown();
    }
  }

  try {
    latch.await();
  } catch (InterruptedException ie) {
    throw (InterruptedIOException) new InterruptedIOException().initCause(ie);
  }

  for (ParallelSeekHandler handler : handlers) {
    if (handler.getErr() != null) {
      throw new IOException(handler.getErr());
    }
  }
}
项目:pbase    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner>
                                  scanners, final Cell kv) throws IOException {
    if (scanners.isEmpty()) return;
    int storeFileScannerCount = scanners.size();
    CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
    List<ParallelSeekHandler> handlers =
            new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
    for (KeyValueScanner scanner : scanners) {
        if (scanner instanceof StoreFileScanner) {
            ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
                    this.readPt, latch);
            executor.submit(seekHandler);
            handlers.add(seekHandler);
        } else {
            scanner.seek(kv);
            latch.countDown();
        }
    }

    try {
        latch.await();
    } catch (InterruptedException ie) {
        throw (InterruptedIOException) new InterruptedIOException().initCause(ie);
    }

    for (ParallelSeekHandler handler : handlers) {
        if (handler.getErr() != null) {
            throw new IOException(handler.getErr());
        }
    }
}
项目:HIndex    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner>
    scanners, final KeyValue kv) throws IOException {
  if (scanners.isEmpty()) return;
  int storeFileScannerCount = scanners.size();
  CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
  List<ParallelSeekHandler> handlers = 
      new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
  for (KeyValueScanner scanner : scanners) {
    if (scanner instanceof StoreFileScanner) {
      ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
        this.readPt, latch);
      executor.submit(seekHandler);
      handlers.add(seekHandler);
    } else {
      scanner.seek(kv);
      latch.countDown();
    }
  }

  try {
    latch.await();
  } catch (InterruptedException ie) {
    throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
  }

  for (ParallelSeekHandler handler : handlers) {
    if (handler.getErr() != null) {
      throw new IOException(handler.getErr());
    }
  }
}
项目:hbase    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner>
    scanners, final Cell kv) throws IOException {
  if (scanners.isEmpty()) return;
  int storeFileScannerCount = scanners.size();
  CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
  List<ParallelSeekHandler> handlers = new ArrayList<>(storeFileScannerCount);
  for (KeyValueScanner scanner : scanners) {
    if (scanner instanceof StoreFileScanner) {
      ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
        this.readPt, latch);
      executor.submit(seekHandler);
      handlers.add(seekHandler);
    } else {
      scanner.seek(kv);
      latch.countDown();
    }
  }

  try {
    latch.await();
  } catch (InterruptedException ie) {
    throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
  }

  for (ParallelSeekHandler handler : handlers) {
    if (handler.getErr() != null) {
      throw new IOException(handler.getErr());
    }
  }
}
项目:PyroDB    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner>
    scanners, final Cell kv) throws IOException {
  if (scanners.isEmpty()) return;
  int storeFileScannerCount = scanners.size();
  CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
  List<ParallelSeekHandler> handlers = 
      new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
  for (KeyValueScanner scanner : scanners) {
    if (scanner instanceof StoreFileScanner) {
      ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
        this.readPt, latch);
      executor.submit(seekHandler);
      handlers.add(seekHandler);
    } else {
      scanner.seek(kv);
      latch.countDown();
    }
  }

  try {
    latch.await();
  } catch (InterruptedException ie) {
    throw (InterruptedIOException)new InterruptedIOException().initCause(ie);
  }

  for (ParallelSeekHandler handler : handlers) {
    if (handler.getErr() != null) {
      throw new IOException(handler.getErr());
    }
  }
}
项目:c5    文件:StoreScanner.java   
/**
 * Seek storefiles in parallel to optimize IO latency as much as possible
 * @param scanners the list {@link KeyValueScanner}s to be read from
 * @param kv the KeyValue on which the operation is being requested
 * @throws IOException
 */
private void parallelSeek(final List<? extends KeyValueScanner>
    scanners, final KeyValue kv) throws IOException {
  if (scanners.isEmpty()) return;
  int storeFileScannerCount = scanners.size();
  CountDownLatch latch = new CountDownLatch(storeFileScannerCount);
  List<ParallelSeekHandler> handlers = 
      new ArrayList<ParallelSeekHandler>(storeFileScannerCount);
  for (KeyValueScanner scanner : scanners) {
    if (scanner instanceof StoreFileScanner) {
      ParallelSeekHandler seekHandler = new ParallelSeekHandler(scanner, kv,
        MultiVersionConsistencyControl.getThreadReadPoint(), latch);
      executor.submit(seekHandler);
      handlers.add(seekHandler);
    } else {
      scanner.seek(kv);
      latch.countDown();
    }
  }

  try {
    latch.await();
  } catch (InterruptedException ie) {
    throw new InterruptedIOException(ie.getMessage());
  }

  for (ParallelSeekHandler handler : handlers) {
    if (handler.getErr() != null) {
      throw new IOException(handler.getErr());
    }
  }
}