auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>protected boolean validateImages() { return ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getstorage_pool_id(), Guid.Empty, true, true, <START> false, false, true, true, true, true, null); <END> }</code><technical_language>want check images legal exist</technical_language>

Target:
protected boolean validateImages() { return ImagesHandler.PerformImagesChecks(getVm(), getReturnValue().getCanDoActionMessages(), getVm().getstorage_pool_id(), Guid.Empty, true, true, hasImages(), hasImages(), true, true, true, true, null); }
Source:
<code>private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object status = interval.getValue(); if (status instanceof Integer) { int <START> s = <END> (int) status; if (s == StateValues.CPU_STATUS_RUN_USERMODE || s == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } if (s != 0) { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(s), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval nameInterval = ss.querySingleState(endTime, quark); Object processName = nameInterval.getValue(); if (processName instanceof String) { return new TimeGraphState(startTime, duration, s, (String) processName); } } return new TimeGraphState(startTime, duration, s); } return new TimeGraphState(startTime, duration, s); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }</code><technical_language>rename this status, status statusObj, other naming scheme, 's' please</technical_language>

Target:
private ITimeGraphState createTimeGraphState(ITmfStateInterval interval, ITmfStateSystem ss) throws StateSystemDisposedException { long startTime = interval.getStartTime(); long endTime = interval.getEndTime(); long duration = endTime - startTime + 1; Object statusObj = interval.getValue(); if (statusObj instanceof Integer) { int status = (int) statusObj; if (status == StateValues.CPU_STATUS_RUN_USERMODE || status == StateValues.CPU_STATUS_RUN_SYSCALL) { return fTimeEventNames.getUnchecked(interval); } if (status != 0) { Object processName = null; if (execNameIntervals.containsEntry(status, new OverlapComparableInterval(interval))) { processName = execNameIntervals.get(status).first().getInterval().getValue(); } else { int quark = ss.optQuarkAbsolute(Attributes.THREADS, Integer.toString(status), Attributes.EXEC_NAME); if (quark != ITmfStateSystem.INVALID_ATTRIBUTE) { ITmfStateInterval namedInterval = ss.querySingleState(endTime, quark); execNameIntervals.put(status, new OverlapComparableInterval(namedInterval)); processName = namedInterval.getValue(); } } if (processName instanceof String) { return new TimeGraphState(startTime, duration, status, (String) processName + '/' + status); } } return new TimeGraphState(startTime, duration, status); } return new TimeGraphState(startTime, duration, Integer.MIN_VALUE); }
Source:
<code>private Path pathFor(String name) { assert name.codePointCount(0, name.length()) > 0; if (encoded) { <START> String normalized = Normalizer.normalize(name.toLowerCase(Locale.ROOT), Normalizer.Form.NFKC) <END> .replaceAll("[^a-z0-9]", "_"); String base32 = ByteIterator.ofBytes(new ByteStringBuilder().append(name).toArray()) .base32Encode(Alphabet.Base32Alphabet.STANDARD, false).drainToString(); name = normalized + "-" + base32; } final int levels = this.levels; Path path = root; int idx = 0; for (int level = 0; level < levels; level ++) { int newIdx = name.offsetByCodePoints(idx, 1); path = path.resolve(name.substring(idx, newIdx)); idx = newIdx; if (idx == name.length()) { break; } } return path.resolve(name + ".xml"); }</code><technical_language>want case-fold normalization some un-normalized text weird if case-folded</technical_language>

Target:
private Path pathFor(String name) { assert name.codePointCount(0, name.length()) > 0; String normalizedName = name; if (encoded) { normalizedName = Normalizer.normalize(name, Normalizer.Form.NFKC) .toLowerCase(Locale.ROOT) .replaceAll("[^a-z0-9]", "_"); } Path path = root; int idx = 0; for (int level = 0; level < levels; level ++) { int newIdx = normalizedName.offsetByCodePoints(idx, 1); path = path.resolve(normalizedName.substring(idx, newIdx)); idx = newIdx; if (idx == normalizedName.length()) { break; } } if (encoded) { String base32 = ByteIterator.ofBytes(new ByteStringBuilder().append(name).toArray()) .base32Encode(Alphabet.Base32Alphabet.STANDARD, false).drainToString(); name = normalizedName + "-" + base32; } return path.resolve(name + ".xml"); }
Source:
<code>protected boolean needsRemoteGet(InvocationContext ctx, AbstractDataCommand command) { if (!command.hasFlag(Flag.DELTA_WRITE) <START> && (command.hasFlag(Flag.CACHE_MODE_LOCAL) <END> || command.hasFlag(Flag.SKIP_REMOTE_LOOKUP) || command.hasFlag(Flag.IGNORE_RETURN_VALUES))) { return false; } boolean shouldFetchFromRemote = false; CacheEntry entry = ctx.lookupEntry(command.getKey()); if (entry == null || entry.isNull() || entry.isLockPlaceholder() || command.hasFlag(Flag.DELTA_WRITE)) { Object key = command.getKey(); ConsistentHash ch = stateTransferManager.getCacheTopology().getReadConsistentHash(); shouldFetchFromRemote = (ctx.isOriginLocal() && !ch.isKeyLocalToNode(rpcManager.getAddress(), key) || command.hasFlag(Flag.DELTA_WRITE)) && !dataContainer.containsKey(key); if (!shouldFetchFromRemote && getLog().isTraceEnabled()) { getLog().tracef("Not doing a remote get for key %s since entry is mapped to current node (%s) or is in L1. Owners are %s", key, rpcManager.getAddress(), ch.locateOwners(key)); } } return shouldFetchFromRemote; }</code><technical_language>CACHE_MODE_LOCAL operations perform remote invocation, if cache inconsistent</technical_language>

Target:
protected boolean needsRemoteGet(InvocationContext ctx, AbstractDataCommand command) { if(command.hasFlag(Flag.CACHE_MODE_LOCAL) || (command.hasFlag(Flag.SKIP_REMOTE_LOOKUP) && !command.hasFlag(Flag.DELTA_WRITE) || command.hasFlag(Flag.IGNORE_RETURN_VALUES))) { return false; } boolean shouldFetchFromRemote = false; CacheEntry entry = ctx.lookupEntry(command.getKey()); if (entry == null || entry.isNull() || entry.isLockPlaceholder()){ Object key = command.getKey(); ConsistentHash ch = stateTransferManager.getCacheTopology().getReadConsistentHash(); shouldFetchFromRemote = (ctx.isOriginLocal() || command.hasFlag(Flag.DELTA_WRITE)) && !ch.isKeyLocalToNode(rpcManager.getAddress(), key) && !dataContainer.containsKey(key); if (!shouldFetchFromRemote && getLog().isTraceEnabled()) { getLog().tracef("Not doing a remote get for key %s since entry is mapped to current node (%s) or is in L1. Owners are %s", key, rpcManager.getAddress(), ch.locateOwners(key)); } } return shouldFetchFromRemote; }
Source:
<code>public <T> T get() { if (FMLEnvironment.dist == Dist.CLIENT) { return (T)this.clientSide.apply(client); } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) { return (T)this.serverSide.apply(server); } else if (FMLEnvironment.dist == null) { return (T)this.testSide.get(); } else { <START> throw new IllegalArgumentException("THREE SIDES? WUT?"); <END> } }</code><technical_language>This update custom sides supported</technical_language>

Target:
public <T> T get() { if (FMLEnvironment.dist == Dist.CLIENT) { return (T)this.clientSide.apply(client); } else if (FMLEnvironment.dist == Dist.DEDICATED_SERVER) { return (T)this.serverSide.apply(server); } else { return (T)this.testSide.get(); } }
Source:
<code>private List<Component> distinctComponents(String flowName, Set<Component> components) { <START> logger.info(String.format("Filtering distinct components for flow[%s]. Before:[%s].", flowName, components.size())); <END> List<Component> filtered = components.stream().filter( distinctByKey(component -> component.getName())).collect(Collectors.toList()); logger.info(String.format("After: [%s]", filtered.size())); return filtered; }</code><technical_language>slf4j logger varargs String.format logger.info("Filtering distinct components for flow {}. size: {}", flowName, components.size());</technical_language>

Target:
private List<Component> distinctComponents(String flowName, Set<Component> components) { logger.info("Filtering distinct components for flow[{}]. Before:[{}].", flowName, components.size()); List<Component> filtered = components.stream().filter( distinctByKey(component -> component.getName())).collect(Collectors.toList()); logger.info("After: [{}]", filtered.size()); return filtered; }
Source:
<code>public Map<ChannelOption<?>, Object> getOptions() { <START> return getOptions(super.getOptions(), EpollChannelOption.DOMAIN_SOCKET_READ_MODE, ChannelOption.ALLOW_HALF_CLOSURE); <END> }</code><technical_language>EpollChannelOption.ALLOW_HALF_CLOSURE ChannelOption.ALLOW_HALF_CLOSURE bellow consistent</technical_language>

Target:
public Map<ChannelOption<?>, Object> getOptions() { return getOptions(super.getOptions(), DOMAIN_SOCKET_READ_MODE, ALLOW_HALF_CLOSURE); }
Source:
<code>private String cleanUpPath(String path) { <START> return path.replaceAll(" END> }</code><technical_language>I extract regular expression a constant Pattern avoid compiling time invoke replaceAll</technical_language>

Target:
String cleanUpPath(String path) { return PATH_DIRTY_SLASHES.matcher(path).replaceAll("/").trim(); }
Source:
<code><START> public MovedHandler(final EMOperation completeOp) { <END> this.completeOp = completeOp; }</code><technical_language>need public</technical_language>

Target:
MovedHandler(final EMOperation completeOp) { this.completeOp = completeOp; }
Source:
<code>public BigDecimal lastQuotaBalance(final Long accountId, final Long domainId, Date startDate) { List<QuotaBalanceVO> quotaBalance = lastQuotaBalanceVO(accountId, domainId, startDate); if (quotaBalance.size() == 0) { new InvalidParameterValueException("There are no balance entries on or before the requested date."); } BigDecimal finalBalance = new BigDecimal(0); for (QuotaBalanceVO entry : quotaBalance) { <START> s_logger.debug("lastQuotaBalance Date=" + entry.getUpdatedOn().toGMTString() + " balance=" + entry.getCreditBalance() + " credit=" + entry.getCreditsId()); <END> finalBalance = finalBalance.add(entry.getCreditBalance()); } return finalBalance; }</code><technical_language>Wrap in a if (Logger.isDebugEnabled()) check</technical_language>

Target:
public BigDecimal lastQuotaBalance(final Long accountId, final Long domainId, Date startDate) { List<QuotaBalanceVO> quotaBalance = lastQuotaBalanceVO(accountId, domainId, startDate); BigDecimal finalBalance = new BigDecimal(0); if (quotaBalance.isEmpty()) { s_logger.info("There are no balance entries on or before the requested date."); return finalBalance; } for (QuotaBalanceVO entry : quotaBalance) { if (s_logger.isDebugEnabled()) { s_logger.debug("lastQuotaBalance Entry=" + entry); } finalBalance = finalBalance.add(entry.getCreditBalance()); } return finalBalance; }
Source:
<code>public void recognizeCustomFormLabeledDataWithJpgContentType(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); <START> customFormJpgDataRunner(data -> beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { <END> SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms(toFluxByteBuffer(data), trainingPoller.getFinalResult().getModelId(), FORM_1_JPG_FILE_LENGTH, FormContentType.IMAGE_JPEG, false, null).getSyncPoller(); syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), false, true); })); }</code><technical_language>this supplier give jpg form data length</technical_language>

Target:
public void recognizeCustomFormLabeledDataWithJpgContentType(HttpClient httpClient, FormRecognizerServiceVersion serviceVersion) { client = getFormRecognizerAsyncClient(httpClient, serviceVersion); customFormJpgDataRunner((data, dataLength) -> beginTrainingLabeledRunner((trainingFilesUrl, useTrainingLabels) -> { SyncPoller<OperationResult, CustomFormModel> trainingPoller = getFormTrainingAsyncClient(httpClient, serviceVersion).beginTraining(trainingFilesUrl, useTrainingLabels, null, durationTestMode).getSyncPoller(); trainingPoller.waitForCompletion(); SyncPoller<OperationResult, List<RecognizedForm>> syncPoller = client.beginRecognizeCustomForms( new RecognizeCustomFormsOptions(toFluxByteBuffer(data), dataLength, trainingPoller.getFinalResult().getModelId()).setFormContentType(FormContentType.IMAGE_JPEG) .setPollInterval(durationTestMode)).getSyncPoller(); syncPoller.waitForCompletion(); validateRecognizedResult(syncPoller.getFinalResult(), false, true); })); }
Source:
<code><START> public static void setUpBeforeClass() throws Exception { <END> project = ResourcesPlugin.getWorkspace().getRoot().getProject("test"); project.create(new NullProgressMonitor()); project.open(new NullProgressMonitor()); file = project.getFile("foo.txt"); file.create(new ByteArrayInputStream("bar".getBytes()), true, new NullProgressMonitor()); }</code><technical_language>code in CompletionTest. Consider pulling out a static util method</technical_language>

Target:
public static void setUpBeforeClass() throws Exception { GenericEditorTestUtils.setUpBeforeClass(); }
Source:
<code>public void completeImportScope_Imports(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { PrefixMatcher newMatcher = new PrefixMatcher() { @Override public boolean isCandidateMatchingPrefix(String name, String prefix) { String strippedName = name; if (name.startsWith("^") && !prefix.startsWith("^")) { strippedName = name.substring(1); } return context.getMatcher().isCandidateMatchingPrefix(strippedName, prefix); } <START> }; <END> ContentAssistContext myContext = context.copy().setMatcher(newMatcher).toContext(); StringProposalDelegate stringProposalDelegate = new StringProposalDelegate(acceptor, myContext); Set<PackageImport> allImports = mapper.getAllImports(model.eResource()); for (PackageImport pkgImport : allImports) { ICompletionProposal doCreateProposal = createCompletionProposal("\"" + pkgImport.getName() + "\"", computePackageStyledString(pkgImport), getIncludeImage(pkgImport), myContext); stringProposalDelegate.accept(doCreateProposal); } }</code><technical_language>remove if this is relevant</technical_language>

Target:
public void completeImportScope_Imports(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { StringProposalDelegate stringProposalDelegate = new StringProposalDelegate(acceptor, context); Set<PackageImport> allImports = mapper.getAllImports(model.eResource()); for (PackageImport pkgImport : allImports) { ICompletionProposal doCreateProposal = createCompletionProposal( "\"" + pkgImport.getName() + "\"", computePackageStyledString(pkgImport), getIncludeImage(pkgImport), pkgImport.getUri().isFile() ? 1 : -1, context.getPrefix(), context); stringProposalDelegate.accept(doCreateProposal); } }
Source:
<code>private void handleNoExecutorSelectedCase(ExecutionReference reference, ExecutableFlow exflow) throws ExecutorManagerException { <START> reference.setNumErrors(reference.getNumErrors() + 1); <END> if (reference.getNumErrors() >= MAX_DISPATCHING_ERRORS_PERMITTED) { finalizeFlows(exflow); } else { queuedFlows.enqueue(exflow, reference); } }</code><technical_language>add logging this condition</technical_language>

Target:
private void handleNoExecutorSelectedCase(ExecutionReference reference, ExecutableFlow exflow) throws ExecutorManagerException { logger .info(String .format( "Reached handleNoExecutorSelectedCase stage for exec %d with error count %d", exflow.getExecutionId(), reference.getNumErrors())); reference.setNumErrors(reference.getNumErrors() + 1); if (reference.getNumErrors() >= MAX_DISPATCHING_ERRORS_PERMITTED) { finalizeFlows(exflow); } else { queuedFlows.enqueue(exflow, reference); } }
Source:
<code>private TimestampData convertToTimestampWithLocalZone(JsonNode jsonNode){ TemporalAccessor parsedTimestampWithLocalZone; switch (timestampFormat){ case SQL: parsedTimestampWithLocalZone = SQL_TIMESTAMP_WITH_LOCAL_TIMEZONE_FORMAT.parse(jsonNode.asText()); break; case ISO_8601: parsedTimestampWithLocalZone = ISO8601_TIMESTAMP_WITH_LOCAL_TIMEZONE_FORMAT.parse(jsonNode.asText()); break; default: throw new TableException(String.format("Unsupported timestamp format '%s'. Validator should have checked that.", timestampFormat)); } LocalTime localTime = parsedTimestampWithLocalZone.query(TemporalQueries.localTime()); LocalDate localDate = parsedTimestampWithLocalZone.query(TemporalQueries.localDate()); <START> return TimestampData.fromInstant(LocalDateTime.of(localDate, localTime).atOffset(ZoneOffset.UTC).toInstant()); <END> }</code><technical_language>return TimestampData.fromInstant(LocalDateTime.of(localDate, localTime).toInstant(ZoneOffset.UTC));</technical_language>

Target:
private TimestampData convertToTimestampWithLocalZone(JsonNode jsonNode){ TemporalAccessor parsedTimestampWithLocalZone; switch (timestampFormat){ case SQL: parsedTimestampWithLocalZone = SQL_TIMESTAMP_WITH_LOCAL_TIMEZONE_FORMAT.parse(jsonNode.asText()); break; case ISO_8601: parsedTimestampWithLocalZone = ISO8601_TIMESTAMP_WITH_LOCAL_TIMEZONE_FORMAT.parse(jsonNode.asText()); break; default: throw new TableException(String.format("Unsupported timestamp format '%s'. Validator should have checked that.", timestampFormat)); } LocalTime localTime = parsedTimestampWithLocalZone.query(TemporalQueries.localTime()); LocalDate localDate = parsedTimestampWithLocalZone.query(TemporalQueries.localDate()); return TimestampData.fromInstant(LocalDateTime.of(localDate, localTime).toInstant(ZoneOffset.UTC)); }
Source:
<code>public JsonRpcRequest(@Assisted("id") String id, @Assisted("method") String method, @Assisted("params") JsonRpcParams params, JsonParser jsonParser) { this.jsonParser = jsonParser; checkNotNull(method, "Method name must not be null"); checkArgument(!method.isEmpty(), "Method name must not be empty"); <START> <END> this.id = id; this.method = method; this.params = params; }</code><technical_language>extra line</technical_language>

Target:
public JsonRpcRequest(@Assisted("id") String id, @Assisted("method") String method, @Assisted("params") JsonRpcParams params, JsonParser jsonParser) { checkNotNull(method, "Method name must not be null"); checkArgument(!method.isEmpty(), "Method name must not be empty"); this.id = id; this.method = method; this.params = params; }
Source:
<code>public void toJson(JsonWriter writer, T calendar) throws IOException { StringBuilder output = null; if (calendar.isSet(Calendar.YEAR)) { output = new StringBuilder(); output.append(calendar.get(Calendar.YEAR)); if (calendar.isSet(Calendar.MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MONTH) + 1)); if (calendar.isSet(Calendar.DAY_OF_MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.DAY_OF_MONTH))); if (isFilledToTime(calendar)) { output.append('T'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.HOUR_OF_DAY))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MINUTE))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.SECOND))); if (ZULU_TIME_ZONE.equals(calendar.getTimeZone())) { output.append('Z'); } else { TimeZone tz = calendar.getTimeZone(); long offsetInMillis = tz.getOffset(calendar.getTimeInMillis()); String offset = String.format("%02d:%02d", Math.abs(offsetInMillis / 3600000), <START> Math.abs((offsetInMillis / 60000) % 60)); <END> output.append((offsetInMillis >= 0 ? "+" : "-")).append(offset); } } } } } writer.value(output != null ? output.toString() : null); }</code><technical_language>this constants? understand a bit is happening</technical_language>

Target:
public void toJson(JsonWriter writer, T calendar) throws IOException { StringBuilder output = null; if (calendar.isSet(Calendar.YEAR)) { output = new StringBuilder(); output.append(calendar.get(Calendar.YEAR)); if (calendar.isSet(Calendar.MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MONTH) + 1)); if (calendar.isSet(Calendar.DAY_OF_MONTH)) { output.append('-'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.DAY_OF_MONTH))); if (isFilledToTime(calendar)) { output.append('T'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.HOUR_OF_DAY))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.MINUTE))); output.append(':'); output.append(TWO_DIGITS_FORMATTER.format(calendar.get(Calendar.SECOND))); if (ZULU_TIME_ZONE.equals(calendar.getTimeZone())) { output.append('Z'); } else { TimeZone timeZone = calendar.getTimeZone(); long millisWithOffset = timeZone.getOffset(calendar.getTimeInMillis()); String offset = String.format("%02d:%02d", Math.abs(millisWithOffset / 3600000), Math.abs((millisWithOffset / 60000) % 60)); output.append((millisWithOffset >= 0 ? "+" : "-")).append(offset); } } } } } writer.value(output != null ? output.toString() : null); }
Source:
<code>public long getBaselineBranchUuid() { <START> return Long.parseLong(artifact.getSoleAttributeAsString(AtsAttributeTypes.BaselineBranchUuid, "0")); <END> }</code><technical_language>typically -1 a default instead of 0</technical_language>

Target:
public long getBaselineBranchUuid() { return Long.parseLong(artifact.getSoleAttributeAsString(AtsAttributeTypes.BaselineBranchUuid, "-1")); }
Source:
<code>public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) { graph.clearTimeZone(); CalendarServiceData calendarServiceData = new CalendarServiceData(); try { for (NetexBundle netexBundle : netexBundles) { OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(graph.deduplicator); calendarServiceData.add(transitBuilder.buildCalendarServiceData()); OtpTransitService otpService = transitBuilder.build(); <START> graph.addNoticAssignments(otpService.getNoticeAssignments()); <END> PatternHopFactory hf = new PatternHopFactory( new GtfsFeedId.Builder() .id(netexFeedId) .build(), otpService, fareServiceFactory, MAX_STOP_TO_SHAPE_SNAP_DISTANCE, subwayAccessTime, maxInterlineDistance ); hf.run(graph); if (linkStopsToParentStations) { hf.linkStopsToParentStations(graph); } if (parentStationTransfers) { hf.createParentStationTransfers(); } } } catch (Exception e) { throw new RuntimeException(e); } graph.putService(CalendarServiceData.class, calendarServiceData); graph.updateTransitFeedValidity(calendarServiceData); graph.hasTransit = true; graph.calculateTransitCenter(); }</code><technical_language>rename: addNoticeAssignments</technical_language>

Target:
public void buildGraph(Graph graph, HashMap<Class<?>, Object> extra) { graph.clearTimeZone(); CalendarServiceData calendarServiceData = new CalendarServiceData(); try { for (NetexBundle netexBundle : netexBundles) { netexBundle.checkInputs(); OtpTransitServiceBuilder transitBuilder = netexBundle.loadBundle(graph.deduplicator); calendarServiceData.add(transitBuilder.buildCalendarServiceData()); OtpTransitService otpService = transitBuilder.build(); graph.addNoticeAssignments(otpService.getNoticeAssignments()); PatternHopFactory hf = new PatternHopFactory( new GtfsFeedId.Builder() .id(netexFeedId) .build(), otpService, fareServiceFactory, MAX_STOP_TO_SHAPE_SNAP_DISTANCE, subwayAccessTime, maxInterlineDistance ); hf.run(graph); if (linkStopsToParentStations) { hf.linkStopsToParentStations(graph); } if (parentStationTransfers) { hf.createParentStationTransfers(); } } } catch (Exception e) { throw new RuntimeException(e); } graph.putService(CalendarServiceData.class, calendarServiceData); graph.updateTransitFeedValidity(calendarServiceData); graph.hasTransit = true; graph.calculateTransitCenter(); }
Source:
<code>public JavaParserTypeSolver(File srcDir) { this.srcDir = srcDir; <START> hasValidSrcDir = srcDir.exists() && srcDir.isDirectory(); <END> }</code><technical_language>this potentially vary time typesolver instantiated time is</technical_language>

Target:
public JavaParserTypeSolver(File srcDir) { if (!srcDir.exists() || !srcDir.isDirectory()) { throw new IllegalStateException("SrcDir does not exist or is not a directory: " + srcDir.getAbsolutePath()); } this.srcDir = srcDir; }
Source:
<code>public HBaseDataStore(HbaseTableConnection tableWrapper, ObjectMapper mapper) { this.tableWrapper = tableWrapper; this.mapper = mapper; keyTranslator = new HbaseKeyTranslator(new RowKeyDistributorByHashPrefix( <START> new RowKeyDistributorByHashPrefix.OneByteSimpleHash(tableWrapper.getHbaseConfig().getNumBuckets()))); <END> }</code><technical_language>"this" consistency</technical_language>

Target:
public HBaseDataStore(HbaseTableConnection tableWrapper, ObjectMapper mapper) { this.tableWrapper = tableWrapper; this.mapper = mapper; this.translator = new DocumentTranslator(new RowKeyDistributorByHashPrefix( new RowKeyDistributorByHashPrefix.OneByteSimpleHash(tableWrapper.getHbaseConfig().getNumBuckets()))); }
Source:
<code>private void populatePopupMenu(List<ActionButtonDefinition<?, VmNetworkInterface>> actionButtons) { if (popup.getMenuBar().isEmpty() && actionButtons != null) { actionButtons.forEach(button -> { final MenuItem menuItem = new MenuItem(button.getText(), () -> { popup.asPopupPanel().hide(); button.onClick(null, null); }); <START> List<VmNetworkInterface> selectedItems = Collections.singletonList(getEntity()); <END> menuItem.setEnabled(button.isEnabled(null, null)); button.addInitializeHandler(event -> menuItem.setEnabled(button.isEnabled(null, null))); popup.getMenuBar().addItem(menuItem); }); } }</code><technical_language>selectedItems unused</technical_language>

Target:
private void populatePopupMenu(List<ActionButtonDefinition<?, VmNetworkInterface>> actionButtons) { if (popup.getMenuBar().isEmpty() && actionButtons != null) { actionButtons.forEach(button -> { final MenuItem menuItem = new MenuItem(button.getText(), () -> { popup.asPopupPanel().hide(); button.onClick(null, null); }); menuItem.setEnabled(button.isEnabled(null, null)); button.addInitializeHandler(event -> menuItem.setEnabled(button.isEnabled(null, null))); popup.getMenuBar().addItem(menuItem); }); } }
Source:
<code>public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new HashMap<>(); for (TopicProfileType profile : profiles) { if (profileMap.put(profile.getName(), profile) != null) { <START> errors.addErrorMessage("Profile " + profile.getName() + " is already defined"); <END> } } return Pair.of(defaults, profileMap); }</code><technical_language>I modify this message is defined multiple times</technical_language>

Target:
public final static Pair<TopicDefaultsType, Map<String, TopicProfileType>> getDeploymentTopics( DeploymentType deployment, CompoundErrors errors) { TopicsType topics = deployment.getTopics(); if (topics == null) { return Pair.of(null, null); } TopicDefaultsType defaults = topics.getDefaults(); List<TopicProfileType> profiles = topics.getProfile(); if (profiles == null) { if (hostLog.isDebugEnabled()) { hostLog.debug("No topic profiles in deployment"); } return Pair.of(defaults, null); } Map<String, TopicProfileType> profileMap = new HashMap<>(); for (TopicProfileType profile : profiles) { if (profileMap.put(profile.getName(), profile) != null) { errors.addErrorMessage("Profile " + profile.getName() + " is defined multiple times"); } } return Pair.of(defaults, profileMap); }
Source:
<code>public void testMediaDownloading() { Client jersey = Client.create(); <START> WebResource resource = jersey.resource(getResourceUrl("/cache/sample.wav")); <END> ClientResponse response = resource.get(ClientResponse.class); Assert.assertEquals(200, response.getStatus()); }</code><technical_language><LINK_0></technical_language>

Target:
public void testMediaDownloading() { Client jersey = Client.create(); WebResource resource = jersey.resource(getResourceUrl("/cache/ACae6e420f425248d6a26948c17a9e2acf/101cc31d1b07e8285c40d13d83f63da9caaaf21155a321f231980601bac555de.wav")); ClientResponse response = resource.get(ClientResponse.class); Assert.assertEquals(200, response.getStatus()); }
Source:
<code><START> public String addLineageEntry(String lineageEntryId, LineageEntry lineageEntry) { <END> _lineageEntries.put(lineageEntryId, lineageEntry); return lineageEntryId; }</code><technical_language>String addLineageEntry(LineageEntry lineageEntry) void addLineageEntry(String lineageEntryId, LineageEntry lineageEntry), confusing. In other world, generate UUID of this class. suggestion is keeping String addLineageEntry(LineageEntry lineageEntry), check existence of lineageId (or UUID collision change is low) In order update lineage entry, add a method void updateLineageEntry(String lineageEntryId, LineageEntry lineageEntry)</technical_language>

Target:
public void addLineageEntry(String lineageEntryId, LineageEntry lineageEntry) { Preconditions.checkArgument(!_lineageEntries.containsKey(lineageEntryId), String.format("Lineage entry id ('%s') already exists. Please try with the new lineage id", lineageEntryId)); _lineageEntries.put(lineageEntryId, lineageEntry); }
Source:
<code>public List<Group> getMemberGroupsByAttribute(PerunSession sess, Member member, Attribute attribute) throws WrongAttributeAssignmentException, PrivilegeException, IllegalArgumentException,InternalErrorException { <START> if(AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, new AttributeDefinition(attribute), null, null)) throw new PrivilegeException(sess); <END> if(!attribute.getEntity().equals("group")) throw new IllegalArgumentException("Attribute: " + attribute + " is not group attribute"); return this.groupsManagerBl.getMemberGroupsByAttribute(sess, member, attribute); }</code><technical_language>is need create new attributeDefinition attribute. polymorphism in Java. - Add some message privilege exception</technical_language>

Target:
public List<Group> getMemberGroupsByAttribute(PerunSession sess, Member member, Attribute attribute) throws WrongAttributeAssignmentException, PrivilegeException,InternalErrorException, VoNotExistsException { Utils.checkPerunSession(sess); for(Group group: this.getAllGroups(sess, this.getPerunBl().getVosManagerBl().getVoById(sess, member.getVoId()))) if(!AuthzResolver.isAuthorizedForAttribute(sess, ActionType.READ, attribute, group, null)) throw new PrivilegeException(sess, "Actor hasn't right to read attribute."); if(!this.getPerunBl().getAttributesManagerBl().isFromNamespace(sess, attribute, AttributesManagerEntry.NS_GROUP_ATTR)) throw new WrongAttributeAssignmentException(attribute); return this.groupsManagerBl.getMemberGroupsByAttribute(sess, member, attribute); }
Source:
<code>protected int getBucketIdx(long bucketId) { <START> return (int)Math.abs((bucketId % numBuckets)); <END> }</code><technical_language>remove extra paren</technical_language>

Target:
protected int getBucketIdx(long bucketId) { return (int)Math.abs(bucketId % numBuckets); }
Source:
<code>private DBObject generateUpdate(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { <START> VariantSourceEntry variantSourceEntry = variant.getSourceEntries().iterator().next(); <END> addToSet.put(VariantMongo.FILES_FIELD, convert(variantSourceEntry)); if (includeStats) { BasicDBList basicDBList = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", basicDBList)); } } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } update.append("$setOnInsert", convert(variant)); return update; }</code><technical_language>Is a source this is load individual studies? this more clear (maybe a private method getSourceEntry())? Also, assert similar check more source a simple effective extra security measure</technical_language>

Target:
private DBObject generateUpdate(Variant variant) { Assert.notNull(variant, "Variant should not be null. Please provide a valid Variant object"); logger.trace("Convert variant into mongo object", variant); BasicDBObject addToSet = new BasicDBObject(); if (!variant.getSourceEntries().isEmpty()) { VariantSourceEntry variantSourceEntry = getVariantSourceEntry(variant); addToSet.put(VariantMongo.FILES_FIELD, convertSourceEntry(variantSourceEntry)); if (includeStats) { BasicDBList statistics = convertStatistics(variantSourceEntry); addToSet.put(VariantMongo.STATISTICS_FIELD, new BasicDBObject("$each", statistics)); } } if (variant.getIds() != null && !variant.getIds().isEmpty()) { addToSet.put(IDS_FIELD, new BasicDBObject("$each", variant.getIds())); } BasicDBObject update = new BasicDBObject(); if (!addToSet.isEmpty()) { update.put("$addToSet", addToSet); } update.append("$setOnInsert", convertVariant(variant)); return update; }
Source:
<code>public void remove() { <START> if (type == SchemaType.MUTABLE) { <END> realmSchema.remove(AllJavaTypes.CLASS_NAME); assertFalse(realmSchema.contains(AllJavaTypes.CLASS_NAME)); } else { thrown.expect(UnsupportedOperationException.class); realmSchema.remove(AllJavaTypes.CLASS_NAME); } }</code><technical_language>Nitpick: In other tests test for IMMUTABLE</technical_language>

Target:
public void remove() { if (type == SchemaType.IMMUTABLE) { thrown.expect(UnsupportedOperationException.class); realmSchema.remove(AllJavaTypes.CLASS_NAME); } else { realmSchema.remove(AllJavaTypes.CLASS_NAME); assertFalse(realmSchema.contains(AllJavaTypes.CLASS_NAME)); } }
Source:
<code><START> public String acquireLease(int leaseTimeInSec, String leaseId) { <END> try { String id = leaseBlob.acquireLease(leaseTimeInSec, leaseId); LOG.info("Acquired lease with lease id = " + id); return id; } catch (StorageException storageException) { int httpStatusCode = storageException.getHttpStatusCode(); if (httpStatusCode == HttpStatus.CONFLICT_409) { LOG.info("The blob you're trying to acquire is leased already."); } else { LOG.error("Error acquiring lease!", new SamzaException(storageException)); } } return null; }</code><technical_language>I suggest return Optional<String> instead force clients program defensively</technical_language>

Target:
public String acquireLease(int leaseTimeInSec, String leaseId) { try { String id = leaseBlob.acquireLease(leaseTimeInSec, leaseId); LOG.info("Acquired lease with lease id = " + id); return id; } catch (StorageException storageException) { int httpStatusCode = storageException.getHttpStatusCode(); if (httpStatusCode == HttpStatus.CONFLICT_409) { LOG.info("The blob you're trying to acquire is leased already.", storageException); } else if (httpStatusCode == HttpStatus.NOT_FOUND_404) { LOG.error("The blob you're trying to lease does not exist.", storageException); throw new AzureException(storageException); } else { LOG.error("Error acquiring lease!", storageException); throw new AzureException(storageException); } } return null; }
Source:
<code>private Injector createSysInjector() { List<Module> modules = Lists.newArrayList(); modules.add(PatchListCacheImpl.module()); <START> modules.add(new LuceneIndexModule(false, threads)); <END> modules.add(new AbstractModule() { @SuppressWarnings("rawtypes") @Override protected void configure() { bind(ReviewDb.class).toProvider(new Provider<ReviewDb>() { @Override public ReviewDb get() { return dbRef.get(); } }); bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {}) .toInstance(DynamicSet.<CacheRemovalListener> emptySet()); install(new DefaultCacheFactory.Module()); } }); return dbInjector.createChildInjector(modules); }</code><technical_language>Instead of passing thread count in, pass in ExecutorService. is a ListenableExecutorService. LisentableFuture property future modify a Semaphore throttles rate ReIndex adds items queue. This allows bound memory usage. Set Semaphore 2x threads block end of db scan loop main thread acquire(2*thread) elements</technical_language>

Target:
private Injector createSysInjector() { List<Module> modules = Lists.newArrayList(); modules.add(PatchListCacheImpl.module()); modules.add(new LuceneIndexModule(false, threads)); modules.add(new ReviewDbModule()); modules.add(new AbstractModule() { @SuppressWarnings("rawtypes") @Override protected void configure() { bind(new TypeLiteral<DynamicSet<CacheRemovalListener>>() {}) .toInstance(DynamicSet.<CacheRemovalListener> emptySet()); install(new DefaultCacheFactory.Module()); } }); return dbInjector.createChildInjector(modules); }
Source:
<code>public synchronized void handlePeerReady(SharingPeer peer) { BitSet interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); interesting.andNot(this.requestedPieces); logger.trace("Peer is ready and has interesting piece(s).", peer, interesting.cardinality()); if (interesting.cardinality() == 0) { interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); if (interesting.cardinality() == 0) { logger.trace("No interesting piece from {}!", peer); return; } if (this.completedPieces.cardinality() < ENG_GAME_COMPLETION_RATIO * this.pieces.length) { logger.trace("Not far along enough to warrant end-game mode."); return; } logger.trace("Possible end-game, we're about to request a piece " + "that was already requested from another peer."); } <START> SortedSet<Piece> rarest = new TreeSet<Piece>(); <END> for (Integer pieceIdx : this.rarest) { rarest.add(this.pieces[pieceIdx]); } Piece chosen = requestStrategy.choosePiece(rarest, interesting, pieces); this.requestedPieces.set(chosen.getIndex()); logger.trace("Requesting from {}, we now have " + "outstanding request(s): {}", new Object[] { chosen, peer, this.requestedPieces.cardinality(), this.requestedPieces }); peer.downloadPiece(chosen); }</code><technical_language>a fan of field hiding. name sorted set rarestPieces instead</technical_language>

Target:
public synchronized void handlePeerReady(SharingPeer peer) { BitSet interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); interesting.andNot(this.requestedPieces); logger.trace("Peer is ready and has interesting piece(s).", peer, interesting.cardinality()); if (interesting.cardinality() == 0) { interesting = peer.getAvailablePieces(); interesting.andNot(this.completedPieces); if (interesting.cardinality() == 0) { logger.trace("No interesting piece from {}!", peer); return; } if (this.completedPieces.cardinality() < ENG_GAME_COMPLETION_RATIO * this.pieces.length) { logger.trace("Not far along enough to warrant end-game mode."); return; } logger.trace("Possible end-game, we're about to request a piece " + "that was already requested from another peer."); } SortedSet<Piece> rarestPieces = new TreeSet<Piece>(); for (Integer pieceIdx : this.rarest) { rarestPieces.add(this.pieces[pieceIdx]); } Piece chosen = requestStrategy.choosePiece(rarestPieces, interesting, pieces); this.requestedPieces.set(chosen.getIndex()); logger.trace("Requesting from {}, we now have " + "outstanding request(s): {}", new Object[] { chosen, peer, this.requestedPieces.cardinality(), this.requestedPieces }); peer.downloadPiece(chosen); }
Source:
<code>public void setVisible(boolean visible) { super.setVisible(visible); <START> if (!visible) { <END> setInput(null); } }</code><technical_language>style nit: braces single line blocks</technical_language>

Target:
public void setVisible(boolean visible) { super.setVisible(visible); if (!visible) setInput(null); }
Source:
<code>static Server makeJettyServer(DruidNode node, ServerConfig config) { <START> log.info("Creating Jetty server listening at port [%s] with config [%s]", node.getPort(), config); <END> final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(config.getNumThreads()); threadPool.setMaxThreads(config.getNumThreads()); threadPool.setDaemon(true); final Server server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true); ServerConnector connector = new ServerConnector(server); connector.setPort(node.getPort()); connector.setIdleTimeout(Ints.checkedCast(config.getMaxIdleTime().toStandardDuration().getMillis())); connector.setAcceptorPriorityDelta(-1); server.setConnectors(new Connector[]{connector}); return server; }</code><technical_language>more useful add this message start server</technical_language>

Target:
static Server makeJettyServer(DruidNode node, ServerConfig config) { final QueuedThreadPool threadPool = new QueuedThreadPool(); threadPool.setMinThreads(config.getNumThreads()); threadPool.setMaxThreads(config.getNumThreads()); threadPool.setDaemon(true); final Server server = new Server(threadPool); server.addBean(new ScheduledExecutorScheduler("JettyScheduler", true), true); ServerConnector connector = new ServerConnector(server); connector.setPort(node.getPort()); connector.setIdleTimeout(Ints.checkedCast(config.getMaxIdleTime().toStandardDuration().getMillis())); connector.setAcceptorPriorityDelta(-1); server.setConnectors(new Connector[]{connector}); return server; }
Source:
<code>public LogReplicationSourceManager(CorfuRuntime runtime, DataSender dataSender, ReadProcessor readProcessor, LogReplicationRuntimeParameters params, ExecutorService logReplicationFSMWorkers) { this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } this.runtime = CorfuRuntime.fromParameters(runtime.getParameters()); this.runtime.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); <START> this.logReplicationFSM.setSiteConfigID(params.getTopologyConfigId()); <END> }</code><technical_language>rename -> setTopologyConfigId</technical_language>

Target:
public LogReplicationSourceManager(CorfuRuntime runtime, DataSender dataSender, ReadProcessor readProcessor, LogReplicationRuntimeParameters params, ExecutorService logReplicationFSMWorkers) { this.parameters = params; this.config = parameters.getReplicationConfig(); if (config.getStreamsToReplicate() == null || config.getStreamsToReplicate().isEmpty()) { throw new IllegalArgumentException("Invalid Log Replication: Streams to replicate is EMPTY"); } this.runtime = CorfuRuntime.fromParameters(runtime.getParameters()); this.runtime.parseConfigurationString(runtime.getLayoutServers().get(0)).connect(); this.logReplicationFSM = new LogReplicationFSM(this.runtime, config, params.getRemoteClusterDescriptor(), dataSender, readProcessor, logReplicationFSMWorkers); this.logReplicationFSM.setTopologyConfigId(params.getTopologyConfigId()); }
Source:
<code>public ModelAndView membershipGiveReceiveDetails(@PathVariable long membershipGiveId, @RequestParam(value = "mobile", defaultValue = "") String mobile, @RequestParam(value = "index", defaultValue = "1") int index, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) { <START> ModelAndView modelAndView = new ModelAndView("/membership-give-receive-detail"); <END> List<MembershipGiveReceiveDto> membershipGiveReceiveDtos = membershipGiveService.getMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile, index, pageSize); modelAndView.addObject("membershipGiveReceiveDtos", membershipGiveReceiveDtos); modelAndView.addObject("mobile", mobile); long totalCount = membershipGiveService.getCountMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile); modelAndView.addObject("totalCount", totalCount); modelAndView.addObject("index", index); modelAndView.addObject("pageSize", pageSize); modelAndView.addObject("hasPreviousPage", index > 1); int totalPage = (int) (totalCount % pageSize == 0 ? totalCount / pageSize : totalCount / pageSize + 1); modelAndView.addObject("hasNextPage", index < totalPage); modelAndView.addObject("selectMobile", mobile); modelAndView.addObject("selectGiveId", membershipGiveId); return modelAndView; }</code><technical_language>Pagination</technical_language>

Target:
public ModelAndView membershipGiveReceiveDetails(@PathVariable long membershipGiveId, @RequestParam(value = "mobile", defaultValue = "") String mobile, @RequestParam(value = "index", defaultValue = "1") int index, @RequestParam(value = "pageSize", defaultValue = "10") int pageSize) { ModelAndView modelAndView = new ModelAndView("/membership-give-receive-detail"); BasePaginationDataDto<MembershipGiveReceiveDto> basePaginationDataDto = membershipGiveService.getMembershipGiveReceiveDtosByMobile(membershipGiveId, mobile, index, pageSize); modelAndView.addObject("dataDto", basePaginationDataDto); modelAndView.addObject("selectMobile", mobile); modelAndView.addObject("selectGiveId", membershipGiveId); return modelAndView; }
Source:
<code>public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); <START> this.setThreadFactory(ThreadExecutorMap.apply(getThreadFactory(), this)); <END> }</code><technical_language>Is this is safe? I scheduled repeating trimming task run arbitrary thread, i.e. necessarily scheduled owns referenced PoolThreadCache instance. for this scheduled task call PoolThreadCache.trimCurrentThreadCache()</technical_language>

Target:
public UnorderedThreadPoolEventExecutor(int corePoolSize, ThreadFactory threadFactory) { super(corePoolSize, threadFactory); }
Source:
<code>public UpdateClockTimerTask() { try { update_interval = Integer.parseInt(ScoreBoardManager.getProperty(PROPERTY_INTERVAL_KEY)); } catch ( Exception e ) { } startSystemTime = scoreBoardClock.getCurrentTime(); <START> scoreBoardClock.addScoreBoardListener(this); <END> timer.scheduleAtFixedRate(this, update_interval / 4, update_interval / 4); }</code><technical_language>Currently listens DefaultScoreBoardModel, this work for consistency</technical_language>

Target:
public UpdateClockTimerTask() { startSystemTime = scoreBoardClock.getCurrentTime(); ScoreBoardClock.getInstance().registerClient(this); }
Source:
<code>private ListenableFuture<T> execute(Supplier<ListenableFuture<T>> supplier, int retriesRemaining) { <START> return Futures.transformAsync(Futures.submitAsync(supplier::get, MoreExecutors.directExecutor()), <END> result -> { int newRetriesRemaining = retriesRemaining - 1; if (predicate.test(result) || newRetriesRemaining == 0) { return Futures.immediateFuture(result); } else { return Futures.transformAsync( schedulingExecutor.schedule( () -> { }, delayBetweenAttempts.toMillis(), TimeUnit.MILLISECONDS), $ -> execute(supplier, newRetriesRemaining), executionExecutor); } }, MoreExecutors.directExecutor()); }</code><technical_language>nit: remove transformAsync unnecessary if supplier current thread? suggestion return Futures.transformAsync(supplier.get(),</technical_language>

Target:
private ListenableFuture<T> execute(Supplier<ListenableFuture<T>> supplier, int retriesRemaining) { return Futures.transformAsync(executeSupplier(supplier), result -> { int newRetriesRemaining = retriesRemaining - 1; if (predicate.test(result) || newRetriesRemaining == 0) { return Futures.immediateFuture(result); } else { return Futures.transformAsync( schedulingExecutor.schedule( () -> { }, delayBetweenAttempts.toMillis(), TimeUnit.MILLISECONDS), $ -> execute(supplier, newRetriesRemaining), executionExecutor); } }, MoreExecutors.directExecutor()); }