auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
<code>public Socket createSocket( final Socket socket, final String host, final int port, final boolean autoClose ) throws IOException, UnknownHostException { if (autoClose) { <START> socket.close(); <END> } SSLSocket sslSocket = (SSLSocket) socketfactory.createSocket(host, port); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { socketfactory.setHostname(sslSocket, host); } try { hostnameVerifier.verify(host, sslSocket); } catch (IOException iox) { if (autoClose) { try { sslSocket.close(); } catch (Exception x) { } } throw iox; } return sslSocket; }</code><technical_language>autoClose means. autoClose determines invoking Socket.close socket returned this createSocket method close underlying socket (the passed in "socket" argument this createSocket method). rest of code needs fixed too, assumes needs initiate a new connection. Instead, wrap provided Socket SSLSocket</technical_language>

Target:
public Socket createSocket( final Socket socket, final String host, final int port, final boolean autoClose ) throws IOException, UnknownHostException { SSLSocket sslSocket = (SSLSocket) socketfactory.createSocket( socket, host, port, autoClose ); setSocketHostname(sslSocket, host); hostnameVerifier.verify(host, sslSocket); return sslSocket; }
Source:
<code><START> public void testRoundUp() { <END> Assert.assertEquals(Duration.nanos(1).toMillisecondsRoundingAway(), 1); }</code><technical_language>more new methods in Duration tested (e.g. toUnitRoundingToZero)</technical_language>

Target:
public void testRoundUp() { Assert.assertEquals(Duration.nanos(1).toMillisecondsRoundingUp(), 1); }
Source:
<code>private ConstrainedExecutable parseExecutableType(String defaultPackage, List<ParameterType> parameterTypeList, CrossParameterType crossParameterType, ReturnValueType returnValueType, Executable executable) { List<ConstrainedParameter> parameterMetaData = constrainedParameterBuilder.buildConstrainedParameters( parameterTypeList, executable, defaultPackage ); Set<MetaConstraint<?>> crossParameterConstraints = parseCrossParameterConstraints( defaultPackage, crossParameterType, executable ); Set<MetaConstraint<?>> returnValueConstraints = new HashSet<>(); Set<MetaConstraint<?>> returnValueTypeArgumentConstraints = new HashSet<>(); List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); <START> Map<Class<?>, Class<?>> groupConversions = new HashMap<>(); <END> CascadingTypeParameter cascadingMetaData = parseReturnValueType( returnValueType, executable, returnValueConstraints, returnValueTypeArgumentConstraints, cascadingTypeParameters, groupConversions, defaultPackage ); return new ConstrainedExecutable( ConfigurationSource.XML, executable, parameterMetaData, crossParameterConstraints, returnValueConstraints, returnValueTypeArgumentConstraints, cascadingMetaData ); }</code><technical_language>Do need this var? (Probably yes, GH diff, lacking full context)</technical_language>

Target:
private ConstrainedExecutable parseExecutableType(String defaultPackage, List<ParameterType> parameterTypeList, CrossParameterType crossParameterType, ReturnValueType returnValueType, Executable executable) { List<ConstrainedParameter> parameterMetaData = constrainedParameterBuilder.buildConstrainedParameters( parameterTypeList, executable, defaultPackage ); Set<MetaConstraint<?>> crossParameterConstraints = parseCrossParameterConstraints( defaultPackage, crossParameterType, executable ); Set<MetaConstraint<?>> returnValueConstraints = new HashSet<>(); Set<MetaConstraint<?>> returnValueTypeArgumentConstraints = new HashSet<>(); List<CascadingTypeParameter> cascadingTypeParameters = new ArrayList<>(); CascadingTypeParameter cascadingMetaData = parseReturnValueType( returnValueType, executable, returnValueConstraints, returnValueTypeArgumentConstraints, cascadingTypeParameters, defaultPackage ); return new ConstrainedExecutable( ConfigurationSource.XML, executable, parameterMetaData, crossParameterConstraints, returnValueConstraints, returnValueTypeArgumentConstraints, cascadingMetaData ); }
Source:
<code>public Py4jScriptEngine() { <START> super("Python"); <END> }</code><technical_language>add (Py4J) distinguish Jython</technical_language>

Target:
public Py4jScriptEngine() { super("Python (Py4J)"); }
Source:
<code>private List<String> queuesToNames() { return this.queues.stream() <START> .map(q -> q.getActualName()) <END> .collect(Collectors.toList()); }</code><technical_language>map(Queue::getActualName)</technical_language>

Target:
private List<String> queuesToNames() { return this.queues.stream() .map(Queue::getActualName) .collect(Collectors.toList()); }
Source:
<code>public String toString() { StringBuilder paramsValueBuilder = new StringBuilder(); paramsValueBuilder.append("{"); for (String key : mParams.keySet()) { paramsValueBuilder.append(key); paramsValueBuilder.append("="); paramsValueBuilder.append(mParams.get(key).toString()); paramsValueBuilder.append(","); } <START> paramsValueBuilder.append("}"); <END> return "IdpConfig{" + "mProviderId='" + mProviderId + '\'' + ", mScopes=" + mScopes + ", mParams=" + paramsValueBuilder.toString() + '}'; }</code><technical_language>Bundle a toString() similar behavior</technical_language>

Target:
public String toString() { return "IdpConfig{" + "mProviderId='" + mProviderId + '\'' + ", mScopes=" + mScopes + ", mParams=" + mParams + '}'; }
Source:
<code>public LayerNorm(SameDiff sameDiff, SDVariable input, SDVariable gain, SDVariable bias, int... dimensions) { <START> super(null, sameDiff, new SDVariable[] {input, gain, bias}, false); <END> this.dimensions = dimensions; addIArgument(dimensions); }</code><technical_language>Bias null - create length 2 array instead of adding null entry</technical_language>

Target:
public LayerNorm(SameDiff sameDiff, SDVariable input, SDVariable gain, SDVariable bias, int... dimensions) { super(null, sameDiff, new SDVariable[] {input, gain, bias}, false); Preconditions.checkArgument(bias != null, "LayerNorm: Use constructor without bias argument if bias is null / not available."); setDimensions(dimensions); }
Source:
<code>long getFontDescription () { long fontHandle = fontHandle (); if (OS.GTK3) { long context = OS.gtk_widget_get_style_context (fontHandle); if (OS.GTK_VERSION < OS.VERSION(3, 18, 0)) { return OS.gtk_style_context_get_font(context, OS.GTK_STATE_FLAG_NORMAL); } else { <START> int styleState = OS.gtk_widget_get_state_flags(fontHandle); <END> return OS.gtk_style_context_get_font(context, styleState); } } OS.gtk_widget_realize (fontHandle); return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle)); }</code><technical_language>need styleState variable all</technical_language>

Target:
long getFontDescription () { long fontHandle = fontHandle (); if (OS.GTK3) { long context = OS.gtk_widget_get_style_context (fontHandle); int styleState = OS.gtk_widget_get_state_flags(fontHandle); return OS.gtk_style_context_get_font(context, styleState); } OS.gtk_widget_realize (fontHandle); return OS.gtk_style_get_font_desc (OS.gtk_widget_get_style (fontHandle)); }
Source:
<code>private <ScoreHolder extends AbstractScoreHolder<?>> List<RuleItemBuilder<?>> completeWithScoring( Global<ScoreHolder> scoreHolderGlobal, Block5<Drools, ScoreHolder, Object, Object, Object> consequenceImpl) { ConsequenceBuilder._4<ScoreHolder, Object, Object, Object> consequence = on(scoreHolderGlobal, aMetadata.getVariableDeclaration(), bMetadata.getVariableDeclaration(), cMetadata.getVariableDeclaration()) .execute(consequenceImpl); if (aMetadata instanceof DroolsInferredMetadata && bMetadata instanceof DroolsInferredMetadata && cMetadata instanceof DroolsInferredMetadata) { return Stream.of(cMetadata.buildPattern(), consequence) .collect(Collectors.toList()); } else { return Stream.of(aMetadata.buildPattern(), bMetadata.buildPattern(), cMetadata.buildPattern(), consequence) <START> .collect(Collectors.toList()); <END> } }</code><technical_language>I suspect Arrays.asList(aMetadata.buildPattern(), bMetadata.buildPattern(), cMetadata.buildPattern(), consequence) is faster verbose</technical_language>

Target:
private <ScoreHolder extends AbstractScoreHolder<?>> List<RuleItemBuilder<?>> completeWithScoring( Global<ScoreHolder> scoreHolderGlobal, Block5<Drools, ScoreHolder, Object, Object, Object> consequenceImpl) { ConsequenceBuilder._4<ScoreHolder, Object, Object, Object> consequence = on(scoreHolderGlobal, aMetadata.getVariableDeclaration(), bMetadata.getVariableDeclaration(), cMetadata.getVariableDeclaration()) .execute(consequenceImpl); if (aMetadata instanceof DroolsInferredMetadata && bMetadata instanceof DroolsInferredMetadata && cMetadata instanceof DroolsInferredMetadata) { return Stream.of(cMetadata.buildPattern(), consequence) .collect(Collectors.toList()); } else { return Arrays.asList(aMetadata.buildPattern(), bMetadata.buildPattern(), cMetadata.buildPattern(), consequence); } }
Source:
<code>public void testNetworkInterceptors() { ParseNetworkInterceptor interceptorA = mock(ParseNetworkInterceptor.class); ParseNetworkInterceptor interceptorB = mock(ParseNetworkInterceptor.class); Parse.Configuration.Builder builder = new Parse.Configuration.Builder(null); builder.addNetworkInterceptor(interceptorA); Parse.Configuration configurationA = builder.build(); builder.addNetworkInterceptor(interceptorB); Parse.Configuration configurationB = builder.build(); assertFalse(configurationA.interceptors.contains(interceptorB)); assertTrue(configurationB.interceptors.contains(interceptorB)); try { configurationA.interceptors.add(interceptorB); <START> fail(); <END> } catch (UnsupportedOperationException ex) { } }</code><technical_language>add a message "interceptors mutable"</technical_language>

Target:
public void testNetworkInterceptors() { ParseNetworkInterceptor interceptorA = mock(ParseNetworkInterceptor.class); ParseNetworkInterceptor interceptorB = mock(ParseNetworkInterceptor.class); Parse.Configuration.Builder builder = new Parse.Configuration.Builder(null); builder.addNetworkInterceptor(interceptorA); Parse.Configuration configurationA = builder.build(); builder.addNetworkInterceptor(interceptorB); Parse.Configuration configurationB = builder.build(); assertFalse(configurationA.interceptors.contains(interceptorB)); assertTrue(configurationB.interceptors.contains(interceptorB)); try { configurationA.interceptors.add(interceptorB); fail("Interceptors shouldn't be mutable."); } catch (UnsupportedOperationException ex) { } }
Source:
<code>public Health health() { final long cpuCount = summaryCpuMetric.count(); final long cpuTotal = summaryCpuMetric.totalAmount(); <START> final double currentCpuLoadPercent = cpuCount == 0 ? 0 : (cpuTotal / (double) cpuCount); <END> if (currentCpuLoadPercent > maxCpuLoadPercent) { cpuLoadConsecutiveOccurrences++; } if (cpuLoadConsecutiveOccurrences >= maxCpuLoadConsecutiveOccurrences) { log.warn("CPU usage crossed the threshold of {}", currentCpuLoadPercent, maxCpuLoadPercent); return Health .outOfService() .withDetail(CPU_LOAD, currentCpuLoadPercent) .build(); } else { cpuLoadConsecutiveOccurrences = 0; return Health .up() .withDetail(CPU_LOAD, currentCpuLoadPercent) .build(); } }</code><technical_language>This current cpu load, average class instantiated. totalAmount count return cumulative values meter created</technical_language>

Target:
public Health health() { final long cpuCount = summaryCpuMetric.getCount(); final long cpuTotal = summaryCpuMetric.getTotalAmount(); final double currentCpuLoadPercent = cpuCount == 0 ? operatingSystemMXBean.getProcessCpuLoad() : (cpuTotal / (double) cpuCount); if (currentCpuLoadPercent > maxCpuLoadPercent) { cpuLoadConsecutiveOccurrences++; } else { cpuLoadConsecutiveOccurrences = 0; } if (cpuLoadConsecutiveOccurrences >= maxCpuLoadConsecutiveOccurrences) { log.warn("CPU usage crossed the threshold of {}", currentCpuLoadPercent, maxCpuLoadPercent); return Health .outOfService() .withDetail(CPU_LOAD, currentCpuLoadPercent) .build(); } else { return Health .up() .withDetail(CPU_LOAD, currentCpuLoadPercent) .build(); } }
Source:
<code>public static void reportHistory(final CommandSender sender, final String username) { new BukkitRunnable() { @Override public void run() { UUID uuid; FHistory history = null; uuid = UUIDFetcher.fetch(username); if (uuid != null) { Gson gson = new GsonBuilder().create(); String compactUuid = uuid.toString().replace("-", ""); try { URL url = new URL("<LINK_0>" + compactUuid + "/names"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); FName[] oldNames = gson.fromJson(reader, FName[].class); reader.close(); conn.disconnect(); Arrays.sort(oldNames); history = new FHistory(uuid, oldNames); printHistory(sender, oldNames); } catch (Exception ex) { FLog.severe(ex); } if (history == null) { <START> sender.sendMessage(ChatColor.RED + "Player not found!"); <END> } } } }.runTaskAsynchronously(TotalFreedomMod.plugin()); }</code><technical_language>Bukkit API is thread safe, call this method asynchronously. resynchronise server first</technical_language>

Target:
public static void reportHistory(final CommandSender sender, final String username) { new BukkitRunnable() { @Override public void run() { UUID uuid = UUIDFetcher.fetch(username); if (uuid != null) { Gson gson = new GsonBuilder().create(); String compactUuid = uuid.toString().replace("-", ""); try { URL url = new URL("<LINK_0>" + compactUuid + "/names"); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(conn.getInputStream())); FName[] oldNames = gson.fromJson(reader, FName[].class); if (oldNames == null) { FSync.playerMsg(sender, ChatColor.RED + "Player not found!"); return; } reader.close(); conn.disconnect(); Arrays.sort(oldNames); printHistory(sender, oldNames); } catch (Exception ex) { FSync.playerMsg(sender, ChatColor.RED + "Error, see logs for more details."); FLog.severe(ex); } } else { FSync.playerMsg(sender, ChatColor.RED + "Player not found!"); } } }.runTaskAsynchronously(TotalFreedomMod.plugin()); }
Source:
<code>public boolean process() { if (result != null) { <START> return true; <END> } if (needRehash() && !tryRehash()) { return false; } int positionCount = block.getPositionCount(); verify(lastPosition < positionCount, "position count out of bound"); while (lastPosition < positionCount) { int groupId = putIfAbsent(lastPosition, block); BIGINT.writeLong(blockBuilder, groupId); lastPosition++; if (needRehash()) { break; } } if (lastPosition == positionCount) { result = new GroupByIdBlock(nextGroupId, blockBuilder.build()); return true; } return false; }</code><technical_language>process() returns true called more (i guess so), checkState(result==null)</technical_language>

Target:
public boolean process() { int positionCount = block.getPositionCount(); checkState(lastPosition < positionCount, "position count out of bound"); checkState(!finished); if (needRehash() && !tryRehash()) { return false; } while (lastPosition < positionCount && !needRehash()) { BIGINT.writeLong(blockBuilder, putIfAbsent(lastPosition, block)); lastPosition++; } return lastPosition == positionCount; }
Source:
<code>public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); <START> init(); <END> getOutputSchema(); pipelineConfigurer.getStageConfigurer().setOutputSchema(outputSchema); }</code><technical_language>Do need this while configuring pipeline</technical_language>

Target:
public void configurePipeline(PipelineConfigurer pipelineConfigurer) { super.configurePipeline(pipelineConfigurer); sourceConfig.validate(); if (!Strings.isNullOrEmpty(sourceConfig.outputSchema)) { pipelineConfigurer.getStageConfigurer().setOutputSchema(sourceConfig.getSchema()); } }
Source:
<code>public void setAltAssoc(AltAST t, int alt) { ASSOC assoc = ASSOC.left; if ( t.getOptions()!=null ) { String a = t.getOptionString("assoc"); if ( a!=null ) { if ( a.equals(ASSOC.right.toString()) ) { assoc = ASSOC.right; } else if ( a.equals(ASSOC.left.toString()) ) { assoc = ASSOC.left; } else { <START> tool.errMgr.toolError(ErrorType.ILLEGAL_OPTION_VALUE, t.getToken(), "assoc", assoc); <END> } } } if ( altAssociativity.get(alt)!=null && altAssociativity.get(alt)!=assoc ) { tool.errMgr.toolError(ErrorType.ALL_OPS_NEED_SAME_ASSOC, alt); } altAssociativity.put(alt, assoc); }</code><technical_language>This t.getOptionAST("assoc").getToken() token position information (to provide position of option itself, instead of position of start of alternative)</technical_language>

Target:
public void setAltAssoc(AltAST t, int alt) { ASSOC assoc = ASSOC.left; if ( t.getOptions()!=null ) { String a = t.getOptionString("assoc"); if ( a!=null ) { if ( a.equals(ASSOC.right.toString()) ) { assoc = ASSOC.right; } else if ( a.equals(ASSOC.left.toString()) ) { assoc = ASSOC.left; } else { tool.errMgr.toolError(ErrorType.ILLEGAL_OPTION_VALUE, t.getOptionAST("assoc").getToken(), "assoc", assoc); } } } if ( altAssociativity.get(alt)!=null && altAssociativity.get(alt)!=assoc ) { tool.errMgr.toolError(ErrorType.ALL_OPS_NEED_SAME_ASSOC, alt); } altAssociativity.put(alt, assoc); }
Source:
<code>private boolean checkFilterForBoolean(Filter filter, Boolean param) { OperatorType operatorType = OperatorType.fromString(filter.getOperator()); boolean result = false; boolean expressionValue = Boolean.parseBoolean(filter.getExpression()); if (operatorType != null) { switch (operatorType) { case EXIST: <START> result = true; <END> break; case AND: result = param && expressionValue; break; case OR: result = param || expressionValue; break; default: result = false; } } return result; }</code><technical_language>this check if param is true? (result = param) If returns true pointless</technical_language>

Target:
private boolean checkFilterForBoolean(Filter filter, Boolean param) { OperatorType operatorType = OperatorType.fromString(filter.getOperator()); boolean result = false; boolean expressionValue = Boolean.parseBoolean(filter.getExpression()); if (operatorType != null) { switch (operatorType) { case EXIST: result = param; break; case AND: result = param && expressionValue; break; case OR: result = param || expressionValue; break; default: result = false; } } return result; }
Source:
<code>public void getRadiologyOrdersByPatients_shouldReturnAllRadiologyOrdersAssociatedWithGivenPatients() { Patient patientWithTwoRadiologyOrders = patientService.getPatient(PATIENT_ID_WITH_FOUR_RADIOLOGY_ORDERS); Patient patientWithOneRadiologyOrder = patientService.getPatient(PATIENT_ID_WITH_ONE_RADIOLOGY_ORDER); List<Patient> patientsWithThreeRadiologyOrders = new ArrayList<Patient>(); patientsWithThreeRadiologyOrders.add(patientWithTwoRadiologyOrders); patientsWithThreeRadiologyOrders.add(patientWithOneRadiologyOrder); List<RadiologyOrder> radiologyOrders = radiologyService .getRadiologyOrdersByPatients(patientsWithThreeRadiologyOrders); <START> assertThat(radiologyOrders.size(), is(7)); <END> }</code><technical_language>please exchange number TOTAL_NUMBER_OF_RADIOLOGY_ORDERS</technical_language>

Target:
public void getRadiologyOrdersByPatients_shouldReturnAllRadiologyOrdersAssociatedWithGivenPatients() { Patient patientWithTwoRadiologyOrders = patientService.getPatient(PATIENT_ID_WITH_FOUR_RADIOLOGY_ORDERS); Patient patientWithOneRadiologyOrder = patientService.getPatient(PATIENT_ID_WITH_ONE_RADIOLOGY_ORDER); List<Patient> patientsWithThreeRadiologyOrders = new ArrayList<Patient>(); patientsWithThreeRadiologyOrders.add(patientWithTwoRadiologyOrders); patientsWithThreeRadiologyOrders.add(patientWithOneRadiologyOrder); List<RadiologyOrder> radiologyOrders = radiologyService .getRadiologyOrdersByPatients(patientsWithThreeRadiologyOrders); assertThat(radiologyOrders.size(), is(TOTAL_NUMBER_OF_RADIOLOGY_ORDERS)); }
Source:
<code>public void whenPostEventTimesOutThenUpdateItemStatus() throws Exception { <START> BatchItem item = new BatchItem(new JSONObject()); <END> item.setPartition("1"); List<BatchItem> batch = new ArrayList<>(); batch.add(item); when(settings.getKafkaSendTimeoutMs()).thenReturn((long) 100); Mockito .doReturn(mock(Future.class)) .when(kafkaProducer) .send(any(), any()); try { kafkaTopicRepository.syncPostBatch(EXPECTED_PRODUCER_RECORD.topic(), batch); fail(); } catch (EventPublishingException e) { assertThat(item.getResponse().getPublishingStatus(), equalTo(EventPublishingStatus.FAILED)); assertThat(item.getResponse().getDetail(), equalTo("timed out")); } }</code><technical_language>final</technical_language>

Target:
public void whenPostEventTimesOutThenUpdateItemStatus() throws Exception { final BatchItem item = new BatchItem(new JSONObject()); item.setPartition("1"); final List<BatchItem> batch = new ArrayList<>(); batch.add(item); when(settings.getKafkaSendTimeoutMs()).thenReturn((long) 100); Mockito .doReturn(mock(Future.class)) .when(kafkaProducer) .send(any(), any()); try { kafkaTopicRepository.syncPostBatch(EXPECTED_PRODUCER_RECORD.topic(), batch); fail(); } catch (EventPublishingException e) { assertThat(item.getResponse().getPublishingStatus(), equalTo(EventPublishingStatus.FAILED)); assertThat(item.getResponse().getDetail(), equalTo("timed out")); } }
Source:
<code><START> public static synchronized UserTuneManager getInstanceFor(XMPPConnection connection) { <END> UserTuneManager manager = INSTANCES.get(connection); if (manager == null) { manager = new UserTuneManager(connection); INSTANCES.put(connection, manager); } return manager; }</code><technical_language>getInstanceFor() method constructor</technical_language>

Target:
public static synchronized UserTuneManager getInstanceFor(XMPPConnection connection) throws NotLoggedInException { UserTuneManager manager = INSTANCES.get(connection); if (manager == null) { manager = new UserTuneManager(connection); INSTANCES.put(connection, manager); } return manager; }
Source:
<code>private AnnotatedConstructor buildAnnotatedConstructorForDecorator(Decorator decorator) { <START> List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>(); <END> for ( Field field : decorator.getFields() ) { if ( field instanceof AnnotationMapperReference ) { mapperReferencesForConstructor.add( (AnnotationMapperReference) field ); } } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeReferenceAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( decorator.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }</code><technical_language>size of fields initial size for list</technical_language>

Target:
private AnnotatedConstructor buildAnnotatedConstructorForDecorator(Decorator decorator) { List<AnnotationMapperReference> mapperReferencesForConstructor = new ArrayList<AnnotationMapperReference>( decorator.getFields().size() ); for ( Field field : decorator.getFields() ) { if ( field instanceof AnnotationMapperReference ) { mapperReferencesForConstructor.add( (AnnotationMapperReference) field ); } } List<Annotation> mapperReferenceAnnotations = getMapperReferenceAnnotations(); removeDuplicateAnnotations( mapperReferencesForConstructor, mapperReferenceAnnotations ); return new AnnotatedConstructor( decorator.getName(), mapperReferencesForConstructor, mapperReferenceAnnotations, additionalPublicEmptyConstructor() ); }
Source:
<code>public PerformanceRating getPerformance() { <START> float percentage = Math.round(((((totalElapsedTime / 1000000.0) * 100.0F) / PerformanceSummary.MAX_TICK_DURATION) * 100.0F) / 100.0F); <END> for (PerformanceRating rating : PerformanceRating.values()) { if (rating.test(percentage)) { return rating; } } return PerformanceRating.UNKNOWN; }</code><technical_language>this in line cumbersome. fact in 2 places means this a util method. this clearer avoid human error is for this</technical_language>

Target:
public PerformanceRating getPerformance() { float percentage = getPercentageOfTick(); for (PerformanceRating rating : PerformanceRating.values()) { if (rating.test(percentage)) { return rating; } } return PerformanceRating.UNKNOWN; }
Source:
<code>public void testExecuteInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); <START> queryExecutor.execute(groupRequest); <END> }</code><technical_language>Check for equality of error code</technical_language>

Target:
public void testExecuteInvalidTable() throws Exception { GroupRequest groupRequest = new GroupRequest(); groupRequest.setTable(TestUtils.TEST_TABLE_NAME + "-dummy-32"); groupRequest.setNesting(Arrays.asList("os", "device", "version")); try { queryExecutor.execute(groupRequest); } catch (QueryStoreException e) { assertEquals(QueryStoreException.ErrorCode.NO_SUCH_TABLE, e.getErrorCode()); throw e; } }
Source:
<code>public static Guid GetEntityGuid(Object entity) { if (entity instanceof VM) { return ((VM) entity).getId(); } else if (entity instanceof storage_pool) { return ((storage_pool) entity).getId(); } else if (entity instanceof VDSGroup) { return ((VDSGroup) entity).getId(); } else if (entity instanceof VDS) { return ((VDS) entity).getId(); } else if (entity instanceof storage_domains) { return ((storage_domains) entity).getId(); } else if (entity instanceof VmTemplate) { return ((VmTemplate) entity).getId(); } else if (entity instanceof vm_pools) { return ((vm_pools) entity).getvm_pool_id(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getuser_id(); } else if (entity instanceof Quota) { return ((Quota) entity).getId(); } else if (entity instanceof DiskImage) { return ((DiskImage) entity).getId(); } else if (entity instanceof GlusterVolumeEntity) { return ((GlusterVolumeEntity) entity).getId(); } else if (entity instanceof Network) { return ((Network) entity).getId(); } <START> else if (entity instanceof NetworkView) <END> { return ((NetworkView) entity).getId(); } return new Guid(); }</code><technical_language>I this deleted</technical_language>

Target:
public static Guid GetEntityGuid(Object entity) { if (entity instanceof VM) { return ((VM) entity).getId(); } else if (entity instanceof storage_pool) { return ((storage_pool) entity).getId(); } else if (entity instanceof VDSGroup) { return ((VDSGroup) entity).getId(); } else if (entity instanceof VDS) { return ((VDS) entity).getId(); } else if (entity instanceof storage_domains) { return ((storage_domains) entity).getId(); } else if (entity instanceof VmTemplate) { return ((VmTemplate) entity).getId(); } else if (entity instanceof vm_pools) { return ((vm_pools) entity).getvm_pool_id(); } else if (entity instanceof DbUser) { return ((DbUser) entity).getuser_id(); } else if (entity instanceof Quota) { return ((Quota) entity).getId(); } else if (entity instanceof DiskImage) { return ((DiskImage) entity).getId(); } else if (entity instanceof GlusterVolumeEntity) { return ((GlusterVolumeEntity) entity).getId(); } else if (entity instanceof Network) { return ((Network) entity).getId(); } return new Guid(); }
Source:
<code>public void loadSettings() { settings = new RendererSettings(); String defaultRenderer = System.getProperty(DEFAULT_RENDERER_PROPERTY, ""); String offlineStr = System.getProperty(OFFLINE_RENDERER_PROPERTY, "false"); boolean offline; try { <START> offline = Boolean.parseBoolean(offlineStr); <END> } catch(Exception e) { offline = false; } settings.setDefaultRenderer(defaultRenderer); settings.setOffline(offline); }</code><technical_language>nitpick: [Boolean.parseBoolean(String)](<LINK_0> throws exception: java public static boolean parseBoolean(String s) { return s != null && s.equalsIgnoreCase("true"); } simplify this java boolean offline = Boolean.parseBoolean(offlineStr);</technical_language>

Target:
public void loadSettings() { String defaultRenderer = System.getProperty(DEFAULT_RENDERER_PROPERTY, ""); String offlineStr = System.getProperty(OFFLINE_RENDERER_PROPERTY, "false"); boolean offline= Boolean.parseBoolean(offlineStr); settings = new RendererSettings(defaultRenderer, offline); }
Source:
<code>public <T> Set<T> including(Set<T> set, T object) { if (set.contains(object)) { return Sets.newLinkedHashSet(set); <START> } else { <END> Set<T> result = Sets.newLinkedHashSet(set); result.add(object); return result; } }</code><technical_language>want return set in this case if behavior List</technical_language>

Target:
public <T> Set<T> including(Set<T> set, T object) { if (set.contains(object)) { return set; } else { Set<T> result = Sets.newLinkedHashSet(set); result.add(object); return result; } }
Source:
<code>ListenableFuture<Void> eventReceived(T event) { if (state == State.STOPPED) { logger.trace("{} debouncer is stopped, rejecting event: {}", name, event); return MoreFutures.VOID_SUCCESS; } checkNotNull(event); logger.trace("{} debouncer: event received {}", name, event); if (eventCount.incrementAndGet() > maxQueuedEvents) { long now = System.nanoTime(); if (now > lastOverflowWarning + OVERFLOW_WARNING_INTERVAL) { lastOverflowWarning = now; logger.warn("{} debouncer enqueued more than events, rejecting new events. " + "This should not happen and is likely a sign that something is wrong.", name, maxQueuedEvents); } eventCount.decrementAndGet(); return MoreFutures.VOID_SUCCESS; } Entry<T> entry = new Entry<T>(event); try { events.add(entry); } catch (RuntimeException e) { eventCount.decrementAndGet(); throw e; } if (state == State.RUNNING) { int count = eventCount.get(); if (count < maxPendingEvents()) { scheduleDelayedDelivery(); } else if (count == maxPendingEvents()) { <START> scheduleImmediateDelivery(); <END> } } else if (state == State.STOPPED) { entry.future.set(null); } return entry.future; }</code><technical_language>If maxPendingEvents() is decreased dynamically, miss condition schedule delivery (since count > maxPendingEvents()). if a huge issue a delayed delivery scheduled</technical_language>

Target:
ListenableFuture<Void> eventReceived(T event) { if (state == State.STOPPED) { logger.trace("{} debouncer is stopped, rejecting event: {}", name, event); return MoreFutures.VOID_SUCCESS; } checkNotNull(event); logger.trace("{} debouncer: event received {}", name, event); if (eventCount.incrementAndGet() > maxQueuedEvents) { long now = System.nanoTime(); if (now > lastOverflowWarning + OVERFLOW_WARNING_INTERVAL) { lastOverflowWarning = now; logger.warn("{} debouncer enqueued more than events, rejecting new events. " + "This should not happen and is likely a sign that something is wrong.", name, maxQueuedEvents); } eventCount.decrementAndGet(); return MoreFutures.VOID_SUCCESS; } Entry<T> entry = new Entry<T>(event); try { events.add(entry); } catch (RuntimeException e) { eventCount.decrementAndGet(); throw e; } if (state == State.RUNNING) { int count = eventCount.get(); int maxPendingEvents = maxPendingEvents(); if (count < maxPendingEvents) { scheduleDelayedDelivery(); } else if (count == maxPendingEvents) { scheduleImmediateDelivery(); } } else if (state == State.STOPPED) { entry.future.set(null); } return entry.future; }
Source:
<code>public void onReceive(Context context, Intent intent) { <START> <END> final StumblerBundle bundle = intent.getParcelableExtra(Reporter.NEW_BUNDLE_ARG_BUNDLE); mStorage.insert(bundle.getGpsPosition()); }</code><technical_language>remove LBStumblerBundleReceiver commit</technical_language>

Target:
public void onReceive(Context context, Intent intent) { if (Prefs.getInstance(context).getBearerToken() != null) { final StumblerBundle bundle = intent.getParcelableExtra(Reporter.NEW_BUNDLE_ARG_BUNDLE); mStorage.insert(bundle.getGpsPosition()); } }
Source:
<code>void validate(boolean isCalendarFolder, int permissionIndex) throws ServiceValidationException, ServiceLocalException { if (!this.userId.isValid()) { throw new ServiceValidationException(String.format( <START> "The UserId in the folder permission at index %d is invalid. The StandardUser, PrimarySmtpAddress, or SID property must be set.", permissionIndex)); <END> } if (!isCalendarFolder) { if ((this.readItems == FolderPermissionReadAccess.TimeAndSubjectAndLocation) || (this.readItems == FolderPermissionReadAccess. TimeOnly)) { throw new ServiceLocalException(String.format( "Permission read access value %s cannot be used with non-calendar folder.", this.readItems)); } if ((this.permissionLevel == FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation) || (this.permissionLevel == FolderPermissionLevel. FreeBusyTimeOnly)) { throw new ServiceLocalException(String.format( "Permission level value %s cannot be used with non-calendar folder.", this.permissionLevel)); } } }</code><technical_language>line-lenght ok</technical_language>

Target:
void validate(boolean isCalendarFolder, int permissionIndex) throws ServiceValidationException, ServiceLocalException { if (!this.userId.isValid()) { throw new ServiceValidationException(String.format( "The UserId in the folder permission at index %d is invalid. " + "The StandardUser, PrimarySmtpAddress, or SID property must be set.", permissionIndex)); } if (!isCalendarFolder) { if ((this.readItems == FolderPermissionReadAccess.TimeAndSubjectAndLocation) || (this.readItems == FolderPermissionReadAccess. TimeOnly)) { throw new ServiceLocalException(String.format( "Permission read access value %s cannot be used with non-calendar folder.", this.readItems)); } if ((this.permissionLevel == FolderPermissionLevel.FreeBusyTimeAndSubjectAndLocation) || (this.permissionLevel == FolderPermissionLevel. FreeBusyTimeOnly)) { throw new ServiceLocalException(String.format( "Permission level value %s cannot be used with non-calendar folder.", this.permissionLevel)); } } }
Source:
<code>public int restartModule(IModule[] module, IProgressMonitor monitor) throws CoreException { IPath archiveDestination = getModuleDeployRoot(module); IFilesystemController controller = getFilesystemController(); <START> if( ServerModelUtilities.isBinaryModule(module[module.length-1]) || getDeploymentOptions().prefersZippedDeployments()) { <END> controller.touchResource(archiveDestination, monitor); } else { JSTPublisherXMLToucher.getInstance().touch(archiveDestination, module[0], controller); } return IServer.STATE_STARTED; }</code><technical_language>want check module.length</technical_language>

Target:
public int restartModule(IModule[] module, IProgressMonitor monitor) throws CoreException { if( !canRestartModule(module)) { return getServer().getModuleState(module); } IPath archiveDestination = getModuleDeployRoot(module); IFilesystemController controller = getFilesystemController(); if( ServerModelUtilities.isBinaryModule(module[module.length-1]) || getDeploymentOptions().prefersZippedDeployments()) { controller.touchResource(archiveDestination, monitor); } else { JSTPublisherXMLToucher.getInstance().touch(archiveDestination, module[0], controller); } return IServer.STATE_STARTED; }
Source:
<code>private void writeErrorReport(List<RassXmlFileParseResult> errorResults) { initializeNewReport(RassConstants.RASS_PARSE_ERRORS_BASE_FILENAME); reportWriterService.writeFormattedMessageLine("RASS Error Report"); reportWriterService.writeNewLines(1); reportWriterService.writeFormattedMessageLine( "Unexpected errors were encountered when attempting to read the following RASS XML files."); reportWriterService.writeFormattedMessageLine( "The failures were likely the result of incorrect XML formatting."); reportWriterService.writeFormattedMessageLine( <START> "Specific details are available in the RASS batch job logs."); <END> reportWriterService.writeNewLines(1); for (RassXmlFileParseResult errorResult : errorResults) { String xmlFileName = getFileNameWithoutPath(errorResult.getRassXmlFileName()); reportWriterService.writeFormattedMessageLine(xmlFileName); } finalizeReportForCurrentFile(); }</code><technical_language>lines moved a property a parameter</technical_language>

Target:
private void writeErrorReport(List<RassXmlFileParseResult> errorResults) { initializeNewReport(RassConstants.RASS_PARSE_ERRORS_BASE_FILENAME); reportWriterService.writeFormattedMessageLine("RASS Error Report"); reportWriterService.writeNewLines(1); writeFormattedMessageLineForConfigProperty(RassKeyConstants.MESSAGE_RASS_REPORT_ERROR_HEADER_LINE1); writeFormattedMessageLineForConfigProperty(RassKeyConstants.MESSAGE_RASS_REPORT_ERROR_HEADER_LINE2); writeFormattedMessageLineForConfigProperty(RassKeyConstants.MESSAGE_RASS_REPORT_ERROR_HEADER_LINE3); reportWriterService.writeNewLines(1); for (RassXmlFileParseResult errorResult : errorResults) { String xmlFileName = getFileNameWithoutPath(errorResult.getRassXmlFileName()); reportWriterService.writeFormattedMessageLine(xmlFileName); } finalizeReportForCurrentFile(); }
Source:
<code>protected byte[] doDecompress(byte[] compressedData) throws IOException { <START> try (ByteArrayInputStream bis = new ByteArrayInputStream(compressedData); <END> ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPInputStream gzipIS = new GZIPInputStream(bis)) { byte[] buffer = new byte[1024]; int len; while ((len = gzipIS.read(buffer)) != -1) { bos.write(buffer, 0, len); } return bos.toByteArray(); } catch (ZipException e) { throw new NotCompressedException("Content format not GZIP or compression method not supported.", e); } }</code><technical_language>GZip, easy validate a byte[] contains zipped information: bytes 0x1f8b. If aren't, data is decompressed (or compressed). wrapper return original byte[]</technical_language>

Target:
protected byte[] doDecompress(byte[] compressedData) throws IOException { if(compressedData != null && compressedData.length > 2 && compressedData[0] == (byte) 0x1f && compressedData[1] == (byte) 0x8b) { try (ByteArrayInputStream bis = new ByteArrayInputStream(compressedData); ByteArrayOutputStream bos = new ByteArrayOutputStream(); GZIPInputStream gzipIS = new GZIPInputStream(bis)) { byte[] buffer = new byte[1024]; int len; while ((len = gzipIS.read(buffer)) != -1) { bos.write(buffer, 0, len); } return bos.toByteArray(); } } else { return compressedData; } }
Source:
<code>public void selectByQuery_key_with_special_characters() { db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("project-_%-key")); <START> db.components().insertProjectAndSnapshot(ComponentTesting.newPrivateProjectDto(db.organizations().insert()).setDbKey("project-key-that-does-not-match")); <END> ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("project-_%-key").setQualifiers(Qualifiers.PROJECT).build(); List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); assertThat(result.get(0).getDbKey()).isEqualTo("project-_%-key"); }</code><technical_language>I do a static import of ComponentTesting improve readability</technical_language>

Target:
public void selectByQuery_key_with_special_characters() { db.components().insertProjectAndSnapshot(newPrivateProjectDto(db.organizations().insert()).setDbKey("project-_%-key")); db.components().insertProjectAndSnapshot(newPrivateProjectDto(db.organizations().insert()).setDbKey("project-key-that-does-not-match")); ComponentQuery query = ComponentQuery.builder().setNameOrKeyQuery("project-_%-key").setQualifiers(Qualifiers.PROJECT).build(); List<ComponentDto> result = underTest.selectByQuery(dbSession, query, 0, 10); assertThat(result).hasSize(1); assertThat(result.get(0).getDbKey()).isEqualTo("project-_%-key"); }
Source:
<code>protected Object[] getLocalizedMessageArguments() { <START> return new Object[] { attribute.getName(), type, String.join("or", expectedTypes) }; <END> }</code><technical_language>" " spaces thinks</technical_language>

Target:
protected Object[] getLocalizedMessageArguments() { return new Object[] { attribute.getName(), type, String.join(",", expectedTypes) }; }
Source:
<code>public static Fixture prepareDirectoryAndPageCache( Class<?> testClass ) throws IOException { DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); TestDirectory testDirectory = TestDirectory.testDirectory( testClass, fileSystem ); File dir = testDirectory.prepareDirectoryForTest( "test" ); <START> fileSystem.mkdirs( dir ); <END> PageCache pageCache = StandalonePageCacheFactory.createPageCache( fileSystem ); return new Fixture( pageCache, fileSystem, dir ); }</code><technical_language>need do it, testDirectory for</technical_language>

Target:
public static Fixture prepareDirectoryAndPageCache( Class<?> testClass ) throws IOException { DefaultFileSystemAbstraction fileSystem = new DefaultFileSystemAbstraction(); TestDirectory testDirectory = TestDirectory.testDirectory( testClass, fileSystem ); File dir = testDirectory.prepareDirectoryForTest( "test" ); PageCache pageCache = StandalonePageCacheFactory.createPageCache( fileSystem ); return new Fixture( pageCache, fileSystem, dir ); }
Source:
<code>public void test() { JavaCheckVerifier.verify("src/test/files/checks/spring/SpringSecurityDisableCSRFCheck.java", new SpringSecurityDisableCSRFCheck()); <START> JavaCheckVerifier.verifyNoIssueWithoutSemantic("src/test/files/checks/spring/SpringSecurityDisableCSRFCheck.java", new SpringSecurityDisableCSRFCheck()); <END> }</code><technical_language>this line is useless, AbstractMethodDetection checks work semantic, change coverage</technical_language>

Target:
public void test() { JavaCheckVerifier.verify("src/test/files/checks/spring/SpringSecurityDisableCSRFCheck.java", new SpringSecurityDisableCSRFCheck()); }
Source:
<code>protected String getModuleUrl(LibraryRequest request, String modulePath, ModuleType type) { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "getModuleUrl", new Object[] { request, modulePath }); } String jsUrl = ""; String moduleUrl = ""; switch (type) { <START> case MODULE: <END> jsUrl = request.getToolkitJsUrl(); break; case EXTENSION: jsUrl = request.getToolkitExtJsUrl(); break; case LIBRARY: jsUrl = request.getJsLibraryUrl(); break; default: moduleUrl = modulePath; break; } moduleUrl = moduleUrl.isEmpty() ? PathUtil.concat(jsUrl, modulePath, '/') : moduleUrl; if (logger.isLoggable(Level.FINEST)) { logger.exiting(sourceClass, "getModuleUrl", moduleUrl); } return moduleUrl; }</code><technical_language>MODULE EXTENSION LIBRARY confusing read this code obvious are. change SBT_MODULE, SBTX_MODULE JS_LIBRARY</technical_language>

Target:
protected String getModuleUrl(LibraryRequest request, String modulePath, ModuleType type) { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "getModuleUrl", new Object[] { request, modulePath }); } String jsUrl = ""; String moduleUrl = ""; switch (type) { case SBT_MODULE: jsUrl = request.getToolkitJsUrl(); break; case SBTX_MODULE: jsUrl = request.getToolkitExtJsUrl(); break; case JS_LIBRARY: jsUrl = request.getJsLibraryUrl(); break; default: moduleUrl = modulePath; break; } moduleUrl = moduleUrl.isEmpty() ? PathUtil.concat(jsUrl, modulePath, '/') : moduleUrl; if (logger.isLoggable(Level.FINEST)) { logger.exiting(sourceClass, "getModuleUrl", moduleUrl); } return moduleUrl; }
Source:
<code>public PeriodicMeterReadsAsyncResponse getPeriodicMeterReads( @OrganisationIdentification final String organisationIdentification, @RequestPayload final PeriodicMeterReadsRequest request) throws OsgpException { <START> LOGGER.debug("Incoming PeriodicMeterReadsRequest for meter: {}.", request.getDeviceIdentification()); <END> return (PeriodicMeterReadsAsyncResponse) this.getPeriodic(organisationIdentification, request); }</code><technical_language>is reason for this kind of changes (almost?) else convention log incoming requests endpoints info level</technical_language>

Target:
public PeriodicMeterReadsAsyncResponse getPeriodicMeterReads( @OrganisationIdentification final String organisationIdentification, @RequestPayload final PeriodicMeterReadsRequest request) throws OsgpException { LOGGER.debug("Incoming PeriodicMeterReadsRequest for meter: {}.", request.getDeviceIdentification()); return (PeriodicMeterReadsAsyncResponse) this.getPeriodicAsyncResponseForEandG(organisationIdentification, request); }
Source:
<code>private static Predicate<ChangeData> equalsLabelPredicate(Args args, String label, int expVal) { if (args.accounts != null && !args.accounts.isEmpty()) { List<Predicate<ChangeData>> r = Lists.newArrayList(); for (Account.Id a : args.accounts) { r.add(new EqualsLabelPredicate(args, label, expVal, a)); } return or(r); } else if (args.group != null) { List<Predicate<ChangeData>> r = Lists.newArrayList(); r.add(new EqualsLabelPredicate(args, label, expVal, null)); <START> return or(r); <END> } else { return new EqualsLabelPredicate(args, label, expVal, null); } }</code><technical_language>or() a one-predicate list is logically equivalent predicate. missing something, this is equivalent else case below, calls new EqualsLabelPredicate arguments. this fix problem of ignoring group? args.group is referenced of EqualsLabelPredicate#match. I need expand group here. If implementation of ChangeField.LABEL adds labels for user, for groups. want change behavior, want trigger reindexing time group membership changes</technical_language>

Target:
private static Predicate<ChangeData> equalsLabelPredicate(Args args, String label, int expVal) { if (args.accounts == null || args.accounts.isEmpty()) { return new EqualsLabelPredicate(args, label, expVal, null); } else { List<Predicate<ChangeData>> r = Lists.newArrayList(); for (Account.Id a : args.accounts) { r.add(new EqualsLabelPredicate(args, label, expVal, a)); } return or(r); } }
Source:
<code>ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) { this.config = config; this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.processorId = createProcessorId(config); this.zkUtils = zkUtils; zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener()); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade( zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); debounceTimer = new ScheduleAfterDebounceTime(); debounceTimer.setScheduledTaskCallback(throwable -> { LOG.error("Received exception from in JobCoordinator Processing!", throwable); stop(); }); Map<String, SystemAdmin> systemAdminMap = new JavaSystemConfig(config).getSystemAdmins(); <START> systemAdmins = new SystemAdmins(Util.javaMapAsScalaMap(systemAdminMap)); <END> streamMetadataCache = new StreamMetadataCache(Util.javaMapAsScalaMap(systemAdminMap), METADATA_CACHE_TTL_MS, SystemClock.instance()); }</code><technical_language>If usages of this Map constructor parameter in Java, cleaner a java.util.Map instead</technical_language>

Target:
ZkJobCoordinator(Config config, MetricsRegistry metricsRegistry, ZkUtils zkUtils) { this.config = config; this.metrics = new ZkJobCoordinatorMetrics(metricsRegistry); this.processorId = createProcessorId(config); this.zkUtils = zkUtils; zkUtils.getZkClient().subscribeStateChanges(new ZkSessionStateChangedListener()); LeaderElector leaderElector = new ZkLeaderElector(processorId, zkUtils); leaderElector.setLeaderElectorListener(new LeaderElectorListenerImpl()); this.zkController = new ZkControllerImpl(processorId, zkUtils, this, leaderElector); this.barrier = new ZkBarrierForVersionUpgrade( zkUtils.getKeyBuilder().getJobModelVersionBarrierPrefix(), zkUtils, new ZkBarrierListenerImpl()); this.debounceTimeMs = new JobConfig(config).getDebounceTimeMs(); this.reporters = MetricsReporterLoader.getMetricsReporters(new MetricsConfig(config), processorId); debounceTimer = new ScheduleAfterDebounceTime(); debounceTimer.setScheduledTaskCallback(throwable -> { LOG.error("Received exception from in JobCoordinator Processing!", throwable); stop(); }); systemAdmins = new SystemAdmins(config); streamMetadataCache = new StreamMetadataCache(systemAdmins, METADATA_CACHE_TTL_MS, SystemClock.instance()); }