auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (TimeoutException e) { <START> log.warn("Caught a timeout exception ", e); <END> force = true; } catch (Exception e) { log.trace("Caught an Exception and will notify discovery service ", e); } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { if (errorOnMsgTimeout && entry.retry >= maxRetry) { log.warn("Entry of type has been resent max times for timer {}.", entry.getData().getMetadata().getTimestamp(), entry.getData().getMetadata().getMessageMetadataType(), maxRetry, msgTimer); throw new LogEntrySyncTimeoutException("timeout"); } entry.retry(); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.info("resend message " + entry.getData().getMetadata().getTimestamp()); } } return ack; }</code><technical_language>curious is this noisy? I do exceptions often? is exercising lock changes fail some underlying bug into</technical_language>

Target:
public LogReplicationEntry resend() { LogReplicationEntry ack = null; boolean force = false; try { ack = processAcks(); } catch (TimeoutException e) { log.warn("Caught a timeout exception ", e); force = true; } catch (Exception e) { log.warn("Caught an Exception while processing ACKs.", e); return null; } for (int i = 0; i < pendingMessages.getSize(); i++) { LogReplicationPendingEntry entry = pendingMessages.getList().get(i); if (entry.timeout(msgTimer) || force) { if (errorOnMsgTimeout && entry.retry >= maxRetry) { log.warn("Entry of type has been resent max times for timer {}.", entry.getData().getMetadata().getTimestamp(), entry.getData().getMetadata().getMessageMetadataType(), maxRetry, msgTimer); throw new LogEntrySyncTimeoutException("timeout"); } entry.retry(); CompletableFuture<LogReplicationEntry> cf = dataSender.send(entry.getData()); addCFToAcked(entry.getData(), cf); log.info("resend message " + entry.getData().getMetadata().getTimestamp()); } } return ack; }
Source:
<code>private Session getSession( Context context, SurfaceView mSurfaceView, int orientation ) { Session mSession = SessionBuilder.getInstance().setContext( context ).setAudioEncoder( SessionBuilder.AUDIO_AAC ) <START> .setAudioQuality( new AudioQuality( 8000, 16000 ) ).setVideoEncoder( SessionBuilder.VIDEO_H264 ).setSurfaceView( mSurfaceView ) <END> .setPreviewOrientation( orientation ).setCallback( (Session.Callback) context ).build(); return mSession; }</code><technical_language>hardcoding 8000 16000? making parameters configurable</technical_language>

Target:
private Session getSession( Context context, SurfaceView mSurfaceView, int orientation ) { Session mSession = SessionBuilder.getInstance().setContext( context ).setAudioEncoder( SessionBuilder.AUDIO_AAC ) .setVideoEncoder( SessionBuilder.VIDEO_H264 ).setSurfaceView( mSurfaceView ) .setPreviewOrientation( orientation ).setCallback( (Session.Callback) context ).build(); return mSession; }
Source:
<code>public Group removeAccount(Account account) { Assert.notNull(account, "account cannot be null"); GroupMembership groupMembership = null; for (GroupMembership accountGroupMembership : getAccountMemberships()) { <START> if (accountGroupMembership.getAccount().getHref().equalsIgnoreCase(account.getHref())) { <END> groupMembership = accountGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }</code><technical_language>hrefs case sensitive. Please equals(String) instead of equalsIgnoreCase(String)</technical_language>

Target:
public Group removeAccount(Account account) { Assert.notNull(account, "account cannot be null"); GroupMembership groupMembership = null; for (GroupMembership accountGroupMembership : getAccountMemberships()) { if (accountGroupMembership.getAccount().getHref().equals(account.getHref())) { groupMembership = accountGroupMembership; break; } } if (groupMembership != null){ groupMembership.delete(); } else { throw new IllegalStateException("The specified account does not belong to this Group."); } return this; }
Source:
<code>public void checkPagingOneByOneThroughReferences() throws AvroRemoteException { final List<ReferenceSet> allRefSets = Utils.getAllReferenceSets(client); assertThat(allRefSets).isNotEmpty(); final String refSetId = allRefSets.get(0).getId(); final List<Reference> listOfReferences = Utils.getAllReferences(client, refSetId); assertThat(listOfReferences).isNotEmpty(); final Set<Reference> setOfReferences = new HashSet<>(listOfReferences); assertThat(listOfReferences).hasSize(setOfReferences.size()); String pageToken = null; <START> for (Reference ignored : listOfReferences) { <END> final SearchReferencesRequest pageReq = SearchReferencesRequest.newBuilder() .setReferenceSetId(refSetId) .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferencesResponse pageResp = client.references.searchReferences(pageReq); final List<Reference> pageOfReferences = pageResp.getReferences(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferences).hasSize(1); assertThat(setOfReferences).contains(pageOfReferences.get(0)); setOfReferences.remove(pageOfReferences.get(0)); } assertThat(pageToken).isNull(); assertThat(setOfReferences).isEmpty(); }</code><technical_language>This low-level. provide a method do paging automatically, provide optional page size (which I @calbach suggests too)? awful lot of code repetition if this is done for object, search. I this test replaced java final Set<Reference> expectedReferences = Set(Utils.getAllReferences(client, refSetId)); final Set<Reference> foundReferences = Set(getReferences(client, refSetId, pageSize=1)); assertThat(expectedReferences == foundReferences); (apologies for mangled pseudocode, get idea!) point is, assert interesting pageSizes other > 0, point in checking things</technical_language>

Target:
public void checkPagingOneByOneThroughReferences() throws AvroRemoteException { final List<ReferenceSet> allRefSets = Utils.getAllReferenceSets(client); assertThat(allRefSets).isNotEmpty(); final String refSetId = allRefSets.get(0).getId(); final List<Reference> listOfReferences = Utils.getAllReferences(client, refSetId); assertThat(listOfReferences).isNotEmpty(); final Set<Reference> setOfExpectedReferences = new HashSet<>(listOfReferences); assertThat(listOfReferences).hasSize(setOfExpectedReferences.size()); final Set<Reference> setOfReferencesGathered1By1 = new HashSet<>(setOfExpectedReferences.size()); String pageToken = null; do { final SearchReferencesRequest pageReq = SearchReferencesRequest.newBuilder() .setReferenceSetId(refSetId) .setPageSize(1) .setPageToken(pageToken) .build(); final SearchReferencesResponse pageResp = client.references.searchReferences(pageReq); final List<Reference> pageOfReferences = pageResp.getReferences(); pageToken = pageResp.getNextPageToken(); assertThat(pageOfReferences).hasSize(1); setOfReferencesGathered1By1.add(pageOfReferences.get(0)); } while (pageToken != null); assertThat(setOfReferencesGathered1By1).containsAll(setOfExpectedReferences); }
Source:
<code>public void bulk_apply_template_by_template_uuid() throws Exception { OrganizationDto otherOrganization = db.organizations().insert(); db.components().insertPrivateProject(otherOrganization); ComponentDto privateProject = db.components().insertPrivateProject(organization); ComponentDto publicProject = db.components().insertPublicProject(organization); ComponentDto view = db.components().insertView(organization); loginAsAdmin(organization); newRequest() .setParam(PARAM_TEMPLATE_ID, template1.getUuid()) <START> .setParam(PARAM_QUALIFIERS, String.join(",", Qualifiers.PROJECT, Qualifiers.VIEW)) <END> .execute(); assertTemplate1AppliedToPrivateProject(privateProject); assertTemplate1AppliedToPublicProject(publicProject); assertTemplate1AppliedToPublicProject(view); }</code><technical_language>If default is added qualifiers parameter, this line useless</technical_language>

Target:
public void bulk_apply_template_by_template_uuid() throws Exception { OrganizationDto otherOrganization = db.organizations().insert(); db.components().insertPrivateProject(otherOrganization); ComponentDto privateProject = db.components().insertPrivateProject(organization); ComponentDto publicProject = db.components().insertPublicProject(organization); loginAsAdmin(organization); newRequest() .setParam(PARAM_TEMPLATE_ID, template1.getUuid()) .execute(); assertTemplate1AppliedToPrivateProject(privateProject); assertTemplate1AppliedToPublicProject(publicProject); }
Source:
<code>protected void onCreate(@Nullable Bundle savedInstanceState) { <START> FragmentFactory fragmentFactory = ViewModelProviders.of(this) .get(FragmentFactoryHolderViewModel.class) .getFragmentFactory(); <END> if (fragmentFactory != null) { getSupportFragmentManager().setFragmentFactory(fragmentFactory); } super.onCreate(savedInstanceState); }</code><technical_language>Replace this with: ViewModelProvider viewModelProvider = new ViewModelProvider(this, ViewModelProvider.AndroidViewModelFactory.getInstance(getApplication())); FragmentFactory factory = viewModelProvider .get(FragmentFactoryHolderViewModel.class) .getFragmentFactory();</technical_language>

Target:
protected void onCreate(@Nullable Bundle savedInstanceState) { ViewModelProvider viewModelProvider = new ViewModelProvider( this, ViewModelProvider.AndroidViewModelFactory.getInstance(getApplication())); FragmentFactory factory = viewModelProvider .get(FragmentFactoryHolderViewModel.class) .getFragmentFactory(); if (factory != null) { getSupportFragmentManager().setFragmentFactory(factory); } super.onCreate(savedInstanceState); }
Source:
<code>private void loadDBProperties() { <START> CoreWorkspace ws = (CoreWorkspace) Services.getService(CoreWorkspace.class); <END> try { File propertiesFile = new File(ws.getWorkspaceFolder() + File.separator + dbPropertiesFile); if (propertiesFile.exists()) { dbProperties.load(new FileInputStream(propertiesFile)); } } catch (IOException e) { LOGGER.error(e); } }</code><technical_language>useless cast again. below</technical_language>

Target:
private void loadDBProperties() { CoreWorkspace ws = Services.getService(CoreWorkspace.class); try { File propertiesFile = new File(ws.getWorkspaceFolder() + File.separator + dbPropertiesFile); if (propertiesFile.exists()) { dbProperties.load(new FileInputStream(propertiesFile)); } } catch (IOException e) { LOGGER.error(e); } }
Source:
<code>protected boolean deleteTaskNonRecursive(Task<?> task) { Set<?> tags = checkNotNull(task, "task").getTags(); for (Object tag : tags) { synchronized (tasksByTag) { Set<Task<?>> tasks = tasksWithTagLiveOrNull(tag); if (tasks != null) { tasks.remove(task); if (tasks.isEmpty()) { tasksByTag.remove(tag); } } } } Task<?> removed = tasksById.remove(task.getId()); incompleteTaskIds.remove(task.getId()); if (removed!=null && removed.isSubmitted() && !removed.isDone()) { <START> log.warn("Deleting submitted but incomplete task (cancel it first): "+removed); <END> } return removed != null; }</code><technical_language>word "Deleting submitted incomplete task (without automatically cancelling first): "+removed</technical_language>

Target:
protected boolean deleteTaskNonRecursive(Task<?> task) { Set<?> tags = checkNotNull(task, "task").getTags(); for (Object tag : tags) { synchronized (tasksByTag) { Set<Task<?>> tasks = tasksWithTagLiveOrNull(tag); if (tasks != null) { tasks.remove(task); if (tasks.isEmpty()) { tasksByTag.remove(tag); } } } } Task<?> removed = tasksById.remove(task.getId()); incompleteTaskIds.remove(task.getId()); if (removed!=null && removed.isSubmitted() && !removed.isDone()) { log.warn("Deleting submitted task before completion: "+removed+"; this task will continue to run in the background outwith "+this+", but perhaps it should have been cancelled?"); } return removed != null; }
Source:
<code>public List<AggregatorFactory> getRequiredColumns() { <START> return Collections.singletonList(new DoubleAnyAggregatorFactory(fieldName, fieldName)); <END> }</code><technical_language>I understand parameters fieldName parameters in getCombiningFactory name - I this pattern in aggregators</technical_language>

Target:
public List<AggregatorFactory> getRequiredColumns() { return Collections.singletonList(new DoubleAnyAggregatorFactory(fieldName, fieldName, expression, macroTable)); }
Source:
<code><START> protected BaseLoadBalancerResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) { <END> this.dateCodec = dateCodec.iso8601(); this.builder = LoadBalancer.builder(); this.balancedServerResponseHandler = balancedServerResponseHandler; this.firewallListResponseHandler = firewallResponseHandler; }</code><technical_language>Add null checks for mandatory parameters. subclasses injection, this class subclasses built, check input parameters here</technical_language>

Target:
protected BaseLoadBalancerResponseHandler(DateCodecFactory dateCodec, ServerListResponseHandler balancedServerResponseHandler, FirewallListResponseHandler firewallResponseHandler) { if (dateCodec == null) throw new NullPointerException("DateCodecFactory cannot be null"); if (balancedServerResponseHandler == null) throw new NullPointerException("BalancedServerResponseHandler cannot be null"); if (firewallResponseHandler == null) throw new NullPointerException("FirewallListResponseHandler cannot be null"); this.dateCodec = dateCodec.iso8601(); this.builder = LoadBalancer.builder(); this.balancedServerResponseHandler = balancedServerResponseHandler; this.firewallListResponseHandler = firewallResponseHandler; }
Source:
<code>public void setUp() throws Exception { boolean ascii; if (protocol.equals("ascii")) { ascii = true; servers = asciiServers; } else if (protocol.equals("binary")) { ascii = false; servers = binaryServers; } else { throw new IllegalArgumentException(protocol); } MemcacheClientBuilder<String> builder = MemcacheClientBuilder.newStringClient() .withAddresses(servers.getAddresses()) .withConnections(1) .withMaxOutstandingRequests(100) .withMetrics(NoopMetrics.INSTANCE) .withRetry(false) .withReplyExecutor(Utils.SAME_THREAD_EXECUTOR) .withRequestTimeoutMillis(10*1000); if (ascii) { client = builder.connectAscii(); } else { client = builder.connectBinary(); } allClientsConnected(client); <START> ConnectFuture.connectFuture(client).get(); <END> System.out.println("Using client: " + client + ", protocol: " + protocol); servers.flush(); }</code><technical_language>this line redundant</technical_language>

Target:
public void setUp() throws Exception { boolean ascii; if (protocol.equals("ascii")) { ascii = true; servers = asciiServers; } else if (protocol.equals("binary")) { ascii = false; servers = binaryServers; } else { throw new IllegalArgumentException(protocol); } MemcacheClientBuilder<String> builder = MemcacheClientBuilder.newStringClient() .withAddresses(servers.getAddresses()) .withConnections(1) .withMaxOutstandingRequests(100) .withMetrics(NoopMetrics.INSTANCE) .withRetry(false) .withReplyExecutor(Utils.SAME_THREAD_EXECUTOR) .withRequestTimeoutMillis(10*1000); if (ascii) { client = builder.connectAscii(); } else { client = builder.connectBinary(); } allClientsConnected(client); System.out.println("Using client: " + client + ", protocol: " + protocol); servers.flush(); }
Source:
<code>public void setMainTabSelectedItem(VDS selectedItem) { driver.edit(getDetailModel()); <START> <END> habInventory.clear(); if (selectedItem != null && getDetailModel().getHbaDevices() != null) { for (EnumMap<HostHardwareGeneralModel.HbaDeviceKeys, String> hbaDevice : getDetailModel().getHbaDevices()) { GeneralFormPanel hbaFormPanel = new GeneralFormPanel() { { getElement().getStyle().setFloat(Float.LEFT); getElement().getStyle().setBorderWidth(1, Unit.PX); getElement().getStyle().setBorderStyle(BorderStyle.SOLID); getElement().getStyle().setBorderColor("black"); getElement().getStyle().setProperty("width", "auto"); } }; TextBoxLabel interfaceName = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.MODEL_NAME)); TextBoxLabel interfaceType = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.TYPE)); TextBoxLabel interfaceWWNN = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNN)); TextBoxLabel portWWPNs = new TextBoxLabel( hbaDevice.get(HostHardwareGeneralModel.HbaDeviceKeys.WWNPS)); FormBuilder hbaFormBuilder = new FormBuilder(hbaFormPanel, 1, 4); hbaFormBuilder.addFormItem(new FormItem(constants.hbaModelName(), interfaceName, 0, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaDeviceType(), interfaceType, 1, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWNN(), interfaceWWNN, 2, 0)); hbaFormBuilder.addFormItem(new FormItem(constants.hbaWWPNs(), portWWPNs, 3, 0)); habInventory.add(hbaFormPanel); } } formBuilder.update(getDetailModel()); }</code><technical_language>logic in this method is heavy for selection... Instead, prefer in a popup invoked General sub-tab. I guess a UX decision</technical_language>

Target:
public void setMainTabSelectedItem(VDS selectedItem) { driver.edit(getDetailModel()); refreshHBADeviceInfo(selectedItem); formBuilder.update(getDetailModel()); }
Source:
<code>public void retrieveFreeEntitlementsOfPools() { Pool pool1 = TestUtil.createPool(owner, product); poolCurator.create(pool1); Entitlement ent11 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent11); Entitlement ent12 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent12); Entitlement ent13 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent13); Pool pool2 = TestUtil.createPool(owner, product); poolCurator.create(pool2); Entitlement ent21 = new Entitlement(pool2, consumer, 1); entitlementCurator.create(ent21); Pool pool3 = TestUtil.createPool(owner, product); poolCurator.create(pool3); Entitlement ent31 = new Entitlement(pool3, consumer, 1); entitlementCurator.create(ent31); List<Entitlement> ents = poolCurator.retrieveFreeEntitlementsOfPools(Arrays.asList(pool1, pool2), true); assertEquals(4, ents.size()); <START> assertTrue(ents.contains(ent11)); <END> assertTrue(ents.contains(ent12)); assertTrue(ents.contains(ent13)); assertTrue(ents.contains(ent21)); assertTrue(!ents.contains(ent31)); }</code><technical_language>get more informative error messages for failing tests assertThat(ents, IsCollectionContaining.hasItem(ent1)); assertTrue is assertion of resort in opinion throws generic java.lang.AssertionError zero context wrong supposed happen</technical_language>

Target:
public void retrieveFreeEntitlementsOfPools() { Pool pool1 = TestUtil.createPool(owner, product); poolCurator.create(pool1); Entitlement ent11 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent11); Entitlement ent12 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent12); Entitlement ent13 = new Entitlement(pool1, consumer, 1); entitlementCurator.create(ent13); Pool pool2 = TestUtil.createPool(owner, product); poolCurator.create(pool2); Entitlement ent21 = new Entitlement(pool2, consumer, 1); entitlementCurator.create(ent21); Pool pool3 = TestUtil.createPool(owner, product); poolCurator.create(pool3); Entitlement ent31 = new Entitlement(pool3, consumer, 1); entitlementCurator.create(ent31); List<Entitlement> ents = poolCurator.retrieveFreeEntitlementsOfPools(Arrays.asList(pool1, pool2), true); assertEquals(4, ents.size()); assertThat(ents, hasItems(ent11, ent12, ent13, ent21)); assertThat(ents, not(hasItems(ent31))); }
Source:
<code>private void _endJam(boolean force) { ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); if (!jc.isRunning() && !force) { return; } requestBatchStart(); jc.stop(); getTeamModel("1").stopJam(); getTeamModel("2").stopJam(); setInOvertime(false); <START> if (pc.getTimeRemaining() < 30000) { <END> restartPcAfterTimeout = true; } if (pc.isRunning()) { _startLineup(); } else { _possiblyEndPeriod(); } requestBatchEnd(); }</code><technical_language>normal lineup time hardcoding</technical_language>

Target:
private void _endJam(boolean force) { ClockModel pc = getClockModel(Clock.ID_PERIOD); ClockModel jc = getClockModel(Clock.ID_JAM); if (!jc.isRunning() && !force) { return; } requestBatchStart(); jc.stop(); getTeamModel(Team.ID_1).stopJam(); getTeamModel(Team.ID_2).stopJam(); setInOvertime(false); if (pc.getTimeRemaining() < 30000) { restartPcAfterTimeout = true; } if (pc.isRunning()) { _startLineup(); } else { _possiblyEndPeriod(); } requestBatchEnd(); }
Source:
<code>public static CryptoRecord fromJSONRecord(ExtendedJSONObject jsonRecord) throws IOException, ParseException, NonObjectJSONException { String id = (String) jsonRecord.get(KEY_ID); String collection = (String) jsonRecord.get(KEY_COLLECTION); String jsonEncodedPayload = (String) jsonRecord.get(KEY_PAYLOAD); ExtendedJSONObject payload = ExtendedJSONObject.parseJSONObject(jsonEncodedPayload); CryptoRecord record = new CryptoRecord(payload); record.guid = id; record.collection = collection; if (jsonRecord.containsKey(KEY_MODIFIED)) { Long timestamp = jsonRecord.getTimestamp(KEY_MODIFIED); <START> if (timestamp == null) { <END> throw new IOException("timestamp could not be parsed"); } record.lastModified = timestamp.longValue(); } if (jsonRecord.containsKey(KEY_SORTINDEX)) { try { record.sortIndex = jsonRecord.getLong(KEY_SORTINDEX); } catch (Exception e) { throw new IOException("timestamp could not be parsed"); } } if (jsonRecord.containsKey(KEY_TTL)) { try { record.ttl = jsonRecord.getLong(KEY_TTL); } catch (Exception e) { throw new IOException("TTL could not be parsed"); } } return record; }</code><technical_language>check getTimestamp returns null throwing? I thought threw</technical_language>

Target:
public static CryptoRecord fromJSONRecord(ExtendedJSONObject jsonRecord) throws IOException, ParseException, NonObjectJSONException, RecordParseException { String id = (String) jsonRecord.get(KEY_ID); String collection = (String) jsonRecord.get(KEY_COLLECTION); String jsonEncodedPayload = (String) jsonRecord.get(KEY_PAYLOAD); ExtendedJSONObject payload = ExtendedJSONObject.parseJSONObject(jsonEncodedPayload); CryptoRecord record = new CryptoRecord(payload); record.guid = id; record.collection = collection; if (jsonRecord.containsKey(KEY_MODIFIED)) { Long timestamp = jsonRecord.getTimestamp(KEY_MODIFIED); if (timestamp == null) { throw new RecordParseException("timestamp could not be parsed"); } record.lastModified = timestamp.longValue(); } if (jsonRecord.containsKey(KEY_SORTINDEX)) { try { record.sortIndex = jsonRecord.getLong(KEY_SORTINDEX); } catch (Exception e) { throw new RecordParseException("timestamp could not be parsed"); } } if (jsonRecord.containsKey(KEY_TTL)) { try { record.ttl = jsonRecord.getLong(KEY_TTL); } catch (Exception e) { throw new RecordParseException("TTL could not be parsed"); } } return record; }
Source:
<code>public void setUp() throws Exception { workspaceName = testWorkspace.getName(); <START> createMap(); <END> URL resource = WorkspaceDetailsSingleMachineTest.this.getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); dashboard.open(); dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.selectWorkspaceItemName(workspaceName); workspaces.waitToolbarTitleName(workspaceName); workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW); workspaceDetails.checkStateOfWorkspace(RUNNING); workspaceDetails.clickOnStopWorkspace(); workspaceDetails.checkStateOfWorkspace(STOPPED); }</code><technical_language>this method replaced command: javascript private static final Map<String, Boolean> EXPECTED_INSTALLERS = ImmutableMap.<String, Boolean>builder() .put("C# language server", false) .put("Exec", false) .put("File sync", false) .put("Git credentials", false) .put("JSON language server", false) .put("PHP language server", false) .put("Python language server", false) .put("Simple Test language server", false) .put("SSH", false) .put("Terminal", true) .put("TypeScript language server", false) .put("Yaml language server", false) .build();</technical_language>

Target:
public void setUp() throws Exception { workspaceName = testWorkspace.getName(); URL resource = WorkspaceDetailsSingleMachineTest.this.getClass().getResource("/projects/guess-project"); testProjectServiceClient.importProject( testWorkspace.getId(), Paths.get(resource.toURI()), PROJECT_NAME, MAVEN_SPRING); dashboard.open(); dashboard.selectWorkspacesItemOnDashboard(); dashboard.waitToolbarTitleName("Workspaces"); workspaces.selectWorkspaceItemName(workspaceName); workspaces.waitToolbarTitleName(workspaceName); workspaceDetails.selectTabInWorkspaceMenu(OVERVIEW); workspaceDetails.checkStateOfWorkspace(RUNNING); workspaceDetails.clickOnStopWorkspace(); workspaceDetails.checkStateOfWorkspace(STOPPED); }
Source:
<code>private static ColumnRangeSelection allPossibleColumns() { byte[] startCol = SweepableCellsTable.SweepableCellsColumn.of(0L, -TargetedSweepMetadata.MAX_DEDICATED_ROWS) .persistToBytes(); byte[] endCol = SweepableCellsTable.SweepableCellsColumn.of(SweepQueueUtils.TS_FINE_GRANULARITY + 1, 0) .persistToBytes(); <START> return new ColumnRangeSelection(startCol, endCol); <END> }</code><technical_language>I this covers columns need to. component ranges 0 TS_FINE_GRANULARITY - 1 (both inclusive); component ranges -MAX_DEDICATED_ROWS MAX_DEDICATED_ROWS (both inclusive). tighter bounds for endCol (I SweepQueueUtils.TS_FINE_GRANULARITY - 1, TargetedSweepMetadata.MAX_DEDICATED_ROWS + 1) affect anything. suggest TS_FINE_GRANULARITY straight (i.e. + 1) for readability</technical_language>

Target:
private static ColumnRangeSelection allPossibleColumns() { byte[] startCol = SweepableCellsTable.SweepableCellsColumn.of(0L, -TargetedSweepMetadata.MAX_DEDICATED_ROWS) .persistToBytes(); byte[] endCol = SweepableCellsTable.SweepableCellsColumn.of(SweepQueueUtils.TS_FINE_GRANULARITY, 0) .persistToBytes(); return new ColumnRangeSelection(startCol, endCol); }
Source:
<code>public void close() { <START> this.adminClient.close(Duration.ZERO); <END> }</code><technical_language>default implementation of close() is wait forever. reasoning for Duration.ZERO here</technical_language>

Target:
public void close() { this.adminClient.close(); }
Source:
<code>public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); } return exec(buffer.toString()); } catch (IOException e) { <START> e.printStackTrace(); <END> return ""; } }</code><technical_language>Please print stack trace that. log properly ignore if information is useless</technical_language>

Target:
public static String execWithFile(String filename) { try (BufferedReader br = new BufferedReader(new FileReader(filename))) { StringBuffer buffer = new StringBuffer(); String line; while ((line = br.readLine()) != null) { buffer.append(line.concat("\n")); } return exec(buffer.toString()); } catch (IOException e) { return ""; } }
Source:
<code>public File serializeContext(TaskContext context, File directory) throws IOException { String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { <START> ForkerUtils.setSharedPermissions(file, false); <END> } return file; }</code><technical_language>create a separate method more expressive ? setSharedExecutablePermissions</technical_language>

Target:
public File serializeContext(TaskContext context, File directory) throws IOException { String tmpFilePrefix = Strings.padStart(context.getTaskId().value(), 3, '0'); File file = File.createTempFile(tmpFilePrefix, null, directory); try (ObjectOutputStream objectOutputStream = new ObjectOutputStream(new FileOutputStream(file))) { objectOutputStream.writeObject(context); } if (context.isRunAsUser()) { ForkerUtils.setSharedPermissions(file); } return file; }
Source:
<code>private boolean isNodeResolvingTo(ASTNode node, String signature) { if (signature == null || signature.trim().length() == 0) { return true; } IBinding b = resolveNodeToBinding(node); if (b instanceof ITypeBinding) { ITypeBinding tb = (ITypeBinding) b; if (tb.isPrimitive()) { <START> return (new String(b.getName()).equals(signature)); <END> } else { return resolvesReferenceBindingTo(tb, signature); } } return true; }</code><technical_language>getQualifiedName()</technical_language>

Target:
private boolean isNodeResolvingTo(ASTNode node, String signature) { if (signature == null || signature.trim().length() == 0) { return true; } ITypeBinding tb = resolveNodeToBinding(node); if (tb != null && tb.isPrimitive()) { return (new String(tb.getQualifiedName()).equals(signature)); } else { return resolvesReferenceBindingTo(tb, signature); } }
Source:
<code>public MeasurementData(final String label, final String value) { super(); this.label = label; this.value = value; <START> this.changed = false; <END> }</code><technical_language>easiest initiate field directly, needed, primitive false default</technical_language>

Target:
public MeasurementData(final String label, final String value) { super(); this.label = label; this.value = value; }
Source:
<code>public static String getSafeJsInt(String s){ for(int i = 0; i < s.length(); i++){ <START> if(!Character.isDigit(s.charAt(i))){ <END> return "null"; } } return s; }</code><technical_language>org.apache.commons.lang.math.NumberUtils.isNumber()</technical_language>

Target:
public static String getSafeJsInt(String s){ if(NumberUtils.isNumber(s)){ return s; }else{ return "null"; } }
Source:
<code>public void testBuilder() { String prefix = "prefix_"; String auth = "U,V,W"; String visibility = "U,W"; String user = "user"; String password = "password"; boolean useMock = true; boolean useInference = true; boolean displayPlan = false; <START> MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration().getBuilder() END> .setVisibilities(visibility) .setUseInference(useInference) .setDisplayQueryPlan(displayPlan) .setUseMockMongo(useMock) .setMongoCollectionPrefix(prefix) .setMongoDBName("dbname") .setMongoHost("host") .setMongoPort("1000") .setAuths(auth) .setMongoUser(user) .setMongoPassword(password).build(); Assert.assertEquals(conf.getTablePrefix(), prefix); Assert.assertTrue(Arrays.equals(conf.getAuths(), new String[] { "U", "V", "W" })); Assert.assertEquals(conf.getCv(), visibility); Assert.assertEquals(conf.isInfer(), useInference); Assert.assertEquals(conf.isDisplayQueryPlan(), displayPlan); Assert.assertEquals(conf.getMongoInstance(), "host"); Assert.assertEquals(conf.getBoolean(".useMockInstance", false), useMock); Assert.assertEquals(conf.getMongoPort(), "1000"); Assert.assertEquals(conf.getMongoDBName(), "dbname"); Assert.assertEquals(conf.getCollectionName(), "prefix_"); Assert.assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user); Assert.assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password); }</code><technical_language>nit: Unnecessary "//" characters</technical_language>

Target:
public void testBuilder() { String prefix = "prefix_"; String auth = "U,V,W"; String visibility = "U,W"; String user = "user"; String password = "password"; boolean useMock = true; boolean useInference = true; boolean displayPlan = false; MongoDBRdfConfiguration conf = new MongoDBRdfConfiguration().getBuilder() .setVisibilities(visibility) .setUseInference(useInference) .setDisplayQueryPlan(displayPlan) .setUseMockMongo(useMock) .setMongoCollectionPrefix(prefix) .setMongoDBName("dbname") .setMongoHost("host") .setMongoPort("1000") .setAuths(auth) .setMongoUser(user) .setMongoPassword(password).build(); assertEquals(conf.getTablePrefix(), prefix); assertTrue(Arrays.equals(conf.getAuths(), new String[] { "U", "V", "W" })); assertEquals(conf.getCv(), visibility); assertEquals(conf.isInfer(), useInference); assertEquals(conf.isDisplayQueryPlan(), displayPlan); assertEquals(conf.getMongoInstance(), "host"); assertEquals(conf.getBoolean(".useMockInstance", false), useMock); assertEquals(conf.getMongoPort(), "1000"); assertEquals(conf.getMongoDBName(), "dbname"); assertEquals(conf.getCollectionName(), "prefix_"); assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER), user); assertEquals(conf.get(MongoDBRdfConfiguration.MONGO_USER_PASSWORD), password); }
Source:
<code>public void testURLEncodeSpace() { String s1 = StringUtils.urlEncode("aaa bbb"); Assert.assertEquals(s1, "aaa%20bbb"); String s2 = StringUtils.urlEncode("fff+ggg"); <START> Assert.assertEquals(s2, "fff%2Bggg"); <END> }</code><technical_language>do a decode verify original string is read</technical_language>

Target:
public void testURLEncodeSpace() { String s1 = StringUtils.urlEncode("aaa bbb"); Assert.assertEquals(s1, "aaa%20bbb"); Assert.assertEquals("aaa bbb", StringUtils.urlDecode(s1)); String s2 = StringUtils.urlEncode("fff+ggg"); Assert.assertEquals(s2, "fff%2Bggg"); Assert.assertEquals("fff+ggg", StringUtils.urlDecode(s2)); }
Source:
<code>public ScanUtil.ScanOpts getScanOpts() { return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, help, <START> hexEncNonAscii, scanAccumuloTable, false, false); <END> }</code><technical_language>boolean arguments this kind of a bad idea; enums. idea booleans represent a glance, multiple sequential params of time prone bugs</technical_language>

Target:
public ScanUtil.ScanOpts getScanOpts() { EnumSet<ScanFlags> flags = EnumSet.noneOf(ScanFlags.class); ScanUtil.setFlag(flags, help, ScanFlags.HELP); ScanUtil.setFlag(flags, hexEncNonAscii, ScanFlags.HEX); ScanUtil.setFlag(flags, scanAccumuloTable, ScanFlags.ACCUMULO); return new ScanUtil.ScanOpts(startRow, endRow, columns, exactRow, rowPrefix, flags); }
Source:
<code>public NodeValue getAccValue() { double mode; if ( count == 0 ) return noValuesToMode ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } Arrays.sort(arrDouble); if(indexsize==0) { mode = Double.NaN; }else if(indexsize%2!=0) { mode = arrDouble[(indexsize/2)]; }else { mode = ((arrDouble[(indexsize/2)]+arrDouble[((indexsize/2)-1)])/2); } <START> return (NodeValue.makeDecimal((mode))); <END> }</code><technical_language>Extra ()</technical_language>

Target:
public NodeValue getAccValue() { double mode= Double.NaN; if ( count == 0 ) return noValuesToMode ; if ( super.errorCount != 0 ) return null ; int indexsize = collection.size(); double[] arrDouble = new double[indexsize]; for(int i=0; i<indexsize; i++){ arrDouble[i] = collection.get(i).getDouble(); } HashMap<Double,Integer> amode = new HashMap<Double,Integer>(); int max = 0; for(int i = 0; i < arrDouble.length; i++) { if (amode.get(arrDouble[i]) != null) { int count = amode.get(arrDouble[i]); count++; amode.put(arrDouble[i], count); if(count > max) { max = count; mode = arrDouble[i]; } } else { amode.put(arrDouble[i],1); if(mode==0) { mode = arrDouble[i]; } } } return NodeValue.makeDecimal(mode); }
Source:
<code>private void tunePollReportTimeouts( Map<String, IClientRouter> clientRouters, Set<String> failedNodes, Set<String> allConnectedNodes) { networkStretcher.modifyDecreasedPeriod(); tuneRoutersResponseTimeout( <START> clientRouters, allConnectedNodes, networkStretcher.getDecreasedPeriod() <END> ); tuneRoutersResponseTimeout(clientRouters, failedNodes, networkStretcher.getMaxPeriod()); }</code><technical_language>decreasing timeout here. modifyDecreasedPeriod decreases once</technical_language>

Target:
private void tunePollReportTimeouts( Map<String, IClientRouter> clientRouters, Set<String> failedNodes, Set<String> allConnectedNodes) { networkStretcher.modifyDecreasedPeriod(); tuneRoutersResponseTimeout( clientRouters, allConnectedNodes, networkStretcher.getCurrentPeriod() ); tuneRoutersResponseTimeout(clientRouters, failedNodes, networkStretcher.getMaxPeriod()); }
Source:
<code>public void tearDown() throws Exception { if (m_completeShutdown) { m_config.shutDown(); } else { Client client = getClient(); VoltTable tableList = client.callProcedure("@SystemCatalog", "TABLES").getResults()[0]; ArrayList<String> tableNames = new ArrayList<>(tableList.getRowCount()); int tableNameColIdx = tableList.getColumnIndex("TABLE_NAME"); int tableTypeColIdx = tableList.getColumnIndex("TABLE_TYPE"); while (tableList.advanceRow()) { String tableType = tableList.getString(tableTypeColIdx); <START> if (! tableType.equalsIgnoreCase("EXPORT")) { <END> tableNames.add(tableList.getString(tableNameColIdx)); } } for (String tableName : tableNames) { try { client.callProcedure("@AdHoc", "TRUNCATE TABLE " + tableName); } catch (Exception ex) } } for (final Client c : m_clients) { c.close(); } synchronized (m_clientChannels) { for (final SocketChannel sc : m_clientChannels) { try { ConnectionUtil.closeConnection(sc); } catch (final IOException e) { e.printStackTrace(); } } m_clientChannels.clear(); } m_clients.clear(); }</code><technical_language>views, want skip too? Is "view" a table type? sure</technical_language>

Target:
public void tearDown() throws Exception { if (m_completeShutdown) { m_config.shutDown(); } else { Client client = getClient(); VoltTable tableList = client.callProcedure("@SystemCatalog", "TABLES").getResults()[0]; ArrayList<String> tableNames = new ArrayList<>(tableList.getRowCount()); int tableNameColIdx = tableList.getColumnIndex("TABLE_NAME"); int tableTypeColIdx = tableList.getColumnIndex("TABLE_TYPE"); while (tableList.advanceRow()) { String tableType = tableList.getString(tableTypeColIdx); if (! tableType.equalsIgnoreCase("EXPORT")) { tableNames.add(tableList.getString(tableNameColIdx)); } } for (String tableName : tableNames) { try { client.callProcedure("@AdHoc", "DELETE FROM " + tableName); } catch (ProcCallException pce) { if (! pce.getMessage().contains("Illegal to modify a materialized view.")) { fail("Hit an exception when cleaning up tables between tests: " + pce.getMessage()); } } } } for (final Client c : m_clients) { c.close(); } synchronized (m_clientChannels) { for (final SocketChannel sc : m_clientChannels) { try { ConnectionUtil.closeConnection(sc); } catch (final IOException e) { e.printStackTrace(); } } m_clientChannels.clear(); } m_clients.clear(); }
Source:
<code>public Optional<CommandMapping> register(AbstractCommandModule module, CommandCallable callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(module, "module"); checkState(module.canBeInstalledOrConfigured(false), "The provided command module has been fully configured and " + "cannot be used to register commands."); PluginContainer container = module.getPlugin(); synchronized (this.lock) { List<String> aliasesWithPrefix = this.calculatePrefixesWithNamespace(container, aliases); Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback, <START> (cc, al) -> new ImmutableModuleCommandMapping(module, callable, aliases.get(0), aliases.subList(1, aliases.size()))); <END> if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }</code><technical_language>In API similar extracted out a field, if wanted done not. <LINK_0></technical_language>

Target:
public Optional<CommandMapping> register(AbstractCommandModule module, CommandCallable callable, List<String> aliases, Function<List<String>, List<String>> callback) { checkNotNull(module, "module"); checkState(module.canBeInstalledOrConfigured(false), "The provided command module has been fully configured and " + "cannot be used to register commands."); PluginContainer container = module.getPlugin(); synchronized (this.lock) { List<String> aliasesWithPrefix = this.calculatePrefixesWithNamespace(container, callable, aliases); Optional<CommandMapping> mapping = this.dispatcher.register(callable, aliasesWithPrefix, callback, (cc, al) -> new ImmutableModuleCommandMapping(module, callable, aliases.get(0), aliases.subList(1, aliases.size()))); if (mapping.isPresent()) { this.owners.put(container, mapping.get()); } return mapping; } }
Source:
<code>public void refreshStereotypeStructure() { <START> if (stereoList.size() != 0) { <END> for (Stereotype stereotype : stereoList) { refreshStereotypeLabelStructure(stereotype); refreshStereotypeBraceStructure(stereotype); } } }</code><technical_language>List#isEmpty()</technical_language>

Target:
public void refreshStereotypeStructure() { if (!stereotypeList.isEmpty()) { for (Stereotype stereotype : stereotypeList) { refreshStereotypeLabelStructure(stereotype); refreshStereotypeBraceStructure(stereotype); } } }
Source:
<code>private Object[][] testRemoveContentsAfterProvider() { return new Object[][] { { span(chunk(6,10), chunk(11,15)), null, span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6)), span() }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,7)), span(chunk(6,7)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,9)), span(chunk(6,9)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,10)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,11)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,12)), span(chunk(6,10), chunk(11,12)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,15)), span(chunk(6,10), chunk(11,15)) }, <START> { span(chunk(6,10), chunk(11,15)), span(chunk(0,16)), span(chunk(6,10), chunk(11,15)) }, <END> }; }</code><technical_language>missing (and in test cases for removeContentsBefore() well) test cases in cutoff BAMFileSpan consists of multiple chunks. mentioned above, I a bug in removeContentsAfter() in case</technical_language>

Target:
private Object[][] testRemoveContentsAfterProvider() { return new Object[][] { { span(chunk(6,10), chunk(11,15)), null, span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6)), span() }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,7)), span(chunk(6,7)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,9)), span(chunk(6,9)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,10)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,11)), span(chunk(6,10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,12)), span(chunk(6,10), chunk(11,12)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,15)), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,16)), span(chunk(6,10), chunk(11,15)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6), chunk(7,10)), span(chunk(6, 10)) }, { span(chunk(6,10), chunk(11,15)), span(chunk(0,6), chunk(7,16)), span(chunk(6, 10), chunk(11,15)) }, }; }
Source:
<code>protected void processTuple(GenericRecord tuple) { try { Object obj = getPOJOFromGenericRecord(tuple, getCls()); if (obj != null) { output.emit(obj); recordCnt++; } } catch (InstantiationException | IllegalAccessException e) { <START> LOG.error("Could not initialize object of class - " + getClass().getName()); <END> errorCnt++; } }</code><technical_language>Please do hide exception, atleast log exception</technical_language>

Target:
protected void processTuple(GenericRecord tuple) { try { Object obj = getPOJOFromGenericRecord(tuple); if (obj != null) { output.emit(obj); recordCount++; } else if (errorPort.isConnected()) { errorPort.emit(tuple); errorCount++; } } catch (InstantiationException | IllegalAccessException e) { LOG.error("Could not initialize object of class -" + getClass().getName(), e); errorCount++; } }
Source:
<code>public Source getSource() { if (fileSource == null) { FileOrRendition thizz = this; fileSource = new Source() { Long size = null; <START> URLConnection connection = null; <END> @Override public String getName() { return name; } private URLConnection getConnection() throws IOException { if (connection == null) { URL theUrl = new URL(url); connection = theUrl.openConnection(); } return connection; } @Override public InputStream getStream() throws IOException { URLConnection c = getConnection(); connection = null; return c.getInputStream(); } @Override public long getLength() { if (size == null) { try { size = getConnection().getContentLengthLong(); } catch (IOException ex) { Logger.getLogger(FileOrRendition.class.getName()).log(Level.SEVERE, null, ex); size = -1L; } } return size; } @Override public HierarchialElement getElement() { return thizz; } }; } return fileSource; }</code><technical_language>*important* please HttpClient here, URLConnection, proxy configuration AEM is leveraged. Also, configurable timeouts set (both connect socket)</technical_language>

Target:
public Source getSource() { if (fileSource == null) { FileOrRendition thizz = this; if (url.toLowerCase().startsWith("http")) { fileSource = new HttpConnectionSource(thizz); } else { fileSource = new UrlConnectionSource(thizz); } } return fileSource; }
Source:
<code>public void terminatingTransactionMustEagerlyReleaseTheirLocks() throws Exception { AtomicBoolean nodeLockAcquired = new AtomicBoolean(); AtomicBoolean lockerDone = new AtomicBoolean(); BinaryLatch lockerPause = new BinaryLatch(); long nodeId; try ( Transaction tx = database.beginTx() ) { nodeId = database.createNode().getId(); tx.success(); } Future<?> locker = executor.submit( () -> { try ( Transaction tx = database.beginTx( 100, TimeUnit.MILLISECONDS ) ) { Node node = database.getNodeById( nodeId ); tx.acquireReadLock( node ); nodeLockAcquired.set( true ); lockerPause.await(); } lockerDone.set( true ); } ); boolean proceed; do { proceed = nodeLockAcquired.get(); } while ( !proceed ); <START> Thread.sleep( 150 ); END> assertFalse( lockerDone.get() ); try ( Transaction tx = database.beginTx() ) { tx.acquireWriteLock( database.getNodeById( nodeId ) ); tx.success(); } lockerPause.release(); locker.get(); assertTrue( lockerDone.get() ); }</code><technical_language>reliable timeout for build agents</technical_language>

Target:
public void terminatingTransactionMustEagerlyReleaseTheirLocks() throws Exception { AtomicBoolean nodeLockAcquired = new AtomicBoolean(); AtomicBoolean lockerDone = new AtomicBoolean(); BinaryLatch lockerPause = new BinaryLatch(); long nodeId; try ( Transaction tx = database.beginTx() ) { nodeId = database.createNode().getId(); tx.success(); } Future<?> locker = executor.submit( () -> { try ( Transaction tx = database.beginTx( 100, TimeUnit.MILLISECONDS ) ) { Node node = database.getNodeById( nodeId ); tx.acquireReadLock( node ); nodeLockAcquired.set( true ); lockerPause.await(); } lockerDone.set( true ); } ); boolean proceed; do { proceed = nodeLockAcquired.get(); } while ( !proceed ); Thread.sleep( 150 ); database.resolveDependency( KernelTransactionTimeoutMonitor.class ).run(); assertFalse( lockerDone.get() ); try ( Transaction tx = database.beginTx() ) { tx.acquireWriteLock( database.getNodeById( nodeId ) ); tx.success(); } lockerPause.release(); locker.get(); assertTrue( lockerDone.get() ); }
Source:
<code>public void startPolicyEnforcement() throws IOException { if (m_pbd.getUsageSpecificLog().isDebugEnabled()) { m_pbd.getUsageSpecificLog().debug("Starting time based retention policy enforcement with retainMillis=" + m_retainMillis + " for PBD " + m_pbd.getNonce()); } m_reader = m_pbd.openForRead(CURSOR_NAME); <START> scheduleTaskFor(m_pbd.getNonce(), ()->deleteOldSegments(), 0); <END> }</code><technical_language>do this::deleteOldSegments for callable. is more efficient lambda form</technical_language>

Target:
public void startPolicyEnforcement() throws IOException { if (m_pbd.getUsageSpecificLog().isDebugEnabled()) { m_pbd.getUsageSpecificLog().debug("Starting time based retention policy enforcement with retainMillis=" + m_retainMillis + " for PBD " + m_pbd.getNonce()); } m_reader = m_pbd.openForRead(CURSOR_NAME); scheduleTaskFor(m_pbd.getNonce(), this::deleteOldSegments, 0); }