auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public StateDescriptionFragment build() { <START> return new StateDescriptionFragment() { <END> @Override public @Nullable BigDecimal getMinimum() { return minimum; } @Override public @Nullable BigDecimal getMaximum() { return maximum; } @Override public @Nullable BigDecimal getStep() { return step; } @Override public @Nullable String getPattern() { return pattern; } @Override public @Nullable Boolean isReadOnly() { return readOnly; } @Override public @Nullable List<StateOption> getOptions() { return options; } @Override public @Nullable StateDescription toStateDescription() { if (minimum == null && maximum == null && step == null && pattern == null && options == null) { return null; } final Boolean ro = readOnly; return new StateDescription(minimum, maximum, step, pattern, ro == null ? false : ro.booleanValue(), options); } }; }</code><technical_language>Hm, I expect if I call build a fragment I change fragment that, change previously build reference..</technical_language>

Target:
public StateDescriptionFragment build() { return new StateDescriptionFragmentImpl(fragment); }
Source:
<code>private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology clusterTopology) { <START> Map<String, Set<String>> hgBindngs = Maps.newHashMap(); <END> for (Map.Entry<String, HostGroupInfo> hgEnrty: clusterTopology.getHostGroupInfo().entrySet()) { hgBindngs.put(hgEnrty.getKey(), Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getHostNames())); } return hgBindngs; }</code><technical_language>Typo in hgBindngs, hgBindings</technical_language>

Target:
private Map<String, Set<String>> gatherHostGroupBindings(ClusterTopology clusterTopology) { Map<String, Set<String>> hgBindings = Maps.newHashMap(); for (Map.Entry<String, HostGroupInfo> hgEnrty: clusterTopology.getHostGroupInfo().entrySet()) { hgBindings.put(hgEnrty.getKey(), Sets.newCopyOnWriteArraySet(hgEnrty.getValue().getHostNames())); } return hgBindings; }
Source:
<code>public Future<Void> start() { logger.info("Starting LaunchDarkly polling client with interval: " + config.pollingIntervalMillis + " milliseconds"); final VeryBasicFuture initFuture = new VeryBasicFuture(); scheduler = Executors.newScheduledThreadPool(1); scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { store.init(requestor.makeAllRequest(true)); <START> if (!initialized) { <END> logger.info("Initialized LaunchDarkly client."); initialized = true; initFuture.completed(null); } } catch (IOException e) { logger.error("Encountered exception in LaunchDarkly client when retrieving update", e); } } }, 0L, config.pollingIntervalMillis, TimeUnit.MILLISECONDS); return initFuture; }</code><technical_language>Atomicity violation. This checks state updates in a non-atomic fashion</technical_language>

Target:
public Future<Void> start() { logger.info("Starting LaunchDarkly polling client with interval: " + config.pollingIntervalMillis + " milliseconds"); final VeryBasicFuture initFuture = new VeryBasicFuture(); ThreadFactory threadFactory = new ThreadFactoryBuilder() .setNameFormat("LaunchDarkly-PollingProcessor-%d") .build(); scheduler = Executors.newScheduledThreadPool(1, threadFactory); scheduler.scheduleAtFixedRate(new Runnable() { @Override public void run() { try { store.init(requestor.makeAllRequest(true)); if (!initialized.getAndSet(true)) { logger.info("Initialized LaunchDarkly client."); initFuture.completed(null); } } catch (IOException e) { logger.error("Encountered exception in LaunchDarkly client when retrieving update", e); } } }, 0L, config.pollingIntervalMillis, TimeUnit.MILLISECONDS); return initFuture; }
Source:
<code>public void testNewLease() { SimpleArrayAllocator allocator = new SimpleArrayAllocator(5); Deque<int[]> arrayList = new ArrayDeque<>(); for (int i = 0; i < 5; i++) { arrayList.push(allocator.borrowIntArray(10)); } assertEquals(allocator.getBorrowedArrays(), 5); <START> assertEquals(allocator.getEstimatedSizeInBytes(), 280); <END> for (int i = 0; i < 5; i++) { allocator.returnArray(arrayList.pop()); } assertEquals(allocator.getBorrowedArrays(), 0); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); int[] borrowed = allocator.borrowIntArray(101); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); allocator.returnArray(borrowed); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); }</code><technical_language>280 -> sizeOfIntArray(10) * 5 for consistency L43</technical_language>

Target:
public void testNewLease() { SimpleArrayAllocator allocator = new SimpleArrayAllocator(5); Deque<int[]> arrayList = new ArrayDeque<>(); for (int i = 0; i < 5; i++) { arrayList.push(allocator.borrowIntArray(10)); } assertEquals(allocator.getBorrowedArrayCount(), 5); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); for (int i = 0; i < 5; i++) { allocator.returnArray(arrayList.pop()); } assertEquals(allocator.getBorrowedArrayCount(), 0); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(10) * 5); int[] borrowed = allocator.borrowIntArray(101); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); allocator.returnArray(borrowed); assertEquals(allocator.getEstimatedSizeInBytes(), sizeOfIntArray(101)); }
Source:
<code>public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s ", this.login); final Req req; if (comment.body().trim().startsWith(prefix)) { req = this.origin.understand(comment, home); <START> } else if (comment.body().trim().contains(prefix)) { <END> new Answer(comment).post( String.format( QnReferredTo.PHRASES.getString("QnReferredTo.mentioned"), prefix ) ); Logger.info(this, "mention found in #%d", comment.issue().number()); req = Req.DONE; } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }</code><technical_language>is need trim() for a string</technical_language>

Target:
public Req understand(final Comment.Smart comment, final URI home) throws IOException { final String prefix = String.format("@%s ", this.login); final Req req; if (comment.body().trim().startsWith(prefix)) { req = this.origin.understand(comment, home); } else if (comment.body().contains(prefix)) { new Answer(comment).post( String.format( QnReferredTo.PHRASES.getString("QnReferredTo.mentioned"), prefix ) ); Logger.info(this, "mention found in #%d", comment.issue().number()); req = Req.DONE; } else { Logger.info( this, "comment #%d in %s#%d is not for me (no \"%s\" prefix)", comment.number(), comment.issue().repo().coordinates(), comment.issue().number(), prefix ); req = Req.EMPTY; } return req; }
Source:
<code>private RevCommit getRevCommit(IFileRevision revision) { if (revision instanceof CommitFileRevision) { return ((CommitFileRevision) revision).getRevCommit(); } IResourceVariant variant = <START> Adapters.adapt((revision), <END> IResourceVariant.class); if (variant instanceof GitRemoteResource) { final RevCommit commit = ((GitRemoteResource) variant) .getCommitId(); try { return walk.parseCommit(commit); } catch (IOException e) { Activator .logError( NLS.bind(CoreText.GitFileHistory_invalidCommit, commit.getName(), resource.getName()), e); } } return null; }</code><technical_language>Extra parentheses away, too</technical_language>

Target:
private RevCommit getRevCommit(IFileRevision revision) { if (revision instanceof CommitFileRevision) { return ((CommitFileRevision) revision).getRevCommit(); } IResourceVariant variant = Adapters.adapt(revision, IResourceVariant.class); if (variant instanceof GitRemoteResource) { final RevCommit commit = ((GitRemoteResource) variant) .getCommitId(); try { return walk.parseCommit(commit); } catch (IOException e) { Activator .logError( NLS.bind(CoreText.GitFileHistory_invalidCommit, commit.getName(), resource.getName()), e); } } return null; }
Source:
<code>public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "created.")); String[] args2 = {"check", "credential1", "-provider", jceksProvider}; ArrayList<String> password = new ArrayList<String>(); password.add("p@ssw0rd"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); <START> assertTrue(outContent.toString().contains("Password match success for credential1.")); <END> String[] args3 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args3); assertEquals(0, rc); assertTrue(outContent.toString().contains("credential1 has been successfully " + "deleted.")); }</code><technical_language>Add error message includes failing string if conditions met. FWIW moving AssertJ assertions -if happy them, feel free classic junit asserts</technical_language>

Target:
public void testPromptForCredential() throws Exception { String[] args1 = {"create", "credential1", "-provider", jceksProvider}; ArrayList<String> passwords = new ArrayList<String>(); passwords.add("p@ssw0rd"); passwords.add("p@ssw0rd"); int rc = 0; CredentialShell shell = new CredentialShell(); shell.setConf(new Configuration()); shell.setPasswordReader(new MockPasswordReader(passwords)); rc = shell.run(args1); assertEquals(0, rc); assertOutputContains("credential1 has been successfully created."); String[] args2 = {"check", "credential1", "-provider", jceksProvider}; ArrayList<String> password = new ArrayList<String>(); password.add("p@ssw0rd"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); assertOutputContains("Password match success for credential1."); ArrayList<String> passwordError = new ArrayList<String>(); passwordError.add("p@ssw0rderr"); shell.setPasswordReader(new MockPasswordReader(password)); rc = shell.run(args2); assertEquals(0, rc); assertOutputContains("Password match failed for credential1."); String[] args3 = {"delete", "credential1", "-f", "-provider", jceksProvider}; rc = shell.run(args3); assertEquals(0, rc); assertOutputContains("credential1 has been successfully deleted."); }
Source:
<code>public void setTimestamp() { long timestamp = System.currentTimeMillis(); <START> this.put("timestamp", timestamp); <END> this.timestamp = timestamp; }</code><technical_language>call this.setTimestamp(timestamp) here</technical_language>

Target:
public void setTimestamp() { long timestamp = System.currentTimeMillis(); this.setTimestamp(timestamp); }
Source:
<code>public <T extends IdentifiableBean> Result<T> get(StandardId id, Class<T> type) { Optional<IdentifiableBean> opt = sourceProvider.get(id); return opt.map(b -> { Class<? extends IdentifiableBean> receivedType = b.getClass(); return type.isAssignableFrom(receivedType) ? Result.success(type.cast(b)) : Result.<T>failure(FailureReason.MISSING_DATA, "Found data with id: of type: but expected type was: {}", <START> id, receivedType.getSimpleName(), type.getSimpleName()); <END> }).orElse(Result.<T>failure(FailureReason.MISSING_DATA, "Unable to find data with id: {}", id)); }</code><technical_language>Is safer getName() here? fondness for defining classes name in packages</technical_language>

Target:
public <T extends IdentifiableBean> Result<T> get(StandardId id, Class<T> type) { Optional<IdentifiableBean> opt = sourceProvider.get(id); return opt .map(b -> attemptTypeConversion(id, type, b)) .orElse(createMissingDataFailure(id)); }
Source:
<code>public void testPropertiesViewTitleOnDiagramDialectEditorWithContributions() { addContributions(); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), DIAGRAM_DESC_NAME, "new " + DIAGRAM_DESC_NAME, DDiagram.class); SWTBotView propertiesView = bot.viewByTitle("Properties"); SWTBot propertiesViewBot = propertiesView.bot(); try { setSiriusSheetLabelProvider(propertiesView); editor.select("test"); editor.setFocus(); SWTBotCLabel titleLabelBot = propertiesViewBot.clabel(); String assertMessage = "On DDiagramElement selection, the DiagramLabelProvider should be used"; assertEquals(assertMessage, DiagramLabelProvider.LABEL, titleLabelBot.getText()); assertTrue(assertMessage, ImageEquality.areEqualImages(DIAGRAM_IMAGE, titleLabelBot.image())); } finally { <START> resetSiriusSheetLabelProvider(propertiesView); <END> editor.close(); } }</code><technical_language>reset if replaced label provider</technical_language>

Target:
public void testPropertiesViewTitleOnDiagramDialectEditorWithContributions() { addContributions(); editor = (SWTBotSiriusDiagramEditor) openRepresentation(localSession.getOpenedSession(), DIAGRAM_DESC_NAME, "new " + DIAGRAM_DESC_NAME, DDiagram.class); SWTBotView propertiesView = bot.viewByTitle("Properties"); SWTBot propertiesViewBot = propertiesView.bot(); Object oldLabelProvider = null; try { oldLabelProvider = setSiriusSheetLabelProvider(propertiesView); editor.select("test"); editor.setFocus(); SWTBotCLabel titleLabelBot = propertiesViewBot.clabel(); String assertMessage = "On DDiagramElement selection, the DiagramLabelProvider should be used"; assertEquals(assertMessage, DiagramLabelProvider.LABEL, titleLabelBot.getText()); assertTrue(assertMessage, ImageEquality.areEqualImages(DIAGRAM_IMAGE, titleLabelBot.image())); } finally { resetSiriusSheetLabelProvider(propertiesView, oldLabelProvider); editor.close(); } }
Source:
<code>private List<SimpleObject> createListResponse(List<ConceptSearchResult> resultList, ConceptSource conceptSource) { List<SimpleObject> allDiagnoses = new ArrayList<SimpleObject>(); for (ConceptSearchResult diagnosis : resultList) { SimpleObject diagnosisObject = new SimpleObject(); diagnosisObject.add("conceptName", diagnosis.getConcept().getName().getName()); diagnosisObject.add("conceptUuid", diagnosis.getConcept().getUuid()); <START> diagnosisObject.add("matchedName", diagnosis.getConceptName()!=null ? diagnosis.getConceptName().getName() : null); <END> Concept concept = diagnosis.getConcept(); ConceptReferenceTerm term = getConceptReferenceTermByConceptSource(concept, conceptSource); if(term != null) diagnosisObject.add("code", term.getCode()); allDiagnoses.add(diagnosisObject); } return allDiagnoses; }</code><technical_language>is of adding a matched name of null</technical_language>

Target:
private List<SimpleObject> createListResponse(List<ConceptSearchResult> resultList, ConceptSource conceptSource) { List<SimpleObject> allDiagnoses = new ArrayList<SimpleObject>(); for (ConceptSearchResult diagnosis : resultList) { SimpleObject diagnosisObject = new SimpleObject(); diagnosisObject.add("conceptName", diagnosis.getConcept().getName().getName()); diagnosisObject.add("conceptUuid", diagnosis.getConcept().getUuid()); if(diagnosis.getConceptName()!=null) { diagnosisObject.add("matchedName", diagnosis.getConceptName().getName()); } ConceptReferenceTerm term = getConceptReferenceTermByConceptSource(diagnosis.getConcept(), conceptSource); if(term != null) { diagnosisObject.add("code", term.getCode()); } allDiagnoses.add(diagnosisObject); } return allDiagnoses; }
Source:
<code>private static void drawRangeDecorators(Rectangle rect, GC gc, int x1, int x2, int align) { <START> int y1 = align == SWT.BOTTOM ? rect.y + rect.height - 9 : 5; <END> int y2 = align == SWT.BOTTOM ? rect.y + rect.height - 5 : 9; int ym = (y1 + y2) / 2; if (x1 >= rect.x) { gc.drawLine(x1 - 2, y1, x1 - 2, y2); gc.drawLine(x1 - 3, y1, x1 - 1, y1); gc.drawLine(x1 + 1, y1, x1 + 1, y2); } if (x2 >= rect.x && Math.abs(x2 - x1 - 2) > 3) { gc.drawLine(x2 - 2, y1, x2 - 2, y2); gc.drawLine(x2 - 3, y1, x2 - 1, y1); } if (x2 >= rect.x && Math.abs(x2 - x1 + 3) > 3) { gc.drawLine(x2 + 1, y1, x2 + 3, y1); gc.drawLine(x2 + 3, y1, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 1, y2); gc.drawLine(x2 + 1, y2, x2 + 3, y2); } }</code><technical_language>y1 rect.y + TICK_HEIGHT rect.y + rect.height - TICK_HEIGHT - DECORATOR_HEIGHT y2 y1 + DECORATOR_HEIGHT</technical_language>

Target:
private static void drawRangeDecorators(Rectangle rect, GC gc, int x1, int x2, int align) { int y1 = align == SWT.BOTTOM ? rect.y + rect.height - TICK_HEIGHT - DECORATOR_HEIGHT: TICK_HEIGHT; int y2 = y1 + DECORATOR_HEIGHT; int ym = y1 + DECORATOR_HEIGHT / 2; if (x1 >= rect.x) { gc.drawLine(x1 - 2, y1, x1 - 2, y2); gc.drawLine(x1 - 3, y1, x1 - 1, y1); gc.drawLine(x1 + 1, y1, x1 + 1, y2); } if (x2 >= rect.x && Math.abs(x2 - x1 - 2) > 3) { gc.drawLine(x2 - 2, y1, x2 - 2, y2); gc.drawLine(x2 - 3, y1, x2 - 1, y1); } if (x2 >= rect.x && Math.abs(x2 - x1 + 3) > 3) { gc.drawLine(x2 + 1, y1, x2 + 3, y1); gc.drawLine(x2 + 3, y1, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 3, ym); gc.drawLine(x2 + 1, ym, x2 + 1, y2); gc.drawLine(x2 + 1, y2, x2 + 3, y2); } }
Source:
<code>public void testTransform() throws Exception { <START> TupleExpression expression1 = new DomainExpression<Integer>(1, Domain.singleValue(BIGINT, 1L)); <END> TupleExpression expression2 = new DomainExpression<Integer>(2, Domain.singleValue(BIGINT, 2L)); TupleExpression expression3 = new DomainExpression<Integer>(3, Domain.singleValue(BIGINT, 3L)); TupleExpression combinedExpression = new NotExpression<Integer>( new OrExpression<Integer>(expression3, new AndExpression<Integer>(expression1, expression2))); TupleExpression<String> transformed = combinedExpression.transform(Object::toString); TupleExpression expression1Transformed = new DomainExpression<String>("1", Domain.singleValue(BIGINT, 1L)); TupleExpression expression2Transformed = new DomainExpression<String>("2", Domain.singleValue(BIGINT, 2L)); TupleExpression expression3Transformed = new DomainExpression<String>("3", Domain.singleValue(BIGINT, 3L)); TupleExpression expectedExpression = new NotExpression<String>( new OrExpression<String>(expression3Transformed, new AndExpression<Integer>(expression1Transformed, expression2Transformed))); assertEquals(transformed, expectedExpression); }</code><technical_language>Extract expressions reuse them. Also, rename more meaningful name</technical_language>

Target:
public void testTransform() throws Exception { TupleExpression integerExpression1 = new DomainExpression<Integer>(1, Domain.singleValue(BIGINT, 1L)); TupleExpression integerExpression2 = new DomainExpression<Integer>(2, Domain.singleValue(BIGINT, 2L)); TupleExpression integerExpression3 = new DomainExpression<Integer>(3, Domain.singleValue(BIGINT, 3L)); TupleExpression combinedExpression = new NotExpression<Integer>( new OrExpression<Integer>(integerExpression3, new AndExpression<Integer>(integerExpression1, integerExpression2))); TupleExpression<String> transformed = combinedExpression.transform(Object::toString); TupleExpression expression1Transformed = new DomainExpression<String>("1", Domain.singleValue(BIGINT, 1L)); TupleExpression expression2Transformed = new DomainExpression<String>("2", Domain.singleValue(BIGINT, 2L)); TupleExpression expression3Transformed = new DomainExpression<String>("3", Domain.singleValue(BIGINT, 3L)); TupleExpression expectedExpression = new NotExpression<String>( new OrExpression<String>(expression3Transformed, new AndExpression<Integer>(expression1Transformed, expression2Transformed))); assertEquals(transformed, expectedExpression); }
Source:
<code>public void concurrentInvalidate() throws Exception { for (int i = 0; i < 50; i++) { reset(connectionProvider); getConnection(); Latch latch = new Latch(); <START> new Thread(() -> { <END> try { latch.await(); managedConnection.invalidate(); } catch (InterruptedException e) { throw new RuntimeException(e); } }).start(); latch.release(); managedConnection.invalidate(); verify(connectionProvider).disconnect(any()); } }</code><technical_language>executor shutdown it, join threads created end</technical_language>

Target:
public void concurrentInvalidate() throws Exception { for (int i = 0; i < 50; i++) { reset(connectionProvider); getConnection(); Latch latch = new Latch(); Thread t = new Thread(() -> { try { latch.await(); managedConnection.invalidate(); } catch (InterruptedException e) { currentThread().interrupt(); throw new RuntimeException(e); } }); t.start(); try { latch.release(); managedConnection.invalidate(); verify(connectionProvider).disconnect(any()); } finally { t.join(); } } }
Source:
<code>private HashSet<RelSet> getParentSets() { HashSet<RelSet> results = new HashSet<>(); <START> VolcanoPlanner planner = (VolcanoPlanner) this.originalRel.getCluster().getPlanner(); <END> assert planner != null; for (RelNode rel : getParentRels()) { RelSet set = planner.getSet(rel); if (set.id != this.id) { results.add(set); } } return results; }</code><technical_language>If is pruned, skip</technical_language>

Target:
private HashSet<RelSet> getParentSets() { HashSet<RelSet> results = new HashSet<>(); VolcanoPlanner planner = (VolcanoPlanner) this.originalRel.getCluster().getPlanner(); assert planner != null; for (RelNode rel : getParentRels()) { RelSet set = planner.getSet(rel); if (set.id != this.id && !planner.isPruned(rel)) { results.add(set); } } return results; }
Source:
<code>public String getShortDescription() { String description = '<a href="' + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; description += this.getDestinationRepositoryName() + "/pull-request/" + this.getPullRequestId(); description += '">#' + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; <START> return description; <END> }</code><technical_language>Thank for PR. I compile it. fix this? --- a/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketCause.java +++ b/src/main/java/bitbucketpullrequestbuilder/bitbucketpullrequestbuilder/BitbucketCause.java @@ -83,9 +83,9 @@ public class BitbucketCause extends { @Override public String getShortDescription() { - String description = '<a href="' + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; + String description = "<a href=\"" + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; description += this.getDestinationRepositoryName() + "/pull-request/" + this.getPullRequestId(); - description += '">#' + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; + description += "\">#" + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; return description; } }</technical_language>

Target:
public String getShortDescription() { String description = "<a href=\"" + BITBUCKET_URL + this.getDestinationRepositoryOwner() + "/"; description += this.getDestinationRepositoryName() + "/pull-request/" + this.getPullRequestId(); description += "\">#" + this.getPullRequestId() + " " + this.getPullRequestTitle() + "</a>"; return description; }
Source:
<code><START> ResourceMonitor getOrCreateResourceMonitor(String resourceName) { <END> try { if (!_resourceMonitorMap.containsKey(resourceName)) { synchronized (_resourceMonitorMap) { if (!_resourceMonitorMap.containsKey(resourceName)) { String beanName = getResourceBeanName(resourceName); ResourceMonitor bean = new ResourceMonitor(_clusterName, resourceName, getObjectName(beanName)); _resourceMonitorMap.put(resourceName, bean); } } } } catch (JMException ex) { LOG.error("Fail to register resource mbean, resource: " + resourceName); } return _resourceMonitorMap.get(resourceName); }</code><technical_language>Why</technical_language>

Target:
private ResourceMonitor getOrCreateResourceMonitor(String resourceName) { try { if (!_resourceMonitorMap.containsKey(resourceName)) { synchronized (_resourceMonitorMap) { if (!_resourceMonitorMap.containsKey(resourceName)) { String beanName = getResourceBeanName(resourceName); ResourceMonitor bean = new ResourceMonitor(_clusterName, resourceName, getObjectName(beanName)); _resourceMonitorMap.put(resourceName, bean); } } } } catch (JMException ex) { LOG.error("Fail to register resource mbean, resource: " + resourceName); } return _resourceMonitorMap.get(resourceName); }
Source:
<code>private String requestPath(Uri requestUri) { if (!requestUri.getPath().isEmpty()) return requestUri.getPath(); else <START> return "/"; <END> }</code><technical_language>Please ternary operator ?</technical_language>

Target:
private String requestPath(Uri requestUri) { return requestUri.getPath().isEmpty() ? "/" : requestUri.getPath(); }
Source:
<code>private static boolean isDeviceDarkThemeEnabled(final Context context) { <START> int deviceTheme = context.getResources().getConfiguration().uiMode <END> & Configuration.UI_MODE_NIGHT_MASK; switch (deviceTheme) { case Configuration.UI_MODE_NIGHT_YES: return true; case Configuration.UI_MODE_NIGHT_UNDEFINED: case Configuration.UI_MODE_NIGHT_NO: default: return false; } }</code><technical_language>final</technical_language>

Target:
public static boolean isDeviceDarkThemeEnabled(final Context context) { final int deviceTheme = context.getResources().getConfiguration().uiMode & Configuration.UI_MODE_NIGHT_MASK; switch (deviceTheme) { case Configuration.UI_MODE_NIGHT_YES: return true; case Configuration.UI_MODE_NIGHT_UNDEFINED: case Configuration.UI_MODE_NIGHT_NO: default: return false; } }
Source:
<code>public static void initialize(Props props) { if (props == null) { throw new NullPointerException("props argument can't be null"); } <START> instance = new JobCallbackRequestMaker(props); <END> isInitialized = true; logger.info("Initialization for " + JobCallbackRequestMaker.class.getName() + " is completed"); }</code><technical_language>return right if initialized already</technical_language>

Target:
public static void initialize(Props props) { if (props == null) { throw new NullPointerException("props argument can't be null"); } if (isInitialized) { return; } instance = new JobCallbackRequestMaker(props); isInitialized = true; logger.info("Initialization for " + JobCallbackRequestMaker.class.getName() + " is completed"); }
Source:
<code>private void waitForJoinerView(Address joiner, int joinerViewId, long timeout) throws InterruptedException { if (joinerViewId > viewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { if (trace) { if (joinerViewId > viewId) { log.tracef("Waiting to install view %s before processing join request from %s", joinerViewId, joiner); } else { log.tracef("Waiting to recover cluster status before processing join request from %s", joiner); } } final long endTime = timeService.expectedEndTime(timeout, TimeUnit.MILLISECONDS); long remainingTime = -1; synchronized (clusterManagerLock) { while (viewId < joinerViewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { remainingTime = timeService.remainingTime(endTime, TimeUnit.MILLISECONDS); if (remainingTime == 0 || !clusterManagerStatus.isRunning()) break; clusterManagerLock.wait(remainingTime); } } if (remainingTime == 0) { <START> throw new TimeoutException("Timed out waiting for view " + joinerViewId); <END> } } }</code><technical_language>i18n</technical_language>

Target:
private void waitForJoinerView(Address joiner, int joinerViewId, long timeout) throws InterruptedException { if (joinerViewId > viewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) { if (trace) { if (joinerViewId > viewId) { log.tracef("Waiting to install view %s before processing join request from %s", joinerViewId, joiner); } else { log.tracef("Waiting to recover cluster status before processing join request from %s", joiner); } } long nanosTimeout = TimeUnit.MILLISECONDS.toNanos(timeout); while ((viewId < joinerViewId || clusterManagerStatus == ClusterManagerStatus.RECOVERING_CLUSTER) && clusterManagerStatus.isRunning()) { if (nanosTimeout <= 0) { throw log.timeoutWaitingForView(joinerViewId); } nanosTimeout = clusterStateChanged.awaitNanos(nanosTimeout); } } }
Source:
<code>private void throwExceptionIfUnknownParameter(List<String> optionalParameters) { <START> List<String> validOptionalParamaters = Arrays.asList("EX", "PX", "NX", "XX", "KEEPTL"); <END> List<String> parametersInQuestion = optionalParameters .stream() .filter(parameter -> (!validOptionalParamaters.contains(parameter))) .collect(Collectors.toList()); parametersInQuestion.forEach(parameter -> throwErrorIfNotANumberInExpectedPosition( parameter, optionalParameters)); }</code><technical_language>change "KEEPTL" "KEEPTTL"</technical_language>

Target:
private void throwExceptionIfUnknownParameter(List<String> optionalParameters) { List<String> validOptionalParamaters = Arrays.asList("EX", "PX", "NX", "XX"); List<String> parametersInQuestion = optionalParameters .stream() .filter(parameter -> (!validOptionalParamaters.contains(parameter))) .collect(Collectors.toList()); parametersInQuestion.forEach(parameter -> { int index = optionalParameters.indexOf(parameter); if (!isANumber(parameter)) { if (index == 0) { throw new IllegalArgumentException(ERROR_SYNTAX); } String previousParameter = optionalParameters.get(index - 1); if (previousOptionIsValidAndExpectsANumber(previousParameter)) { throw new IllegalArgumentException(ERROR_NOT_INTEGER); } throw new IllegalArgumentException(ERROR_SYNTAX); } }); }
Source:
<code>protected Control createPageControls(Composite parent) { setTitle(Messages.RemoveReviewerDialog_Remove_Reviewer); <START> Label label = new Label(parent, SWT.CENTER); <END> label.setText( NLS.bind(Messages.RemoveReviewerDialog_Are_You_Sure_You_Want_To_Remove, userToRemove.getDisplayName())); return parent; }</code><technical_language>need center it, give SWT.NONE</technical_language>

Target:
protected Control createPageControls(Composite parent) { setTitle(Messages.RemoveReviewerDialog_Remove_Reviewer); Label label = new Label(parent, SWT.NONE); label.setText( NLS.bind(Messages.RemoveReviewerDialog_Are_You_Sure_You_Want_To_Remove, userToRemove.getDisplayName())); return parent; }
Source:
<code>public boolean hasNext() { if (this.buffer.isEmpty()) { while (this.iterator.hasNext()) { final E object = this.iterator.next(); if (this.condition.fits(object)) { <START> buffer.add(object); <END> } } } return !this.buffer.isEmpty(); }</code><technical_language>a break this line. want fetch everything, element is enough</technical_language>

Target:
public boolean hasNext() { if (this.buffer.isEmpty()) { while (this.iterator.hasNext()) { final E object = this.iterator.next(); if (this.condition.fits(object)) { this.buffer.add(object); break; } } } return !this.buffer.isEmpty(); }
Source:
<code>HardDeleter(StoreConfig config, StoreMetrics metrics, String dataDir, Log log, PersistentIndex index, MessageStoreHardDelete hardDelete, StoreKeyFactory factory, DiskIOScheduler diskIOScheduler, Time time) { this.metrics = metrics; this.dataDir = dataDir; this.log = log; this.index = index; this.hardDelete = hardDelete; this.factory = factory; this.diskIOScheduler = diskIOScheduler; this.time = time; <START> scanSizeInBytes = Math.min(config.storeHardDeleteOperationsBytesPerSec, 1024 * 1024); <END> messageRetentionSeconds = (int) TimeUnit.DAYS.toSeconds(config.storeDeletedMessageRetentionDays); }</code><technical_language>some more changes required in this class in init of DiskIOScheduler 1. DiskIOScheduler needs a new Throttler 2. job name in this class calling DiskIOScheduler new job name throttles rate specified</technical_language>

Target:
HardDeleter(StoreConfig config, StoreMetrics metrics, String dataDir, Log log, PersistentIndex index, MessageStoreHardDelete hardDelete, StoreKeyFactory factory, DiskIOScheduler diskIOScheduler, Time time) { this.metrics = metrics; this.dataDir = dataDir; this.log = log; this.index = index; this.hardDelete = hardDelete; this.factory = factory; this.diskIOScheduler = diskIOScheduler; this.time = time; scanSizeInBytes = config.storeHardDeleteOperationsBytesPerSec * 10; messageRetentionSeconds = (int) TimeUnit.DAYS.toSeconds(config.storeDeletedMessageRetentionDays); }
Source:
<code>private Predicate<GHHook> log(final String format) { return new Predicate<GHHook>() { @Override public boolean apply(GHHook input) { <START> if (input != null) { <END> LOGGER.debug(format("%s (events: {})", format), input.getUrl(), input.getEvents()); } return true; } }; }</code><technical_language>this method is private. call null. null hook previous step</technical_language>

Target:
private Predicate<GHHook> log(final String format) { return new Predicate<GHHook>() { @Override public boolean apply(GHHook input) { final GHHook _input = Validate.notNull(input); LOGGER.debug(format("%s (events: {})", format), _input.getUrl(), _input.getEvents()); return true; } }; }
Source:
<code>public <S extends Sequence> MergeResult<S> merge( SequenceComparator<S> cmp, S base, S ours, S theirs) { return merge(cmp, base, ours, theirs, <START> null); <END> }</code><technical_language>pass empty Attributes set avoid @Nullable</technical_language>

Target:
public <S extends Sequence> MergeResult<S> merge( SequenceComparator<S> cmp, S base, S ours, S theirs) { return merge(cmp, base, ours, theirs, new Attributes()); }
Source:
<code>protected void configure() { <START> install(new SingularityServiceModule()); <END> }</code><technical_language>side note bringing in this dep, installing this module start a number of pollers/db connections/zk connections/etc want</technical_language>

Target:
protected void configure() { }
Source:
<code>public int hashCode() { <START> return Objects.hash(idealHeight); <END> }</code><technical_language>is reason for including preferredHeight preferredFps here? BitrateController#setVideoConstraints, I fail call update if changed is preferred height FPS. is this purpose</technical_language>

Target:
public int hashCode() { return Objects.hash(idealHeight, preferredHeight, preferredFps); }
Source:
<code>private void setupPersistedState() throws IOException, ClassNotFoundException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RESTART_ENABLED, GrillConfConstants.DEFAULT_GRILL_SERVER_RESTART_ENABLED)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { ObjectInputStream in = null; try { try { in = new ObjectInputStream(fs.open(getServicePersistPath(service))); } catch (FileNotFoundException fe) { LOG.warn("No persist path available for service:" + service.getName()); continue; } <START> service.readExternal(in); <END> } finally { if (in != null) { in.close(); } } } } }</code><technical_language>log success error while recovering service name</technical_language>

Target:
private void setupPersistedState() throws IOException, ClassNotFoundException { if (conf.getBoolean(GrillConfConstants.GRILL_SERVER_RECOVER_ON_RESTART, GrillConfConstants.DEFAULT_GRILL_SERVER_RECOVER_ON_RESTART)) { FileSystem fs = persistDir.getFileSystem(conf); for (GrillService service : grillServices) { ObjectInputStream in = null; try { try { in = new ObjectInputStream(fs.open(getServicePersistPath(service))); } catch (FileNotFoundException fe) { LOG.warn("No persist path available for service:" + service.getName()); continue; } service.readExternal(in); LOG.info("Recovered service " + service.getName() + " from persisted state"); } finally { if (in != null) { in.close(); } } } } }
Source:
<code>public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "file": String fileName = uri.getRawPath(); return new FileInputStream(new File(fileName)); default: <START> throw log.schemeNotSupported(scheme); <END> } }</code><technical_language>want try classloading fallback</technical_language>

Target:
public InputStream lookupFileStrict(URI uri, ClassLoader cl) throws FileNotFoundException { String scheme = uri.getScheme(); switch (scheme) { case "jar": case "file": String uriAsString = uri.toString(); String fileName = uriAsString.substring(uriAsString.lastIndexOf(":")); return new FileInputStream(new File(fileName)); default: InputStream streamToBeReturned = getAsInputStreamFromClassLoader(uri.toString(), cl); if(streamToBeReturned == null) { throw log.unableToLoadFileUsingScheme(scheme); } return streamToBeReturned; } }
Source:
<code>private void setToCButtonFadedIn(boolean shouldFadeIn) { if (!ApiUtil.hasHoneyComb() || shouldFadeIn == isToCButtonFadedIn) { return; } <START> if (shouldFadeIn) { <END> Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_in_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = true; } else { Animation anim = AnimationUtils.loadAnimation(getActivity(), R.anim.fade_out_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = false; } }</code><technical_language>Sorry, I spotted this earlier. conditionals collapse: Animation anim = AnimationUtils.loadAnimation(getActivity(), shouldFadeIn ? R.anim.fade_in_toc : R.anim.fade_out_to); tocButton.startAnimation(anim); isToCButtonFadedIn = shouldFadeIn;</technical_language>

Target:
private void setToCButtonFadedIn(boolean shouldFadeIn) { if (!ApiUtil.hasHoneyComb() || shouldFadeIn == isToCButtonFadedIn) { return; } Animation anim = AnimationUtils.loadAnimation(getActivity(), shouldFadeIn ? R.anim.fade_in_toc : R.anim.fade_out_toc); tocButton.startAnimation(anim); isToCButtonFadedIn = shouldFadeIn; }
Source:
<code><START> private void signalRemoved(Path p, SftpEventListener listener, ServerSession session, <END> boolean isDirectory, Exception e) throws IOException { if (isDirectory) { listener.removedDirectory(session, p, e); } else { listener.removedFile(session, p, e); } }</code><technical_language>protected please - try allow users override behavior</technical_language>

Target:
protected void signalRemoved( Path p, SftpEventListener listener, ServerSession session, boolean isDirectory, Exception e) throws IOException { if (isDirectory) { listener.removedDirectory(session, p, e); } else { listener.removedFile(session, p, e); } }
Source:
<code>private void executePlayerCommand(String playerCommandLine, Object commandParams) { String[] commandParts = playerCommandLine.split(":"); String playerId = commandParts[0]; String playerCommand = commandParts[1]; MPD daemon = findMPDInstance(playerId); if (daemon == null) { reconnect(playerId); } if (daemon != null) { PlayerCommandTypeMapping pCommand = null; try { pCommand = PlayerCommandTypeMapping.fromString(playerCommand); MPDPlayer player = daemon.getMPDPlayer(); switch (pCommand) { case PAUSE: player.pause(); break; case PLAY: player.play(); break; case STOP: player.stop(); break; case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break; case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break; case NEXT: player.playNext(); break; case PREV: player.playPrev(); break; case VOLUME: <START> logger.warn("Volume adjustment received: '{}' '{}'", pCommand, commandParams); <END> player.setVolume(((PercentType) commandParams).intValue()); break; } } catch (MPDPlayerException pe) { logger.error("error while executing command: " + pe.getMessage(), pCommand); } catch (Exception e) { logger.warn("unknow playerCommand '{}'", playerCommand); } } else { logger.warn("didn't find player configuration instance for playerId '{}'", playerId); } logger.info("executed commandLine '{}' for player '{}'", playerCommand, playerId); }</code><technical_language>please decrease log level DEBUG</technical_language>

Target:
private void executePlayerCommand(String playerCommandLine, Object commandParams) { String[] commandParts = playerCommandLine.split(":"); String playerId = commandParts[0]; String playerCommand = commandParts[1]; MPD daemon = findMPDInstance(playerId); if (daemon == null) { reconnect(playerId); } if (daemon != null) { PlayerCommandTypeMapping pCommand = null; try { pCommand = PlayerCommandTypeMapping.fromString(playerCommand); MPDPlayer player = daemon.getMPDPlayer(); switch (pCommand) { case PAUSE: player.pause(); break; case PLAY: player.play(); break; case STOP: player.stop(); break; case VOLUME_INCREASE: player.setVolume(player.getVolume() + VOLUME_CHANGE_SIZE); break; case VOLUME_DECREASE: player.setVolume(player.getVolume() - VOLUME_CHANGE_SIZE); break; case NEXT: player.playNext(); break; case PREV: player.playPrev(); break; case VOLUME: logger.debug("Volume adjustment received: '{}' '{}'", pCommand, commandParams); player.setVolume(((PercentType) commandParams).intValue()); break; } } catch (MPDPlayerException pe) { logger.error("error while executing command: " + pe.getMessage(), pCommand); } catch (Exception e) { logger.warn("unknow playerCommand '{}'", playerCommand); } } else { logger.warn("didn't find player configuration instance for playerId '{}'", playerId); } logger.info("executed commandLine '{}' for player '{}'", playerCommand, playerId); }
Source:
<code>private static synchronized FileSystemOptions createDefaultFileSystemOptions(UserCredentials credentials) throws FileSystemException { final FileSystemOptions options = new FileSystemOptions(); if (logger.isTraceEnabled()) { logger.trace("CREDENTIALS = " + credentials); } if (credentials != null && !credentials.isEmpty()) { <START> UserAuthenticator auth = new StaticUserAuthenticator(credentials.getDomain(), <END> credentials.getLogin(), credentials.getPassword()); try { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth); } catch (FileSystemException ex) { logger.error("Error when setting user authentication", ex); } } else { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, null); } SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); return options; }</code><technical_language>I do a UserAuthenticator private key (instead of password). explain please</technical_language>

Target:
private static synchronized FileSystemOptions createDefaultFileSystemOptions(UserCredentials credentials) throws FileSystemException { final FileSystemOptions options = new FileSystemOptions(); if (logger.isTraceEnabled()) { logger.trace("CREDENTIALS = " + credentials); } if (credentials != null && !credentials.isEmpty()) { if (Strings.isNullOrEmpty(credentials.getPassword()) && (credentials.getPrivateKey() != null && credentials.getPrivateKey().length > 0)) { try { File tempFile = File.createTempFile("sftp", ""); Files.write(credentials.getPrivateKey(), tempFile); IdentityInfo identityInfo = new IdentityInfo(tempFile); SftpFileSystemConfigBuilder.getInstance().setIdentityInfo(options, identityInfo); } catch (IOException e) { logger.error("Error when setting user authentication", e); } } else { UserAuthenticator auth = new StaticUserAuthenticator(credentials.getDomain(), credentials.getLogin(), credentials.getPassword()); try { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, auth); } catch (FileSystemException ex) { logger.error("Error when setting user authentication", ex); } } } else { DefaultFileSystemConfigBuilder.getInstance().setUserAuthenticator(options, null); } SftpFileSystemConfigBuilder.getInstance().setStrictHostKeyChecking(options, "no"); return options; }
Source:
<code>void closeResultSets() throws SQLException { closeResultSets(activeResultSets); <START> <END> if (generatedKeysResultSet != null && !generatedKeysResultSet.isClosed()) { generatedKeysResultSet.internalClose(); } generatedKeysResultSet = null; }</code><technical_language>This is unnecessary generatedKeysResultSet is added activeResultSets created</technical_language>

Target:
void closeResultSets() throws SQLException { closeResultSets(activeResultSets); generatedKeysResultSet = null; }
Source:
<code>private void initUKRForLogin() { if (shouldGenerateFirstKey()) { SecretKey newKey = CryptUtil.generateSemiRandomKey(); if (newKey == null) { return; } String sandboxId = PropertyUtils.genUUID().replace("-", ""); ukrForLogin = new UserKeyRecord(username, UserKeyRecord.generatePwdHash(password), <START> newKey.getEncoded(), new Date(), new Date(Long.MAX_VALUE), sandboxId); <END> } else { ukrForLogin = UserKeyRecord.getCurrentValidRecordByPassword( CommCareApplication._().getCurrentApp(), username, password, true); if (ukrForLogin == null) { Logger.log(AndroidLogger.TYPE_ERROR_ASSERTION, "Shouldn't be able to not have a valid key record when OTA restoring with a key server"); } } }</code><technical_language>Do end _writing_ this UKR in this process? a hard time this new UKR put DB. For context, I finding this confusing, UKR receiving encrypted version of key, line 209 is working</technical_language>

Target:
private void initUKRForLogin() { if (shouldGenerateFirstKey()) { SecretKey newKey = CryptUtil.generateSemiRandomKey(); if (newKey == null) { return; } String sandboxId = PropertyUtils.genUUID().replace("-", ""); ukrForLogin = new UserKeyRecord(username, UserKeyRecord.generatePwdHash(password), ByteEncrypter.wrapByteArrayWithString(newKey.getEncoded(), password), new Date(), new Date(Long.MAX_VALUE), sandboxId); } else { ukrForLogin = UserKeyRecord.getCurrentValidRecordByPassword( CommCareApplication._().getCurrentApp(), username, password, true); if (ukrForLogin == null) { Logger.log(AndroidLogger.TYPE_ERROR_ASSERTION, "Shouldn't be able to not have a valid key record when OTA restoring with a key server"); } } }
Source:
<code>LargePackedDeltaObject(long objectOffset, long baseOffset, int headerLength, PackFile pack, FileObjectDatabase db) { this.type = Constants.OBJ_BAD; <START> this.size = -1; <END> this.objectOffset = objectOffset; this.baseOffset = baseOffset; this.headerLength = headerLength; this.pack = pack; this.db = db; }</code><technical_language>If constant values, put variable declaration? e.g. private int type = Constants.OBJ_BAD</technical_language>

Target:
LargePackedDeltaObject(long objectOffset, long baseOffset, int headerLength, PackFile pack, FileObjectDatabase db) { this.type = Constants.OBJ_BAD; this.size = SIZE_UNKNOWN; this.objectOffset = objectOffset; this.baseOffset = baseOffset; this.headerLength = headerLength; this.pack = pack; this.db = db; }
Source:
<code>@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); <START> if (clientMode) <END> cfg.setWorkDirectory(TMP_DIR); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); return cfg; }</code><technical_language>I see, remove 'clientMode' field change condition to: if (cfg.isClientMode())</technical_language>

Target:
@Override protected IgniteConfiguration getConfiguration(String gridName) throws Exception { IgniteConfiguration cfg = super.getConfiguration(gridName); if (cfg.isClientMode()) cfg.setWorkDirectory(TMP_DIR); TcpDiscoverySpi disco = new TestTcpDiscoverySpi(); disco.setIpFinder(ipFinder); cfg.setDiscoverySpi(disco); CacheConfiguration ccfg = new CacheConfiguration(DEFAULT_CACHE_NAME); ccfg.setCacheMode(REPLICATED); ccfg.setRebalanceMode(SYNC); ccfg.setWriteSynchronizationMode(FULL_SYNC); cfg.setCacheConfiguration(ccfg); return cfg; }