auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Map<String, String> getGiverEmailToGiverNameMap() { Map<String, String> giverEmailToGiverNameMap = new HashMap<String, String>(); for (String giverEmail : comments.keySet()) { InstructorAttributes instructor = roster.getInstructorForEmail(giverEmail); String giverDisplay = giverEmail; if (giverEmail.equals(InstructorCommentsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST)) { giverDisplay = "You"; } else if (instructor != null) { String title = instructor.displayedName; giverDisplay = title + " " + instructor.name; } giverEmailToGiverNameMap.put(giverEmail, giverDisplay); } return giverEmailToGiverNameMap; }

Target:
private Map<String, String> getGiverEmailToGiverNameMap() { Map<String, String> giverEmailToGiverNameMap = new HashMap<String, String>(); for (String giverEmail : comments.keySet()) { InstructorAttributes instructor = roster.getInstructorForEmail(giverEmail); String giverDisplay = giverEmail; if (giverEmail.equals(InstructorCommentsPageData.COMMENT_GIVER_NAME_THAT_COMES_FIRST)) { giverDisplay = "You"; } else if (instructor != null) { String title = instructor.displayedName; giverDisplay = title + " " + instructor.name; } giverEmailToGiverNameMap.put(giverEmail, giverDisplay); } return giverEmailToGiverNameMap; }
Source:
public PerfConfig(VerifiableProperties verifiableProperties) { perfBlobSize = verifiableProperties.getLong("perf.blob.size", 10485760); perfUserMetadataSize = verifiableProperties.getIntInRange("perf.user.metadata.size", 1024, 0, 81920); perfNioServerChunkSize = verifiableProperties.getIntInRange("perf.nio.server.chunk.size", 8192, 1, 10485760); perfNioServerConcurrency = verifiableProperties.getInt("perf.nio.server.concurrency", 1); perfRequestRestMethod = RestMethod .valueOf(verifiableProperties.getString("perf.request.rest.method", RestMethod.GET.toString()).toUpperCase()); perfRouterChunkSize = verifiableProperties.getIntInRange("perf.router.chunk.size", 1048576, 1, 10485760); }

Target:
public PerfConfig(VerifiableProperties verifiableProperties) { perfBlobSize = verifiableProperties.getLong("perf.blob.size", 10485760); perfUserMetadataSize = verifiableProperties.getIntInRange("perf.user.metadata.size", 1024, 0, 81920); perfNioServerChunkSize = verifiableProperties.getIntInRange("perf.nio.server.chunk.size", 8192, 1, 10485760); perfNioServerConcurrency = verifiableProperties.getIntInRange("perf.nio.server.concurrency", 1, 1, Integer.MAX_VALUE); perfRequestRestMethod = RestMethod .valueOf(verifiableProperties.getString("perf.request.rest.method", RestMethod.GET.toString()).toUpperCase()); perfRouterChunkSize = verifiableProperties.getIntInRange("perf.router.chunk.size", 1048576, 1, 10485760); }
Source:
private InputPortInfo createInternalServiceInputPort(String serviceName, List< InterfaceDefinition > interfaceList) throws ParserException { OLSyntaxNode protocolConfiguration = new NullProcessStatement( getContext() ); InputPortInfo iport = null; try { iport = new InputPortInfo( getContext(), serviceName + "InputPort", new URI( Constants.LOCAL_LOCATION_KEYWORD ), null, protocolConfiguration, new InputPortInfo.AggregationItemInfo[] {}, new HashMap<String, String>() ); for( InterfaceDefinition i : interfaceList ) { i.copyTo(iport); } } catch (URISyntaxException e) { throwException( e ); } return iport; }

Target:
private InputPortInfo createInternalServiceInputPort( String serviceName, List< InterfaceDefinition> interfaceList ) throws ParserException { OLSyntaxNode protocolConfiguration = new NullProcessStatement( getContext() ); InputPortInfo iport = null; try { iport = new InputPortInfo( getContext(), serviceName + "InputPort", new URI( Constants.LOCAL_LOCATION_KEYWORD ), null, protocolConfiguration, new InputPortInfo.AggregationItemInfo[]{}, Collections.<String, String>emptyMap() ); for( InterfaceDefinition i : interfaceList ) { i.copyTo( iport ); } } catch( URISyntaxException e ) { throwException( e ); } return iport; }
Source:
public void clickWikiaLogo() { PageObjectLogging.logInfo("Click Wikia logo"); wait.forElementVisible(logo); logo.click(); }

Target:
public void clickWikiaLogo() { PageObjectLogging.logInfo("Click Wikia logo"); wait.forElementClickable(logo); logo.click(); }
Source:
private List<Patient> findPatients(String query, boolean includeVoided) { query = LuceneQuery.escapeQuery(query); LuceneQuery<PatientIdentifier> luceneQuery = getPatientIdentifierLuceneQuery(query, includeVoided); List<PatientIdentifier> patientIdentifiers = luceneQuery.list(); LuceneQuery<PersonName> luceneQuery2 = getPersonNameLuceneQuery(query, includeVoided); luceneQuery2.skipSame(luceneQuery.listProjection("patient.personId"), "person.personId"); List<PersonName> personNames = luceneQuery2.list(); LuceneQuery<PersonAttribute> luceneQuery3 = getPersonAttributeLuceneQuery(query, includeVoided); luceneQuery3.skipSame(luceneQuery.listProjection("patient.personId"), "person.personId"); luceneQuery3.skipSame(luceneQuery2.listProjection("person.personId"), "person.personId"); List<PersonAttribute> personAttributes = luceneQuery3.list(); List<Patient> personList = new LinkedList<>(); patientIdentifiers.forEach(patientIdentifier -> personList.add(patientIdentifier.getPatient())); personNames.forEach(personName -> personList.add(Context.getPatientService().getPatient(personName.getPerson().getId()))); personAttributes.forEach(personAttribute -> personList.add(Context.getPatientService().getPatient(personAttribute.getPerson().getId()))); return personList; }

Target:
private List<Patient> findPatients(String query, boolean includeVoided) { return findPatients(query, includeVoided, null, null); }
Source:
public void onPageLoadComplete() { showToCButton(); refreshView.setEnabled(true); editHandler.setPage(model.getPage()); initPageScrollFunnel(); checkAndShowSelectTextOnboarding(); updateNavDrawerSelection(); if (getMainActivity().pageLoadCallbacks() != null) { getMainActivity().pageLoadCallbacks().onLoadComplete(); } }

Target:
public void onPageLoadComplete() { showToCButton(); refreshView.setEnabled(true); editHandler.setPage(model.getPage()); initPageScrollFunnel(); checkAndShowSelectTextOnboarding(); updateNavDrawerSelection(); if (getMainActivity() != null && getMainActivity().pageLoadCallbacks() != null) { getMainActivity().pageLoadCallbacks().onLoadComplete(); } }
Source:
public String getDocumentId() { return (documentId == null) ? URI : documentId; }

Target:
public String getDocumentId() { return (documentId == null) ? uri : documentId; }
Source:
public Operation<K> decode(final ByteBuffer buffer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int valueSize = buffer.getInt(); buffer.limit(buffer.position() + valueSize); ByteBuffer valueBlob = buffer.slice(); try { return newOperation(keySerializer.read(keyBlob), valueSerializer.read(valueBlob)); } catch (ClassNotFoundException e) { throw new SerializerException(e); } }

Target:
public Operation<K> decode(final ByteBuffer buffer) { OperationCode opCode = OperationCode.valueOf(buffer.get()); validateOperation(opCode); int keySize = buffer.getInt(); buffer.limit(buffer.position() + keySize); ByteBuffer keyBlob = buffer.slice(); buffer.position(buffer.limit()); buffer.limit(buffer.capacity()); int valueSize = buffer.getInt(); buffer.limit(buffer.position() + valueSize); ByteBuffer valueBlob = buffer.slice(); try { return newOperation(keySerializer.read(keyBlob), valueSerializer.read(valueBlob)); } catch (ClassNotFoundException e) { throw new CodecException(e); } }
Source:
private AttributeDescriptor buildAttributeDescriptor(String name, AttributeType type) { AttributeDescriptor attributeDescriptor = mock(AttributeDescriptor.class); when(attributeDescriptor.getName()).thenReturn(name); when(attributeDescriptor.getType()).thenReturn(type); return attributeDescriptor; }

Target:
private static AttributeDescriptor buildAttributeDescriptor(String name, AttributeType type) { return new AttributeDescriptorImpl(name, true, true, true, true, type); }
Source:
public void putMetrics(List<Metric> metrics) { requireNotDisposed(); requireArgument(TSDB_DATAPOINTS_WRITE_MAX_SIZE > 0, "Max Chunk size can not be less than 1"); requireArgument(metrics != null, "Metrics can not be null"); String endpoint; synchronized (_roundRobinIterator) { endpoint = _roundRobinIterator.next(); } _logger.debug("Pushing metrics to TSDB using endpoint {}.", metrics.size(), endpoint); List<Metric> fracturedList = new ArrayList<>(); for (Metric metric : metrics) { if (metric.getDatapoints().size() <= TSDB_DATAPOINTS_WRITE_MAX_SIZE) { fracturedList.add(metric); } else { fracturedList.addAll(fractureMetric(metric)); } } try { put(fracturedList, endpoint + "/api/put", HttpMethod.POST); } catch(IOException ex) { _logger.warn("IOException while trying to push metrics", ex); _retry(fracturedList, _roundRobinIterator); } }

Target:
public void putMetrics(List<Metric> metrics) { requireNotDisposed(); requireArgument(TSDB_DATAPOINTS_WRITE_MAX_SIZE > 0, "Max Chunk size can not be less than 1"); requireArgument(metrics != null, "Metrics can not be null"); String endpoint = _roundRobinIterator.next(); _logger.debug("Pushing metrics to TSDB using endpoint {}.", metrics.size(), endpoint); List<Metric> fracturedList = new ArrayList<>(); for (Metric metric : metrics) { if (metric.getDatapoints().size() <= TSDB_DATAPOINTS_WRITE_MAX_SIZE) { fracturedList.add(metric); } else { fracturedList.addAll(fractureMetric(metric)); } } try { put(fracturedList, endpoint + "/api/put", HttpMethod.POST); } catch(IOException ex) { _logger.warn("IOException while trying to push metrics", ex); _retry(fracturedList, _roundRobinIterator); } }
Source:
default PrimitiveIterator.OfLong getRowIndexes() { throw new NotInPageFilteringModeException("Row indexes are not available"); }

Target:
default Optional<PrimitiveIterator.OfLong> getRowIndexes() { return Optional.empty(); }
Source:
private void assertStudentDataMatches(StudentData studentData, StudentAttributes student, boolean isRequestFromInstructor) { assertEquals(student.getEmail(), studentData.getEmail()); assertEquals(student.getCourse(), studentData.getCourseId()); assertEquals(student.getName(), studentData.getName()); if (student.getLastName() == null) { String[] name = student.name.split(" "); assertEquals(name[name.length - 1], studentData.getLastName()); } else { assertEquals(student.getLastName(), studentData.getLastName()); } assertEquals(student.getTeam(), studentData.getTeamName()); assertEquals(student.getSection(), studentData.getSectionName()); if (isRequestFromInstructor) { assertEquals(student.getComments(), studentData.getComments()); if (student.isRegistered()) { assertTrue(studentData.getJoinState().equals(JoinState.JOINED)); } else { assertTrue(studentData.getJoinState().equals(JoinState.NOT_JOINED)); } } else { assertNull(studentData.getComments()); assertNull(studentData.getJoinState()); } }

Target:
private void assertStudentDataMatches(StudentData studentData, StudentAttributes student, boolean isRequestFromInstructor) { assertEquals(student.getEmail(), studentData.getEmail()); assertEquals(student.getCourse(), studentData.getCourseId()); assertEquals(student.getName(), studentData.getName()); if (student.getLastName() == null) { String[] name = StringHelper.splitName(student.name); assertEquals(name[1], studentData.getLastName()); } else { assertEquals(student.getLastName(), studentData.getLastName()); } assertEquals(student.getTeam(), studentData.getTeamName()); assertEquals(student.getSection(), studentData.getSectionName()); if (isRequestFromInstructor) { assertEquals(student.getComments(), studentData.getComments()); if (student.isRegistered()) { assertTrue(studentData.getJoinState().equals(JoinState.JOINED)); } else { assertTrue(studentData.getJoinState().equals(JoinState.NOT_JOINED)); } } else { assertNull(studentData.getComments()); assertNull(studentData.getJoinState()); } }
Source:
public StatementExecution toStatementExecution() throws SQLException { StatementExecution cs; if (isFunction()) { cs = environment.createFunctionStatementExecution(this.environment.getConnection().prepareCall(toSqlString()), true); } else { cs = environment.createStatementExecution(this.environment.getConnection().prepareCall(toSqlString()), true); } bindParametersTo(cs); return cs; }

Target:
public StatementExecution toStatementExecution() throws SQLException { String sql = toSqlString(); PreparedStatement ps = environment.getConnection().prepareCall(sql); StatementExecution cs; if (isFunction()) { cs = environment.createFunctionStatementExecution(ps, true); } else { cs = environment.createStatementExecution(ps, true); } bindParametersTo(cs); return cs; }
Source:
private Object interpretMultipleItemsUserList(List<Object> userListValues) { List<String> userListStringValues = new ArrayList<>(); boolean whiteSpaceNeeded = false; for (Object listValue : userListValues) { if (listValue instanceof Double) { Double doubleValueOfListItem = (Double) listValue; userListStringValues.add(stringWithoutTrailingZero(String.valueOf(doubleValueOfListItem.intValue()))); } else if (listValue instanceof String) { String stringValueOfListItem = (String) listValue; userListStringValues.add(stringWithoutTrailingZero(stringValueOfListItem)); } } StringBuilder stringBuilder = new StringBuilder(userListStringValues.size()); for (String userListStringValue : userListStringValues) { if (userListStringValue.length() > 1) { whiteSpaceNeeded = true; break; } } for (String userListStringValue : userListStringValues) { stringBuilder.append(stringWithoutTrailingZero(userListStringValue)); if (whiteSpaceNeeded) { stringBuilder.append(' '); } } return stringBuilder.toString().trim(); }

Target:
private Object interpretMultipleItemsUserList(List<Object> userListValues) { List<String> userListStringValues = new ArrayList<>(); for (Object listValue : userListValues) { if (listValue instanceof Double) { Double doubleValueOfListItem = (Double) listValue; userListStringValues.add(stringWithoutTrailingZero(String.valueOf(doubleValueOfListItem.intValue()))); } else if (listValue instanceof String) { String stringValueOfListItem = (String) listValue; userListStringValues.add(stringWithoutTrailingZero(stringValueOfListItem)); } } StringBuilder stringBuilder = new StringBuilder(userListStringValues.size()); String separator = listConsistsOfSingleCharacters(userListStringValues) ? "" : " "; for (String userListStringValue : userListStringValues) { stringBuilder.append(stringWithoutTrailingZero(userListStringValue)); stringBuilder.append(separator); } return stringBuilder.toString().trim(); }
Source:
private ArrayList<MediaModel> filterOutRecentlyDeletedMedia(Set<MediaModel> failedMedia) { ArrayList<MediaModel> mediaToRetry = new ArrayList<>(failedMedia); ListIterator<MediaModel> iterator = mediaToRetry.listIterator(); while (iterator.hasNext()) { String mediaIdToCompare = String.valueOf(iterator.next().getId()); if (mUserDeletedMediaItemIds.contains(mediaIdToCompare)) { iterator.remove(); } } return mediaToRetry; }

Target:
private List<MediaModel> filterOutRecentlyDeletedMedia(Set<MediaModel> failedMedia) { List<MediaModel> mediaToRetry = new ArrayList<>(); for (MediaModel mediaModel : failedMedia) { String mediaIdToCompare = String.valueOf(mediaModel.getId()); if (!mUserDeletedMediaItemIds.contains(mediaIdToCompare)) { mediaToRetry.add(mediaModel); } } return mediaToRetry; }
Source:
public static void enlargeTableLayoutButtonText(TableLayout tableLayout) { if (modifier == 1.0f) { return; } Context context = CatroidApplication.getAppContext(); WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE); Display display = wm.getDefaultDisplay(); DisplayMetrics metrics = new DisplayMetrics(); display.getMetrics(metrics); if ((metrics.widthPixels / metrics.xdpi) > widthForIncreasedTextSizeInInches) { modifier += modifierIncreaseDelta; } for (int i = 0; i < tableLayout.getChildCount(); i++) { if (tableLayout.getChildAt(i) instanceof TableRow) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); for (int j = 0; j < tableRow.getChildCount(); j++) { if (tableRow.getChildAt(j) instanceof Button) { Button button = (Button) tableRow.getChildAt(j); enlargeButtonText(button); } } } } if ((metrics.heightPixels / metrics.ydpi) > 6.0f) { modifier -= modifierIncreaseDelta; } }

Target:
public static void enlargeTableLayoutButtonText(TableLayout tableLayout) { if (modifier == 1.0f) { return; } if (largeFormulaEditorTextSize) { modifier += modifierIncreaseDelta; } for (int i = 0; i < tableLayout.getChildCount(); i++) { if (tableLayout.getChildAt(i) instanceof TableRow) { TableRow tableRow = (TableRow) tableLayout.getChildAt(i); for (int j = 0; j < tableRow.getChildCount(); j++) { if (tableRow.getChildAt(j) instanceof Button) { Button button = (Button) tableRow.getChildAt(j); enlargeButtonText(button); } } } } if (largeFormulaEditorTextSize) { modifier -= modifierIncreaseDelta; } }
Source:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); }finally { close(dbConnection); } }

Target:
public static String[] getStringValuesFromDatabaseForInternalRoles(Connection dbConnection, String sqlStmt, Object... params) throws UserStoreException { String[] values = new String[0]; try(PreparedStatement prepStmt = dbConnection.prepareStatement(sqlStmt) ) { if (params != null && params.length > 0) { for (int i = 0; i < params.length; i++) { Object param = params[i]; if (param == null) { throw new UserStoreException("Null data provided."); } else if (param instanceof String) { prepStmt.setString(i + 1, (String) param); } else if (param instanceof Integer) { prepStmt.setInt(i + 1, (Integer) param); } } } try (ResultSet rs = prepStmt.executeQuery()) { List<String> lst = new ArrayList<String>(); while (rs.next()) { String name = rs.getString(1); String domain = rs.getString(2); if (domain != null) { name = UserCoreUtil.addDomainToName(name, domain); } lst.add(name); } if (lst.size() > 0) { values = lst.toArray(new String[lst.size()]); } return values; } } catch (SQLException e) { String errorMessage = "Using sql : " + sqlStmt + " " + e.getMessage(); if (log.isDebugEnabled()) { log.debug(errorMessage, e); } throw new UserStoreException(errorMessage, e); } }
Source:
public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { try{ final OslpEnvelope request = this .createEnvelopeBuilder( getString(settings, Keys.KEY_DEVICE_UID, com.alliander.osgp.cucumber.platform.glue.steps.database.adapterprotocoloslp.OslpDeviceSteps.DEFAULT_DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage(Message.newBuilder().setRegisterDeviceRequest(Oslp.RegisterDeviceRequest .newBuilder() .setDeviceIdentification(getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)).getAddress())) .setDeviceType(getEnum(settings, Keys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule(getBoolean(settings, Keys.KEY_HAS_SCHEDULE, Defaults.DEFAULT_HASSCHEDULE)) .setRandomDevice(getInteger(settings, Keys.RANDOM_DEVICE, Defaults.RANDOM_DEVICE))).build()) .build(); this.send(request, settings); }catch(IOException ioe){ ScenarioContext.Current().put("Error", ioe); }catch(IllegalArgumentException iae){ ScenarioContext.Current().put("Error", iae); } }

Target:
public void theDeviceSendsARegisterDeviceRequestToThePlatform(final String protocol, final Map<String, String> settings) throws IOException, DeviceSimulatorException { LOGGER.info("IpAddress from feature: [{}]", getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)); final InetAddress address = InetAddress.getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)); final byte[] ba = address.getAddress(); LOGGER.info("getAddress() from inetAddress: [{}.{}.{}.{}]", ba[0], ba[1], ba[2], ba[3]); LOGGER.info("getHostAddress() from inetAddress: [{}]", address.getHostAddress()); LOGGER.info("getHostName() from inetAddress: [{}]", address.getHostName()); try { final OslpEnvelope request = this .createEnvelopeBuilder( getString(settings, Keys.KEY_DEVICE_UID, com.alliander.osgp.cucumber.platform.glue.steps.database.adapterprotocoloslp.OslpDeviceSteps.DEFAULT_DEVICE_UID), this.oslpMockServer.getSequenceNumber()) .withPayloadMessage(Message.newBuilder().setRegisterDeviceRequest(Oslp.RegisterDeviceRequest .newBuilder() .setDeviceIdentification(getString(settings, Keys.KEY_DEVICE_IDENTIFICATION, Defaults.DEFAULT_DEVICE_IDENTIFICATION)) .setIpAddress(ByteString.copyFrom(InetAddress .getByName(getString(settings, Keys.IP_ADDRESS, Defaults.LOCALHOST)).getAddress())) .setDeviceType(getEnum(settings, Keys.KEY_DEVICE_TYPE, DeviceType.class, DeviceType.PSLD)) .setHasSchedule(getBoolean(settings, Keys.KEY_HAS_SCHEDULE, Defaults.DEFAULT_HASSCHEDULE)) .setRandomDevice(getInteger(settings, Keys.RANDOM_DEVICE, Defaults.RANDOM_DEVICE))).build()) .build(); this.send(request, settings); } catch (final IOException ioe) { ScenarioContext.Current().put("Error", ioe); } catch (final IllegalArgumentException iae) { ScenarioContext.Current().put("Error", iae); } }
Source:
public void handleEvent(EventBundle events) { for (Event event : events) { if (DOCUMENT_REMOVED.equals(event.getName())) { DocumentEventContext context = (DocumentEventContext) event.getContext(); DocumentModel docModel = context.getSourceDocument(); if (DOCUMENT_ROUTE_DOCUMENT_TYPE.equals(docModel.getType())) { deleteOrphanTasks(context.getCoreSession(), docModel.getId()); } } } }

Target:
public void handleEvent(EventBundle events) { for (Event event : events) { DocumentEventContext context = (DocumentEventContext) event.getContext(); DocumentModel docModel = context.getSourceDocument(); if (DOCUMENT_ROUTE_DOCUMENT_TYPE.equals(docModel.getType())) { deleteOrphanTasks(context.getCoreSession(), docModel.getId()); } } }
Source:
public Optional<SelectionContext<VariableMap>> match(SelectionCriteria criteria) { if (lastRefresh.get() == 0) { throw new PrestoException(CONFIGURATION_UNAVAILABLE, "Selectors cannot be fetched from database"); } if (System.nanoTime() - lastRefresh.get() > maxRefreshInterval.toMillis() * 1_000_000) { throw new PrestoException( CONFIGURATION_UNAVAILABLE, format("Selectors cannot be fetched from database. Current selectors are loaded %s ago", succinctNanos(System.nanoTime() - lastRefresh.get()).toString())); } if (selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return selectors.get().stream() .map(s -> s.match(criteria)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }

Target:
public Optional<SelectionContext<VariableMap>> match(SelectionCriteria criteria) { checkMaxRefreshInterval(); if (selectors.get().isEmpty()) { throw new PrestoException(CONFIGURATION_INVALID, "No selectors are configured"); } return selectors.get().stream() .map(s -> s.match(criteria)) .filter(Optional::isPresent) .map(Optional::get) .findFirst(); }
Source:
public Result deleteSurvey(String surveyGuid, String createdOnString, String physical) throws Exception { UserSession session = getAuthenticatedSession(DEVELOPER, ADMIN); StudyIdentifier studyId = session.getStudyIdentifier(); long createdOn = DateUtils.convertToMillisFromEpoch(createdOnString); GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn); Survey survey = surveyService.getSurvey(studyId, keys, false, false); if (survey == null) { throw new EntityNotFoundException(Survey.class); } if ("true".equals(physical) && session.isInRole(ADMIN)) { surveyService.deleteSurveyPermanently(studyId, survey); } else { surveyService.deleteSurvey(studyId, survey); } expireCache(surveyGuid, createdOnString, studyId); return okResult("Survey deleted."); }

Target:
public Result deleteSurvey(String surveyGuid, String createdOnString, String physical) throws Exception { UserSession session = getAuthenticatedSession(DEVELOPER, ADMIN); StudyIdentifier studyId = session.getStudyIdentifier(); long createdOn = DateUtils.convertToMillisFromEpoch(createdOnString); GuidCreatedOnVersionHolder keys = new GuidCreatedOnVersionHolderImpl(surveyGuid, createdOn); Survey survey = surveyService.getSurvey(session.getParticipant().getRoles(), studyId, keys, false, false); if (survey == null) { throw new EntityNotFoundException(Survey.class); } if ("true".equals(physical) && session.isInRole(ADMIN)) { surveyService.deleteSurveyPermanently(session.getParticipant().getRoles(), studyId, survey); } else { surveyService.deleteSurvey(studyId, survey); } expireCache(surveyGuid, createdOnString, studyId); return okResult("Survey deleted."); }
Source:
public void verifyOnLvsPage() { String url = driver.getCurrentUrl(); String[] urlParts = url.split("/"); Assertion.assertEquals(urlParts[urlParts.length - 2] + '/' +urlParts[urlParts.length - 1], URLsContent.specialLicensedVideoSwap); PageObjectLogging.log("verifyOnLvsPage", "verify that the url is the correct one for LVS page", true); }

Target:
public void verifyOnLvsPage() { String url = driver.getCurrentUrl(); Assertion.assertTrue(url.contains(URLsContent.specialLicensedVideoSwap)); PageObjectLogging.log("verifyOnLvsPage", "url is the correct one for LVS page", true); }
Source:
private void updateAffinityLabels() { List<Label> selectedLabels = getParameters().getAffinityLabels(); List<Label> previouslySelectedLabels = labelDao.getAllByEntityIds(Collections.singletonList(getVdsId())); Set<Label> labelsToAdd = new HashSet<>(selectedLabels); labelsToAdd.removeAll(previouslySelectedLabels); for (Label label : labelsToAdd) { label.addHost(getVds()); labelDao.update(label); } Set<Label> labelsToRemove = new HashSet<>(previouslySelectedLabels); labelsToRemove.removeAll(selectedLabels); for (Label label : labelsToRemove) { label.removeHost(getVds()); labelDao.update(label); } }

Target:
private void updateAffinityLabels() { List<Label> affinityLabels = getParameters().getAffinityLabels(); List<Guid> labelIds = affinityLabels.stream() .map(Label::getId) .collect(Collectors.toList()); labelDao.updateLabelsForHost(getVdsId(), labelIds); }
Source:
private void createProgramEnrollmentTestData() { createdPatient = patientService.createPatient(DEFAULT_CONFIG_NAME, preparePatient()); createProgramEnrollment(new DateTime("2010-01-18T00:00:00Z"), null); createProgramEnrollment(new DateTime("2010-01-16T00:00:00Z"), new DateTime("2016-01-16T00:00:00Z")); }

Target:
private void createProgramEnrollmentTestData() { createdPatient = patientService.createPatient(DEFAULT_CONFIG_NAME, preparePatient(MOTECH_ID)); createProgramEnrollment(createdPatient, new DateTime("2010-01-16T00:00:00Z"), null); createProgramEnrollment(createdPatient, new DateTime("2010-01-16T00:00:00Z"), new DateTime("2016-01-16T00:00:00Z")); }
Source:
private static Predicate<Expression> isListAnyMatch(Predicate<Expression> pred) { return expr -> Optional.ofNullable(expr) .filter(ListLiteral.class::isInstance) .flatMap(lst -> ((ListLiteral) lst).elements().expressions().stream().filter(pred).findFirst()) .isPresent(); }

Target:
private static Predicate<Expression> isListAnyMatch(Predicate<Expression> pred) { return expr -> Optional.ofNullable(expr) .filter(e -> e.is(Tree.Kind.LIST_LITERAL)) .flatMap(lst -> ((ListLiteral) lst).elements().expressions().stream().filter(pred).findFirst()) .isPresent(); }
Source:
public IndexConfig getConfig() { return delegate.getConfig(); }

Target:
public IndexConfig getConfig() { throw newUnsupportedException(); }
Source:
public void start() { if (started.compareAndSet(false, true)) { refreshExecutor.scheduleWithFixedDelay(() -> { try { refreshAndStartQueries(); } catch (Throwable t) { log.error(t, "Error while executing refreshAndStartQueries"); throw t; } lastSchedulingCycleRunTimeMs.getAndSet(System.currentTimeMillis()); }, 1, 1, TimeUnit.MILLISECONDS); } }

Target:
public void start() { if (started.compareAndSet(false, true)) { refreshExecutor.scheduleWithFixedDelay(() -> { try { refreshAndStartQueries(); lastSchedulingCycleRunTimeMs.getAndSet(currentTimeMillis()); } catch (Throwable t) { log.error(t, "Error while executing refreshAndStartQueries"); throw t; } }, 1, 1, MILLISECONDS); } }
Source:
protected void connectSensors() { super.connectSensors(); serviceUp = FunctionFeed.builder() .entity(this) .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_UP) .period(5, TimeUnit.SECONDS) .callable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this); return clientSupport.getServerStatus().get("ok").equals(1.0); } }) .onException(Functions.<Boolean>constant(false))) .poll(new FunctionPollConfig<Integer, Integer>(SHARD_COUNT) .period(5, TimeUnit.SECONDS) .callable(new Callable<Integer>() { public Integer call() throws Exception { MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this); return (int) clientSupport.getShardCount(); } }) .onException(Functions.<Integer>constant(0))) .build(); }

Target:
protected void connectSensors() { super.connectSensors(); serviceUp = FunctionFeed.builder() .entity(this) .poll(new FunctionPollConfig<Boolean, Boolean>(RUNNING) .period(5, TimeUnit.SECONDS) .callable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this); return clientSupport.ping(); } }) .onException(Functions.<Boolean>constant(false))) .poll(new FunctionPollConfig<Boolean, Boolean>(SERVICE_UP) .period(5, TimeUnit.SECONDS) .callable(new Callable<Boolean>() { @Override public Boolean call() throws Exception { MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this); return clientSupport.ping() && MongoDBRouterImpl.this.getAttribute(SHARD_COUNT) > 0; } }) .onException(Functions.<Boolean>constant(false))) .poll(new FunctionPollConfig<Integer, Integer>(SHARD_COUNT) .period(5, TimeUnit.SECONDS) .callable(new Callable<Integer>() { public Integer call() throws Exception { MongoDBClientSupport clientSupport = MongoDBClientSupport.forServer(MongoDBRouterImpl.this); return (int) clientSupport.getShardCount(); } }) .onException(Functions.<Integer>constant(-1))) .build(); }
Source:
public void testGroupingSetMixedExpressionAndColumn() { featuresToTest(DATE_TYPE); assertQuery("SELECT suppkey, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate), ROLLUP(suppkey)", "SELECT suppkey, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate), suppkey UNION ALL " + "SELECT NULL, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate)"); }

Target:
public void testGroupingSetMixedExpressionAndColumn() { requiredFeatures(DATE_TYPE); assertQuery("SELECT suppkey, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate), ROLLUP(suppkey)", "SELECT suppkey, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate), suppkey UNION ALL " + "SELECT NULL, month(shipdate), SUM(CAST(quantity AS BIGINT)) FROM lineitem GROUP BY month(shipdate)"); }
Source:
public void addQc(Sample sample, SampleQC qc) throws IOException { Sample managed = get(sample.getId()); authorizationManager.throwIfNotWritable(managed); qc.setQcCreator(authorizationManager.getCurrentUsername()); if ("Qubit".equals(qc.getQcType().getName()) && managed instanceof DetailedSample) { ((DetailedSample) managed).setConcentration(qc.getResults()); } if ("Volume Check".equals(qc.getQcType().getName())) { managed.setVolume(qc.getResults()); } managed.addQc(qc); sampleDao.save(managed); }

Target:
public void addQc(Sample sample, SampleQC qc) throws IOException { Sample managed = get(sample.getId()); authorizationManager.throwIfNotWritable(managed); qc.setQcCreator(authorizationManager.getCurrentUsername()); managed.addQc(qc); sampleDao.save(managed); }
Source:
void recordMetric(TableReference tableRef, long value) { String tableSpecificMetric = getTableSpecificName(name, tableRef); metricRegistry.histogram(tableSpecificMetric).update(value); metricRegistry.histogram(aggregateMetric()).update(value); }

Target:
void recordMetric(TableReference tableRef, long value) { metricRegistry.histogram(getTableSpecificName(name, tableRef)).update(value); metricRegistry.histogram(aggregateMetric()).update(value); }
Source:
protected String getSubnetBadFormatMessage() { return isPrefixSupported ? getBadMaskFormatMessage() : getBadNetmaskFormatMessage(); }

Target:
protected String getSubnetBadFormatMessage() { return isPrefixAllowed ? getBadPrefixFormatMessage() : getBadNetmaskFormatMessage(); }
Source:
public void uploadProjectFile(Project project, int version, String filetype, String filename, File localFile, String uploader) throws ProjectManagerException { long startMs = System.currentTimeMillis(); logger.info("Uploading to " + project.getName() + " version:" + version + " file:" + filename); Connection connection = getConnection(); try { uploadProjectFile(connection, project, version, filetype, filename, localFile, uploader); connection.commit(); logger.info("project " + project.getName() + " commiting upload " + localFile.getName() + " takes " + ((System.currentTimeMillis() - startMs) / 1000) + " seconds."); } catch (SQLException e) { logger.error(e); throw new ProjectManagerException("Error getting DB connection.", e); } finally { DbUtils.closeQuietly(connection); } }

Target:
public void uploadProjectFile(Project project, int version, String filetype, String filename, File localFile, String uploader) throws ProjectManagerException { long startMs = System.currentTimeMillis(); logger.info("Uploading to " + project.getName() + " version:" + version + " file:" + filename); Connection connection = getConnection(); try { uploadProjectFile(connection, project, version, filetype, filename, localFile, uploader); connection.commit(); logger.info("project " + project.getName() + " commiting upload " + localFile.getName() + " took " + ((System.currentTimeMillis() - startMs) / 1000) + " seconds."); } catch (SQLException e) { logger.error(e); throw new ProjectManagerException("Error getting DB connection.", e); } finally { DbUtils.closeQuietly(connection); } }
Source:
OptionalLong lastAckedOffset(TopicPartition topicPartition) { TopicPartitionEntry entry = topicPartitions.get(topicPartition); if (entry != null && entry.lastAckedOffset != ProduceResponse.INVALID_OFFSET) return OptionalLong.of(entry.lastAckedOffset); else return OptionalLong.empty(); }

Target:
private OptionalLong lastAckedOffset(TopicPartition topicPartition) { TopicPartitionEntry entry = topicPartitions.get(topicPartition); if (entry != null && entry.lastAckedOffset != ProduceResponse.INVALID_OFFSET) return OptionalLong.of(entry.lastAckedOffset); else return OptionalLong.empty(); }
Source:
public void policyCacheEntryGetsEvictedOnFlowDisposal() throws Exception { Thread.sleep(2000); ((Flow) getFlowConstruct("main")).dispose(); check(5000, 1000, () -> processorWasDisposed.get()); }

Target:
public void policyCacheEntryGetsEvictedOnFlowDisposal() throws Exception { messageSentTimer.await(2, SECONDS); ((Flow) getFlowConstruct("main")).dispose(); check(5000, 1000, () -> processorWasDisposed.get()); }
Source:
public Collection<CraftingRecipe> getRecipes() { return Streams.stream(CraftingManager.REGISTRY.iterator()).map(CraftingRecipe.class::cast).collect(Collectors.toList()); }

Target:
public Collection<CraftingRecipe> getRecipes() { return Streams.stream(CraftingManager.REGISTRY.iterator()).map(CraftingRecipe.class::cast).collect(ImmutableList.toImmutableList()); }
Source:
private synchronized void completeWithError(Throwable error) { if (error instanceof InterpreterException && null != error.getCause()) { error = error.getCause(); } setResult(new InterpreterResult(Code.ERROR, getStack(error))); setException(error); dateFinished = new Date(); }

Target:
private synchronized void completeWithError(Throwable error) { setResult(new InterpreterResult(Code.ERROR, getStack(error))); setException(error); dateFinished = new Date(); }
Source:
public void testWriteAndReadJoinConsistency() throws Exception { for (Locator locator : locatorToMetrics.keySet()) { List<IMetric> metrics = locatorToMetrics.get(locator); for (IMetric metric : metrics) { ResultSetFuture future = dEnumIO.putAsync(locator, metric.getCollectionTime(), (Rollup) metric.getMetricValue(), Granularity.FULL, metric.getTtlInSeconds()); future.getUninterruptibly(); } } Range range = getRangeFromMinAgoToNow(5); for ( Locator locator : locatorToMetrics.keySet() ) { List<ResultSetFuture> results = dEnumIO.selectForLocatorAndRange(CassandraModel.CF_METRICS_PREAGGREGATED_FULL_NAME, locator, range); Assert.assertEquals("ResultSetFuture list size", 2, results.size()); Table<Locator, Long, Object> locatorRollup = dEnumIO.toLocatorTimestampValue( results, locator, Granularity.FULL ); Map<Long, Object> resultMap = locatorRollup.row(locator); List<IMetric> expectedMetrics = locatorToMetrics.get(locator); Assert.assertEquals("rollup size", expectedMetrics.size(), resultMap.size()); IMetric expectedMetric = expectedMetrics.get(0); Rollup resultRollup = (Rollup)resultMap.get(expectedMetric.getCollectionTime()); Assert.assertEquals("rollup object for locator " + locator, expectedMetric.getMetricValue(), resultRollup); } }

Target:
public void testWriteAndReadJoinConsistency() throws Exception { for (Locator locator : locatorToMetrics.keySet()) { List<IMetric> metrics = locatorToMetrics.get(locator); for (IMetric metric : metrics) { ResultSetFuture future = dEnumIO.putAsync(locator, metric.getCollectionTime(), (Rollup) metric.getMetricValue(), Granularity.FULL, metric.getTtlInSeconds()); future.getUninterruptibly(); } } Range range = getRangeFromMinAgoToNow(5); for ( Locator locator : locatorToMetrics.keySet() ) { List<ResultSetFuture> results = dEnumIO.selectForLocatorAndRange(CassandraModel.CF_METRICS_PREAGGREGATED_FULL_NAME, locator, range); Assert.assertEquals("ResultSetFuture list size", 2, results.size()); Table<Locator, Long, Rollup> locatorRollup = dEnumIO.toLocatorTimestampValue( results, locator, Granularity.FULL ); Map<Long, Rollup> resultMap = locatorRollup.row(locator); List<IMetric> expectedMetrics = locatorToMetrics.get(locator); Assert.assertEquals("rollup size", expectedMetrics.size(), resultMap.size()); IMetric expectedMetric = expectedMetrics.get(0); Rollup resultRollup = resultMap.get(expectedMetric.getCollectionTime()); Assert.assertEquals("rollup object for locator " + locator, expectedMetric.getMetricValue(), resultRollup); } }
Source:
private boolean isOverrideType(String type) { return Arrays.asList(OVERRIDE_TYPES).contains(type); }

Target:
private boolean isOverrideType(String type) { return OVERRIDE_TYPES.contains(type); }
Source:
public long getMaxTotalMpResponseSize() { return MpTransactionState.MP_MAX_TOTAL_RESP_SIZE / 3; }

Target:
public long getMaxTotalMpResponseSize() { return MpTransactionState.MP_MAX_TOTAL_RESP_SIZE / MpRoSitePool.MAX_POOL_SIZE; }
Source:
public Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback) { ReadIntoCallbackWrapper callbackWrapper = new ReadIntoCallbackWrapper(callback); contentLock.lock(); try { if (!channelOpen.get()) { callbackWrapper.invokeCallback(new ClosedChannelException()); } else if (!channelEmptied.compareAndSet(false, true)) { throw new IllegalStateException("ReadableStreamChannel cannot be read more than once"); } Iterator<ByteBuffer> bufferIterator = buffers.iterator(); while (bufferIterator.hasNext()) { ByteBuffer buffer = bufferIterator.next(); writeContent(asyncWritableChannel, callbackWrapper, buffer); bufferIterator.remove(); } } finally { contentLock.unlock(); } return callbackWrapper.futureResult; }

Target:
public Future<Long> readInto(AsyncWritableChannel asyncWritableChannel, Callback<Long> callback) { ReadIntoCallbackWrapper callbackWrapper = new ReadIntoCallbackWrapper(callback); if (!channelOpen.get()) { callbackWrapper.invokeCallback(new ClosedChannelException()); } else if (!channelEmptied.compareAndSet(false, true)) { throw new IllegalStateException("ReadableStreamChannel cannot be read more than once"); } int bufferListSize = buffers.size(); for (int i = 0; i < bufferListSize; i++) { writeContent(asyncWritableChannel, callbackWrapper, buffers.get(i), i + 1 == bufferListSize); } return callbackWrapper.futureResult; }
Source:
public void writeTo(StreamOutput out) throws IOException { out.writeVInt(entries.size()); for (Entry entry : entries) { entry.snapshot().writeTo(out); out.writeBoolean(entry.includeGlobalState()); out.writeBoolean(entry.partial()); out.writeByte(entry.state().value()); out.writeVInt(entry.indices().size()); for (IndexId index : entry.indices()) { index.writeTo(out); } out.writeLong(entry.startTime()); out.writeVInt(entry.shards().size()); for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> shardEntry : entry.shards()) { shardEntry.key.writeTo(out); shardEntry.value.writeTo(out); } out.writeLong(entry.repositoryStateId); out.writeOptionalString(entry.failure); out.writeMap(entry.userMetadata); if (out.getVersion().onOrAfter(VERSION_IN_SNAPSHOT_VERSION)) { Version.writeVersion(entry.version, out); } else { out.writeBoolean(SnapshotsService.useShardGenerations(entry.version)); } if (out.getVersion().onOrAfter(DATA_STREAMS_IN_SNAPSHOT)) { out.writeStringArray(entry.dataStreams.toArray(new String[0])); } } }

Target:
public void writeTo(StreamOutput out) throws IOException { out.writeVInt(entries.size()); for (Entry entry : entries) { entry.snapshot().writeTo(out); out.writeBoolean(entry.includeGlobalState()); out.writeBoolean(entry.partial()); out.writeByte(entry.state().value()); out.writeVInt(entry.indices().size()); for (IndexId index : entry.indices()) { index.writeTo(out); } out.writeLong(entry.startTime()); out.writeVInt(entry.shards().size()); for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> shardEntry : entry.shards()) { shardEntry.key.writeTo(out); shardEntry.value.writeTo(out); } out.writeLong(entry.repositoryStateId); out.writeOptionalString(entry.failure); out.writeMap(entry.userMetadata); if (out.getVersion().onOrAfter(VERSION_IN_SNAPSHOT_VERSION)) { Version.writeVersion(entry.version, out); } else { out.writeBoolean(SnapshotsService.useShardGenerations(entry.version)); } } }
Source:
private void loadUuidsByKey() { Branch branch = analysisMetadataHolder.getBranch().get(); if (branch.getType() != BranchType.LONG) { uuidsByKey = Collections.emptyMap(); return; } uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<ComponentDto> components = dbClient.componentDao().selectComponentKeysHavingIssuesToMerge(dbSession, analysisMetadataHolder.getUuid()); for (ComponentDto dto : components) { uuidsByKey.computeIfAbsent(removeBranchFromKey(dto.getKey()), s -> new HashSet<>()).add(dto.uuid()); } } }

Target:
private void loadUuidsByKey() { uuidsByKey = new HashMap<>(); try (DbSession dbSession = dbClient.openSession(false)) { List<KeyWithUuidDto> components = dbClient.componentDao().selectComponentKeysHavingIssuesToMerge(dbSession, uuid); for (KeyWithUuidDto dto : components) { uuidsByKey.computeIfAbsent(removeBranchFromKey(dto.key()), s -> new HashSet<>()).add(dto.uuid()); } } }
Source:
public void testJdkVersionDetection() throws NoSuchMethodException, InvocationTargetException, IllegalAccessException { assertEquals(1, Constants.getMajorVersion("1.1.2")); assertEquals(8, Constants.getMajorVersion("1.8.2")); assertEquals(9, Constants.getMajorVersion("9.1.1")); assertEquals(11, Constants.getMajorVersion("11.1.1")); }

Target:
public void testJdkVersionDetection() { assertEquals(1, Constants.getMajorVersion("1.1.2")); assertEquals(8, Constants.getMajorVersion("1.8.2")); assertEquals(9, Constants.getMajorVersion("9.1.1")); assertEquals(11, Constants.getMajorVersion("11.1.1")); }
Source:
ServiceCacheImpl(ServiceDiscoveryImpl<T> discovery, String name, ExecutorService executorService) { Preconditions.checkNotNull(discovery, "discovery cannot be null"); Preconditions.checkNotNull(name, "name cannot be null"); this.discovery = discovery; path = discovery.pathForName(name); cache = CuratorCache.bridgeBuilder(discovery.getClient(), path) .withExecutorService(executorService) .withDataNotCached() .build(); CuratorCacheListener listener = CuratorCacheListener.builder() .forPathChildrenCache(discovery.getClient(), this) .forInitialized(this::initialized) .build(); cache.listenable().addListener(listener); ensureContainers = new EnsureContainers(discovery.getClient(), path); }

Target:
ServiceCacheImpl(ServiceDiscoveryImpl<T> discovery, String name, ExecutorService executorService) { Preconditions.checkNotNull(discovery, "discovery cannot be null"); Preconditions.checkNotNull(name, "name cannot be null"); this.discovery = discovery; String path = discovery.pathForName(name); cache = CuratorCache.bridgeBuilder(discovery.getClient(), path) .withExecutorService(executorService) .withDataNotCached() .build(); CuratorCacheListener listener = CuratorCacheListener.builder() .forPathChildrenCache(path, discovery.getClient(), this) .forInitialized(this::initialized) .build(); cache.listenable().addListener(listener); ensureContainers = new EnsureContainers(discovery.getClient(), path); }