/** * Commits the resulting deltas, notifying the server of them. * Assumes that everything in resultingDeltas is now in-order, since * even if the original stream was non-contiguous, we have requestedHistory. * Even if not, it is still safe to commit up to the fragmented point. */ private void commitAndNotifyResultingDeltas( ImmutableList.Builder<WaveletDeltaRecord> resultingDeltas, final SettableFuture<Void> futureResult) { if(!resultingDeltas.build().isEmpty()) { notifyOfDeltas(resultingDeltas.build(), ImmutableSet.<String>of()); futureResult.set(null); //Attempt to run any pending commit if(pendingCommit) { releaseWriteLock(); commit(pendingCommitVersion); acquireWriteLock(); } } else { LOG.info("No deltas in list (fetching history?), ignoring callback"); } }