Source:
<code>private void flush() { Set<String> oldActive = new HashSet<>(activeKeyOrder); Range effectiveRequested; final Range previousActive = Range.withLength(activeStart, activeKeyOrder.size()); if (definedSize && (resendEntireRange || sizeReset)) { assumedSize = getDataProviderSize(); } else if (!definedSize && (!skipCountIncreaseUntilReset || sizeReset)) { updateUndefinedSize(); } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); resendEntireRange |= !(previousActive.intersects(effectiveRequested) || (previousActive.isEmpty() && effectiveRequested.isEmpty())); Activation activation = collectKeysToFlush(previousActive, effectiveRequested); if (activation.isSizeRecheckNeeded()) { if (definedSize) { assumedSize = getDataProviderSize(); } else { assumedSize = requestedRange.getStart() + activation.getActiveKeys().size(); skipCountIncreaseUntilReset = true; <START> if (assumedSize != 0 && activation.getActiveKeys().size() == 0) { <END> int delta = requestedRange.length(); requestedRange = requestedRange.offsetBy(-delta); requestFlush(true); return; } } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); } activeKeyOrder = activation.getActiveKeys(); activeStart = effectiveRequested.getStart(); Update update = arrayUpdater.startUpdate(assumedSize); boolean updated = collectChangesToSend(previousActive, effectiveRequested, update); resendEntireRange = false; assumeEmptyClient = false; sizeReset = false; passivateInactiveKeys(oldActive, update, updated); unregisterPassivatedKeys(); fireItemCountEvent(assumedSize); }</code><technical_language>this break connector behaviour? tested grid manually changes? a bit worry fact connector send requested range server, server sends data another request range (which is shifted server). Is a some kind of optimisation avoid redundant client-servers interactions</technical_language>

Target:
private void flush() { Set<String> oldActive = new HashSet<>(activeKeyOrder); Range effectiveRequested; final Range previousActive = Range.withLength(activeStart, activeKeyOrder.size()); if (definedSize && (resendEntireRange || sizeReset)) { assumedSize = getDataProviderSize(); } else if (!definedSize && (!skipCountIncreaseUntilReset || sizeReset)) { updateUndefinedSize(); } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); resendEntireRange |= !(previousActive.intersects(effectiveRequested) || (previousActive.isEmpty() && effectiveRequested.isEmpty())); Activation activation = collectKeysToFlush(previousActive, effectiveRequested); if (activation.isSizeRecheckNeeded()) { if (definedSize) { assumedSize = getDataProviderSize(); } else { assumedSize = requestedRange.getStart() + activation.getActiveKeys().size(); skipCountIncreaseUntilReset = true; if (assumedSize != 0 && activation.getActiveKeys().isEmpty()) { int delta = requestedRange.length(); requestedRange = requestedRange.offsetBy(-delta); requestFlush(true); return; } } effectiveRequested = requestedRange .restrictTo(Range.withLength(0, assumedSize)); } activeKeyOrder = activation.getActiveKeys(); activeStart = effectiveRequested.getStart(); Update update = arrayUpdater.startUpdate(assumedSize); boolean updated = collectChangesToSend(previousActive, effectiveRequested, update); resendEntireRange = false; assumeEmptyClient = false; sizeReset = false; passivateInactiveKeys(oldActive, update, updated); unregisterPassivatedKeys(); fireItemCountEvent(assumedSize); }