From 9f0427337a2dbc0ca7db55ae7b6812b6d4680344 Mon Sep 17 00:00:00 2001 From: Jakub Skoczen Date: Tue, 10 Nov 2015 10:51:30 +0100 Subject: [PATCH] Move async result cursor to AsyncConnection --- src/main/java/org/yaz4j/AsyncConnection.java | 5 +++-- src/main/java/org/yaz4j/ResultSet.java | 1 - 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/org/yaz4j/AsyncConnection.java b/src/main/java/org/yaz4j/AsyncConnection.java index 4b72252..6bb2470 100644 --- a/src/main/java/org/yaz4j/AsyncConnection.java +++ b/src/main/java/org/yaz4j/AsyncConnection.java @@ -19,6 +19,7 @@ public class AsyncConnection extends Connection { ErrorHandler eh; //make sure error is only handled once boolean errorHandled = false; + int handledRecordOffset = 0; ErrorHandler reh; SearchHandler sh; RecordHandler rh; @@ -79,11 +80,11 @@ public class AsyncConnection extends Connection { void handleRecord() { //TODO clone the record to detach it from the result set try { - if (rh != null) rh.handle(lastResultSet.getRecord(lastResultSet.asyncRecordOffset)); + if (rh != null) rh.handle(lastResultSet.getRecord(handledRecordOffset)); } catch (ZoomException ex) { if (reh != null) reh.handle(ex); } finally { - lastResultSet.asyncRecordOffset++; + handledRecordOffset++; } } diff --git a/src/main/java/org/yaz4j/ResultSet.java b/src/main/java/org/yaz4j/ResultSet.java index 00bfe49..78642bd 100644 --- a/src/main/java/org/yaz4j/ResultSet.java +++ b/src/main/java/org/yaz4j/ResultSet.java @@ -34,7 +34,6 @@ public class ResultSet implements Iterable { private Connection conn; SWIGTYPE_p_ZOOM_resultset_p resultSet; private boolean disposed = false; - int asyncRecordOffset = 0; ResultSet(SWIGTYPE_p_ZOOM_resultset_p resultSet, Connection conn) { //do not copy anything to the java side at this point, it won't be valid -- 1.7.10.4