Source:
private void applyUpdateStreamUnsafe(Stream<SMRRecord> smrRecordStream, boolean isOptimistic) { final AtomicLong lastSyncAddress = new AtomicLong(Address.NON_ADDRESS); List<SMRRecordLocator> garbageLocators = new ArrayList<>(); smrRecordStream .forEachOrdered(record -> { try { Object res = applyUpdateUnsafe(record); if (!isOptimistic) { if (pendingUpcalls.contains(record.getGlobalAddress())) { log.debug("Sync[{}] Upcall Result {}", this, record.getGlobalAddress()); upcallResults.put(record.getGlobalAddress(), res == null ? NullValue.NULL_VALUE : res); pendingUpcalls.remove(record.getGlobalAddress()); } if (lastSyncAddress.get() != Address.NON_ADDRESS && record.getGlobalAddress() > lastSyncAddress.get()) { syncTail = Math.max(syncTail, lastSyncAddress.get()); if (!garbageLocators.isEmpty()) { garbageInformer.add(syncTail, garbageLocators); garbageLocators.clear(); } } if (record.getGlobalAddress() > syncTail) { IGarbageIdentificationFunction garbageIdentifyFunction = garbageIdentifyFunctionMap.get(record.getSMRMethod()); if (garbageIdentifyFunction != null) { List<Object> garbage = garbageIdentifyFunction.identify(record.locator, record.getSMRArguments()); garbage.stream().forEach(o -> garbageLocators.add((SMRRecordLocator) o)); } lastSyncAddress.set(record.getGlobalAddress()); } } record.setUpcallResult(res); } catch (Exception e) { log.error("Sync[{}] Error: Couldn't execute upcall due to {}", this, e); throw new UnrecoverableCorfuError(e); } }); if (!isOptimistic) { syncTail = Math.max(syncTail, lastSyncAddress.get()); if (!garbageLocators.isEmpty()) { garbageInformer.add(syncTail, garbageLocators); garbageLocators.clear(); } } }

Target:
private void applyUpdateStreamUnsafe(Stream<SMRRecord> smrRecordStream, boolean isOptimistic) { final AtomicLong lastSyncAddress = new AtomicLong(Address.NON_ADDRESS); List<SMRRecordLocator> garbageLocators = new ArrayList<>(); smrRecordStream .forEachOrdered(record -> { try { Object res = applyUpdateUnsafe(record); if (!isOptimistic) { if (pendingUpcalls.contains(record.getGlobalAddress())) { log.debug("Sync[{}] Upcall Result {}", this, record.getGlobalAddress()); upcallResults.put(record.getGlobalAddress(), res == null ? NullValue.NULL_VALUE : res); pendingUpcalls.remove(record.getGlobalAddress()); } if (lastSyncAddress.get() != Address.NON_ADDRESS && record.getGlobalAddress() > lastSyncAddress.get()) { syncTail = Math.max(syncTail, lastSyncAddress.get()); if (!garbageLocators.isEmpty()) { garbageInformer.add(syncTail, garbageLocators); garbageLocators.clear(); } } if (record.getGlobalAddress() > syncTail) { IGarbageIdentificationFunction garbageIdentifyFunction = garbageIdentifyFunctionMap.get(record.getSMRMethod()); if (garbageIdentifyFunction != null) { List<Object> garbage = garbageIdentifyFunction.identify(record.locator, record.getSMRArguments()); garbage.forEach(o -> garbageLocators.add((SMRRecordLocator) o)); } lastSyncAddress.set(record.getGlobalAddress()); } } record.setUpcallResult(res); } catch (Exception e) { log.error("Sync[{}] Error: Couldn't execute upcall due to {}", this, e); throw new UnrecoverableCorfuError(e); } }); if (!isOptimistic) { syncTail = Math.max(syncTail, lastSyncAddress.get()); if (!garbageLocators.isEmpty()) { garbageInformer.add(syncTail, garbageLocators); } } }