| | |
| | | { |
| | | private UpdateMsg currentChange = null; |
| | | private ReplServerDBCursor cursor = null; |
| | | private DbHandler dbh; |
| | | private DbHandler dbHandler; |
| | | private ReplicationDB db; |
| | | private ChangeNumber lastNonNullCurrentCN; |
| | | |
| | |
| | | DbHandler dbHandler) throws ChangelogException |
| | | { |
| | | this.db = db; |
| | | this.dbh = dbHandler; |
| | | this.dbHandler = dbHandler; |
| | | this.lastNonNullCurrentCN = changeNumber; |
| | | |
| | | try |
| | |
| | | */ |
| | | public boolean next() |
| | | { |
| | | boolean hasNext; |
| | | |
| | | currentChange = cursor.next(); // can return null |
| | | currentChange = cursor.next(); |
| | | |
| | | if (currentChange != null) |
| | | { |
| | | lastNonNullCurrentCN = currentChange.getChangeNumber(); |
| | | hasNext = true; |
| | | } |
| | | else |
| | | { |
| | |
| | | cursor.close(); |
| | | cursor = null; |
| | | } |
| | | dbh.flush(); |
| | | dbHandler.flush(); |
| | | try |
| | | { |
| | | cursor = db.openReadCursor(lastNonNullCurrentCN); |
| | |
| | | if (currentChange != null) |
| | | { |
| | | lastNonNullCurrentCN = currentChange.getChangeNumber(); |
| | | hasNext = true; |
| | | } |
| | | else |
| | | { |
| | | hasNext = false; |
| | | } |
| | | } |
| | | catch(Exception e) |
| | | { |
| | | currentChange = null; |
| | | hasNext = false; |
| | | } |
| | | } |
| | | } |
| | | return hasNext; |
| | | return currentChange != null; |
| | | } |
| | | |
| | | /** |
| | |
| | | cursor.close(); |
| | | cursor = null; |
| | | } |
| | | this.dbh = null; |
| | | this.dbHandler = null; |
| | | this.db = null; |
| | | } |
| | | } |