1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19 package org.apache.hadoop.hbase.regionserver.handler;
20
21 import java.io.IOException;
22 import java.util.concurrent.CountDownLatch;
23
24 import org.apache.commons.logging.Log;
25 import org.apache.commons.logging.LogFactory;
26 import org.apache.hadoop.hbase.classification.InterfaceAudience;
27 import org.apache.hadoop.hbase.Cell;
28 import org.apache.hadoop.hbase.executor.EventHandler;
29 import org.apache.hadoop.hbase.executor.EventType;
30 import org.apache.hadoop.hbase.regionserver.KeyValueScanner;
31
32
33
34
35 @InterfaceAudience.Private
36 public class ParallelSeekHandler extends EventHandler {
37 private static final Log LOG = LogFactory.getLog(ParallelSeekHandler.class);
38 private KeyValueScanner scanner;
39 private Cell keyValue;
40 private long readPoint;
41 private CountDownLatch latch;
42 private Throwable err = null;
43
44 public ParallelSeekHandler(KeyValueScanner scanner,Cell keyValue,
45 long readPoint, CountDownLatch latch) {
46 super(null, EventType.RS_PARALLEL_SEEK);
47 this.scanner = scanner;
48 this.keyValue = keyValue;
49 this.readPoint = readPoint;
50 this.latch = latch;
51 }
52
53 @Override
54 public void process() {
55 try {
56 scanner.seek(keyValue);
57 } catch (IOException e) {
58 LOG.error("", e);
59 setErr(e);
60 } finally {
61 latch.countDown();
62 }
63 }
64
65 public Throwable getErr() {
66 return err;
67 }
68
69 public void setErr(Throwable err) {
70 this.err = err;
71 }
72 }