public class ListTableTraverserImpl extends Object implements ListTableTraverser
| Modifier and Type | Field and Description |
|---|---|
protected AtomicLong |
appendedCount
用于totalLimit控制
对于
ListTableTraverser,appendedCount表示已经完全加载的key的数量,
对于GenericTableTraverser, appendedCount表示已经加载记录数, |
protected boolean |
appending
扩展列表中
|
protected CountDownLatch |
appendingLock
同步控制
|
protected Client |
client |
protected int |
curShard |
protected TCaplusException |
err |
protected static int |
ERROR_SHARD
shardList 已全部遍历结束,但是遍历器没有停止
|
protected List<String> |
fieldNames |
protected static org.slf4j.Logger |
LOGGER |
protected long |
offset |
protected static int |
OVER
标示 shard 已遍历结束
|
protected static int |
READY
标示 shard 未开始遍历
|
protected List<Record> |
records
正在遍历的列表
|
protected List<Record> |
recordsNext
records 遍历完后, set records = recordsNext, recordsNext = null
|
protected Map<Integer,Integer> |
shardTraverserInfo |
protected static int |
STARTED
标示 shard 正在遍历中
|
protected String |
tableName |
protected long |
totalLimit |
protected long |
traversedCnt |
protected com.tencent.tcaplus.client.impl.AbstractTraverser.TraverserState |
traverserState |
protected long |
visitedCount |
| Modifier and Type | Method and Description |
|---|---|
Traverser |
addFieldsName(String... fieldsName)
批量设置需要获取的字段名
|
protected Request |
baseNextRequest(int cmd) |
protected void |
checkInit() |
protected int |
getNextShard() |
protected void |
getShardList() |
boolean |
isCompleted()
是否遍历完成
|
protected boolean |
isStopped() |
protected void |
refreshNextRequestParam(Response rsp) |
Traverser |
setTableName(String tableName)
设置所要遍历的表名
|
Traverser |
setTotalLimit(long totalLimit)
设置总共要遍历的记录数
|
Iterator<List<Record>> |
start()
以同步方式开始遍历
|
void |
startAsync(Future future)
执行异步遍历,按response进行回调,发生错误时不再获取数据,请自行处理response中的错误信息
|
void |
stop()
停止遍历,可在遍历过程中停止。调用后不再在加载新数据
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitaddFieldsName, isCompleted, setTableName, setTotalLimit, stopprotected static final int READY
protected static final int STARTED
protected static final int OVER
protected static final int ERROR_SHARD
protected static final org.slf4j.Logger LOGGER
protected Client client
protected String tableName
protected long totalLimit
protected volatile int curShard
protected long offset
protected long traversedCnt
protected volatile boolean appending
protected volatile CountDownLatch appendingLock
protected List<Record> recordsNext
protected final AtomicLong appendedCount
ListTableTraverser,appendedCount表示已经完全加载的key的数量,
对于GenericTableTraverser, appendedCount表示已经加载记录数,isCompleted()protected long visitedCount
protected volatile com.tencent.tcaplus.client.impl.AbstractTraverser.TraverserState traverserState
protected volatile TCaplusException err
public Iterator<List<Record>> start() throws TCaplusException
ListTableTraverserstart in interface ListTableTraverserTCaplusExceptionpublic void startAsync(Future future) throws TCaplusException
TraverserstartAsync in interface Traverserfuture - 用户回调方法TCaplusExceptionTraverser.startAsync(Future)protected void getShardList()
protected void refreshNextRequestParam(Response rsp)
protected Request baseNextRequest(int cmd)
public void stop()
Traverserpublic Traverser setTableName(String tableName)
TraversersetTableName in interface TraversertableName - 表名protected int getNextShard()
public Traverser addFieldsName(String... fieldsName)
TraverseraddFieldsName in interface TraverserfieldsName - 字段名列表public Traverser setTotalLimit(long totalLimit)
TraversersetTotalLimit in interface TraversertotalLimit - 总共要遍历的记录数protected boolean isStopped()
public boolean isCompleted()
TraverserisCompleted in interface Traverserprotected void checkInit()
Copyright © 2026. All rights reserved.