diff --git a/.idea/misc.xml b/.idea/misc.xml
index 24c5625..ca1f05e 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -3,9 +3,6 @@
-
-
-
diff --git a/src/com/skey/evehbase/client/EveHBase.java b/src/com/skey/evehbase/client/EveHBase.java
index 279dba8..cc6492c 100644
--- a/src/com/skey/evehbase/client/EveHBase.java
+++ b/src/com/skey/evehbase/client/EveHBase.java
@@ -248,12 +248,9 @@ public List scan(@Nonnull EveScan eveScan, @Nonnull Class clazz) throw
// 提交scan请求
scanner = table.getScanner(eveScan.getScan());
- int i = 0;
- long max = eveScan.getMax();
Result r;
- while ((r = scanner.next()) != null && i <= max) {
+ while ((r = scanner.next()) != null ) {
results.add(r);
- i++;
}
if (LOG.isInfoEnabled()) LOG.info("Column value filter successfully.");
diff --git a/src/com/skey/evehbase/request/EveScan.java b/src/com/skey/evehbase/request/EveScan.java
index fc14807..3a14861 100644
--- a/src/com/skey/evehbase/request/EveScan.java
+++ b/src/com/skey/evehbase/request/EveScan.java
@@ -19,12 +19,10 @@ public class EveScan {
private final Scan scan;
- private final long max;
- EveScan(TableName tableName, Scan scan, long max) {
+ EveScan(TableName tableName, Scan scan) {
this.tableName = tableName;
this.scan = scan;
- this.max = max;
}
public TableName getTableName() {
@@ -35,10 +33,6 @@ public Scan getScan() {
return scan;
}
- public long getMax() {
- return max;
- }
-
public static class Builder {
private String table;
diff --git a/src/com/skey/evehbase/request/EveScanDirector.java b/src/com/skey/evehbase/request/EveScanDirector.java
index 447a3a4..77058ae 100644
--- a/src/com/skey/evehbase/request/EveScanDirector.java
+++ b/src/com/skey/evehbase/request/EveScanDirector.java
@@ -37,9 +37,9 @@ static EveScan create(String table, String startRow, String endRow,
TableName tableName = TableName.valueOf(table);
- Scan scan = generateScan(columnMap, startRow, endRow, filter);
+ Scan scan = generateScan(columnMap, startRow, endRow, filter, max);
- return new EveScan(tableName, scan, max);
+ return new EveScan(tableName, scan);
}
/**
@@ -49,11 +49,14 @@ static EveScan create(String table, String startRow, String endRow,
* @param startRow HBase的startRowKey
* @param endRow HBase的endRowKey
* @param filter HBase的过滤器 {@link Filter}
+ * @param max 结果最大返回条数
* @return {@link Scan}
*/
- private static Scan generateScan(Map> columnMap, String startRow, String endRow, Filter filter) {
+ private static Scan generateScan(Map> columnMap, String startRow, String endRow, Filter filter, long max) {
Scan scan = new Scan();
+ scan.setMaxResultSize(max);
+
// 添加要查询的列
for (Map.Entry> entry : columnMap.entrySet()) {
byte[] bFamily = Bytes.toBytes(entry.getKey());