hiveAPI + HbaseAPI 使用多线程,报错

private static ResultSet rs1 = null;
rs1 = statement.executeQuery(sql1);
new Thread(new Runnable() {
public void run() {
try {
while(rs1.next()){
if (rs1.getInt("machine_sk")%3 == 1) {
System.out.println(rs1.getInt("machine_sk"));
}

                                错误报告:
                                1

org.apache.thrift.TApplicationException: FetchResults failed: out of sequence response
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:76)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_FetchResults(TCLIService.java:501)
at org.apache.hive.service.cli.thrift.TCLIService$Client.FetchResults(TCLIService.java:488)
at org.apache.hive.jdbc.HiveQueryResultSet.next(HiveQueryResultSet.java:360)
at hhh.mis.App$1.run(App.java:81)
at java.lang.Thread.run(Thread.java:748)
java.sql.SQLException: Error retrieving next row
at org.apache.hive.jdbc.HiveQueryResultSet.next(HiveQueryResultSet.java:388)
at hhh.mis.App$1.run(App.java:81)
at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.thrift.TApplicationException: FetchResults failed: out of sequence response
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:76)
at org.apache.hive.service.cli.thrift.TCLIService$Client.recv_FetchResults(TCLIService.java:501)
at org.apache.hive.service.cli.thrift.TCLIService$Client.FetchResults(TCLIService.java:488)
at org.apache.hive.jdbc.HiveQueryResultSet.next(HiveQueryResultSet.java:360)
... 2 more
就输出了一条数据就报错了,无序化。。。
求大神指教。。。

https://zhidao.baidu.com/question/555125689.html

我弄好了,把while(rs.next())放到外面就好了,再while里面创建线程,不过这样会导致数据不同步,因为线程启动是异步的,
所以,最好还是新建一个线程类,去调用,这样就完全ojbk了。。。