You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@kylin.apache.org by li...@apache.org on 2016/12/26 12:39:44 UTC
[5/7] kylin git commit: close OLAPEnumerator at exception
close OLAPEnumerator at exception
Project: http://git-wip-us.apache.org/repos/asf/kylin/repo
Commit: http://git-wip-us.apache.org/repos/asf/kylin/commit/aff694e3
Tree: http://git-wip-us.apache.org/repos/asf/kylin/tree/aff694e3
Diff: http://git-wip-us.apache.org/repos/asf/kylin/diff/aff694e3
Branch: refs/heads/mhb-master
Commit: aff694e30ce50f6d3e3d92b3bcb8c5e7869b3ce3
Parents: 1a1534f
Author: Hongbin Ma <ma...@apache.org>
Authored: Sat Dec 24 18:19:02 2016 +0800
Committer: Hongbin Ma <ma...@apache.org>
Committed: Mon Dec 26 20:12:57 2016 +0800
----------------------------------------------------------------------
.../kylin/query/enumerator/OLAPEnumerator.java | 32 +++++++++++++-------
1 file changed, 21 insertions(+), 11 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/kylin/blob/aff694e3/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
----------------------------------------------------------------------
diff --git a/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java b/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
index c7b3c71..408d227 100644
--- a/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
+++ b/query/src/main/java/org/apache/kylin/query/enumerator/OLAPEnumerator.java
@@ -61,20 +61,30 @@ public class OLAPEnumerator implements Enumerator<Object[]> {
@Override
public boolean moveNext() {
- if (cursor == null) {
- cursor = queryStorage();
- }
+ try {
+ if (cursor == null) {
+ cursor = queryStorage();
+ }
- if (!cursor.hasNext()) {
- return false;
- }
+ if (!cursor.hasNext()) {
+ return false;
+ }
- ITuple tuple = cursor.next();
- if (tuple == null) {
- return false;
+ ITuple tuple = cursor.next();
+ if (tuple == null) {
+ return false;
+ }
+ convertCurrentRow(tuple);
+ return true;
+ } finally {
+ try {
+ if (cursor != null) {
+ cursor.close();
+ }
+ } catch (Exception e) {
+ logger.info("Error when closing cursor, ignore it", e);
+ }
}
- convertCurrentRow(tuple);
- return true;
}
private Object[] convertCurrentRow(ITuple tuple) {