Source:
public void beginWindow(long windowId) { currentWindowId = windowId; isReplayed = false; if (currentWindowId <= windowManager.getLargestRecoveryWindow()) { try { replay(currentWindowId); } catch (SQLException e) { LOG.error("Exception in replayed windows"); throw new RuntimeException("saving recovery", e); } } if (isReplayed && currentWindowId == windowManager.getLargestRecoveryWindow()) { try { if (!isPollable && rangeQueryPair.getValue() != null) { ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildGTRangeQuery(getTableName(), getKey(), previousUpperBound, rangeQueryPair.getValue()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); } else { String bound = null; if (previousUpperBound == null) { bound = getRangeQueryPair().getKey(); } else { bound = previousUpperBound; } ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), bound), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); isPollable = true; } isReplayed = false; LOG.debug("Prepared statement after re-initialization - " + ps.toString()); } catch (SQLException e) { throw new RuntimeException(e); } } if (isPollable) { try { String bound = null; if (previousUpperBound == null && highestPolled == null) { bound = getRangeQueryPair().getKey(); } else { bound = highestPolled; } ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), bound), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); LOG.debug("Polling query " + ps.toString() + "," + currentWindowId); isPolled = false; } catch (SQLException e) { throw new RuntimeException(e); } } lower = null; upper = null; if (dbPoller == null && !isReplayed) { LOG.info("Statement when re-initialized" + ps.toString()); dbPoller = new Thread(new DBPoller()); dbPoller.start(); } }

Target:
public void beginWindow(long windowId) { currentWindowId = windowId; isReplayed = false; if (currentWindowId <= windowManager.getLargestRecoveryWindow()) { try { replay(currentWindowId); } catch (SQLException e) { LOG.error("Exception in replayed windows", e); throw new RuntimeException(e); } } if (isReplayed && currentWindowId == windowManager.getLargestRecoveryWindow()) { try { if (!isPollable && rangeQueryPair.getValue() != null) { ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildGTRangeQuery(getTableName(), getKey(), previousUpperBound, rangeQueryPair.getValue()), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); } else { String bound = null; if (previousUpperBound == null) { bound = getRangeQueryPair().getKey(); } else { bound = previousUpperBound; } ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), bound), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); isPollable = true; } isReplayed = false; LOG.debug("Prepared statement after re-initialization - ", ps.toString()); } catch (SQLException e) { throw new RuntimeException(e); } } if (isPollable) { try { String bound = null; if (previousUpperBound == null && highestPolled == null) { bound = getRangeQueryPair().getKey(); } else { bound = highestPolled; } ps = store.getConnection().prepareStatement( JdbcMetaDataUtility.buildPollableQuery(getTableName(), getKey(), bound), java.sql.ResultSet.TYPE_FORWARD_ONLY, java.sql.ResultSet.CONCUR_READ_ONLY); LOG.debug("Polling query {}", ps.toString(), currentWindowId); isPolled = false; } catch (SQLException e) { throw new RuntimeException(e); } } lower = null; upper = null; if (dbPoller == null && !isReplayed) { LOG.info("Statement when re-initialized {}", ps.toString()); dbPoller = new Thread(new DBPoller()); dbPoller.start(); } }