2323import java .io .InterruptedIOException ;
2424import java .util .ArrayDeque ;
2525import java .util .Queue ;
26+ import org .apache .hadoop .hbase .TableName ;
2627import org .apache .hadoop .hbase .client .metrics .ScanMetrics ;
2728import org .apache .hadoop .hbase .util .FutureUtils ;
2829import org .apache .yetus .audience .InterfaceAudience ;
2930import org .slf4j .Logger ;
3031import org .slf4j .LoggerFactory ;
3132
3233/**
33- * The {@link ResultScanner} implementation for {@link AsyncTable }. It will fetch data automatically
34- * in background and cache it in memory. Typically the {@link #maxCacheSize} will be
34+ * The {@link ResultScanner} implementation for {@link RawAsyncTableImpl }. It will fetch data
35+ * automatically in background and cache it in memory. Typically, the {@link #maxCacheSize} will be
3536 * {@code 2 * scan.getMaxResultSize()}.
3637 */
3738@ InterfaceAudience .Private
3839class AsyncTableResultScanner implements ResultScanner , AdvancedScanResultConsumer {
3940
4041 private static final Logger LOG = LoggerFactory .getLogger (AsyncTableResultScanner .class );
4142
42- private final AsyncTable < AdvancedScanResultConsumer > rawTable ;
43+ private final TableName tableName ;
4344
4445 private final long maxCacheSize ;
4546
@@ -57,12 +58,10 @@ class AsyncTableResultScanner implements ResultScanner, AdvancedScanResultConsum
5758
5859 private ScanResumer resumer ;
5960
60- public AsyncTableResultScanner (AsyncTable <AdvancedScanResultConsumer > table , Scan scan ,
61- long maxCacheSize ) {
62- this .rawTable = table ;
61+ public AsyncTableResultScanner (TableName tableName , Scan scan , long maxCacheSize ) {
62+ this .tableName = tableName ;
6363 this .maxCacheSize = maxCacheSize ;
6464 this .scan = scan ;
65- table .scan (scan , this );
6665 }
6766
6867 private void addToCache (Result result ) {
@@ -72,9 +71,10 @@ private void addToCache(Result result) {
7271
7372 private void stopPrefetch (ScanController controller ) {
7473 if (LOG .isDebugEnabled ()) {
75- LOG .debug (String .format ("0x%x" , System .identityHashCode (this )) +
76- " stop prefetching when scanning " + rawTable .getName () + " as the cache size " +
77- cacheSize + " is greater than the maxCacheSize " + maxCacheSize );
74+ LOG .debug ("{} stop prefetching when scanning {} as the cache size {}" +
75+ " is greater than the maxCacheSize {}" ,
76+ String .format ("0x%x" , System .identityHashCode (this )), tableName , cacheSize ,
77+ maxCacheSize );
7878 }
7979 resumer = controller .suspend ();
8080 }
@@ -138,7 +138,7 @@ public synchronized Result next() throws IOException {
138138 return null ;
139139 }
140140 if (error != null ) {
141- FutureUtils .rethrow (error );
141+ throw FutureUtils .rethrow (error );
142142 }
143143 try {
144144 wait ();
0 commit comments