auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public List<InputSplit> getSplits(JobContext job) throws IOException { initInputFormat(HadoopCompat.getConfiguration(job)); List<InputSplit> inputSplits; try { inputSplits = delegate.getSplits(job); } catch (InterruptedException e) { LOG.error("Thread interrupted", e); Thread.currentThread().interrupt(); throw new IOException(e); } List<InputSplit> combinedInputSplits = new ArrayList<InputSplit>(); Configuration conf = HadoopCompat.getConfiguration(job); try { for (CompositeInputSplit split : SplitUtil.getCombinedCompositeSplits(inputSplits, conf)) { split.setConf(conf); combinedInputSplits.add(split); } } catch (InterruptedException e) { LOG.error("Thread interrupted", e); Thread.currentThread().interrupt(); throw new IOException(e); } return combinedInputSplits; }

Target:
public List<InputSplit> getSplits(JobContext job) throws IOException { Configuration conf = HadoopCompat.getConfiguration(job); initInputFormat(conf); try { if (shouldCombine(conf)) { List<InputSplit> inputSplits = delegate.getSplits(job); List<InputSplit> combinedInputSplits = new ArrayList<InputSplit>(); for (CompositeInputSplit split : SplitUtil.getCombinedCompositeSplits(inputSplits, conf)) { split.setConf(conf); combinedInputSplits.add(split); } return combinedInputSplits; } else { return delegate.getSplits(job); } } catch (InterruptedException e) { LOG.error("Thread interrupted", e); Thread.currentThread().interrupt(); throw new IOException(e); } }
Source:
public boolean hasNext() { if (baseRecord == null) { return false; } final long nextTimestamp = timestampSampler.nextTimestamp(lastTimestamp); if (this.nextTimestamp > nextTimestamp) { this.lastTimestamp = nextTimestamp; return true; } this.lastTimestamp = timestampSampler.round(baseRecord.getTimestamp(timestampIndex)); final int n = groupByFunctions.size(); for (int i = 0; i < n; i++) { interruptor.checkInterrupted(); groupByFunctions.getQuick(i).computeFirst(simpleMapValue, baseRecord); } while (base.hasNext()) { long timestamp = timestampSampler.round(baseRecord.getTimestamp(timestampIndex)); if (lastTimestamp == timestamp) { for (int i = 0; i < n; i++) { interruptor.checkInterrupted(); groupByFunctions.getQuick(i).computeNext(simpleMapValue, baseRecord); } } else { this.nextTimestamp = timestamp; return true; } } baseRecord = null; return true; }

Target:
public boolean hasNext() { if (baseRecord == null) { return false; } final long nextTimestamp = timestampSampler.nextTimestamp(lastTimestamp); if (this.nextTimestamp > nextTimestamp) { this.lastTimestamp = nextTimestamp; return true; } this.lastTimestamp = timestampSampler.round(baseRecord.getTimestamp(timestampIndex)); final int n = groupByFunctions.size(); for (int i = 0; i < n; i++) { groupByFunctions.getQuick(i).computeFirst(simpleMapValue, baseRecord); } while (base.hasNext()) { interruptor.checkInterrupted(); long timestamp = timestampSampler.round(baseRecord.getTimestamp(timestampIndex)); if (lastTimestamp == timestamp) { for (int i = 0; i < n; i++) { groupByFunctions.getQuick(i).computeNext(simpleMapValue, baseRecord); } } else { this.nextTimestamp = timestamp; return true; } } baseRecord = null; return true; }
Source:
public void cleanupState() { for (int i = 1; i <= cluster.size(); i++) cluster.get(i).runOnInstance(InstanceKiller::clear); }

Target:
public void cleanupState() { for (int i = 1; i <= CLUSTER.size(); i++) CLUSTER.get(i).runOnInstance(InstanceKiller::clear); }
Source:
protected void setStyles() { errorMessagePanel.setVisible(false); informationMessagePanel.setVisible(false); passwordEditor.setAutoComplete("off"); userNameEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); userNameEditor.addLabelStyleName(PatternflyConstants.COL_MD_2); userNameEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); userNameEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); userNameEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_MD_10); passwordEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); passwordEditor.addLabelStyleName(PatternflyConstants.COL_MD_2); passwordEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); passwordEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); passwordEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_MD_10); profileEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); profileEditor.addLabelStyleName(PatternflyConstants.COL_MD_2); profileEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); profileEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); profileEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_MD_10); }

Target:
protected void setStyles() { errorMessagePanel.setVisible(false); informationMessagePanel.setVisible(false); passwordEditor.setAutoComplete("off"); userNameEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); userNameEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); userNameEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); passwordEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); passwordEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); passwordEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); profileEditor.addLabelStyleName(PatternflyConstants.COL_SM_2); profileEditor.addLabelStyleName(PatternflyConstants.CONTROL_LABEL); userNameEditor.addLabelStyleName("white"); profileEditor.addContentWidgetContainerStyleName(PatternflyConstants.COL_SM_10); }
Source:
public void executeMojo() throws MojoExecutionException { try { final ExecFileLoader loader = new ExecFileLoader(); final Socket socket = tryConnect(); final RemoteControlWriter remoteWriter = new RemoteControlWriter( socket.getOutputStream()); final RemoteControlReader remoteReader = new RemoteControlReader( socket.getInputStream()); remoteReader.setSessionInfoVisitor(loader.getSessionInfoStore()); remoteReader .setExecutionDataVisitor(loader.getExecutionDataStore()); remoteWriter.visitDumpCommand(dump, reset); remoteReader.read(); if (dump) { getLog().info( format("Dumping execution data to %s", destFile.getAbsolutePath())); loader.save(destFile, append); } socket.close(); } catch (final IOException e) { throw new MojoExecutionException("Unable to dump coverage data", e); } }

Target:
public void executeMojo() throws MojoExecutionException { try { final ExecFileLoader loader = new ExecFileLoader(); Socket socket = null; try { socket = tryConnect(); final RemoteControlWriter remoteWriter = new RemoteControlWriter( socket.getOutputStream()); final RemoteControlReader remoteReader = new RemoteControlReader( socket.getInputStream()); remoteReader .setSessionInfoVisitor(loader.getSessionInfoStore()); remoteReader.setExecutionDataVisitor(loader .getExecutionDataStore()); remoteWriter.visitDumpCommand(dump, reset); remoteReader.read(); } finally { if (socket != null) { socket.close(); } } if (dump) { getLog().info( format("Dumping execution data to %s", destFile.getAbsolutePath())); loader.save(destFile, append); } } catch (final IOException e) { throw new MojoExecutionException("Unable to dump coverage data", e); } }
Source:
public void setup() { super.setup(); when(client.createMediaPipeline(any(Transaction.class))).thenReturn(mock(MediaPipeline.class)); User u = new User(); u.setId(USER_ID); u.setFirstname("firstname"); u.setLastname("lastname"); when(userDao.get(USER_ID)).thenReturn(u); doReturn(true).when(handler).isConnected(); when(recDao.update(any(Recording.class))).thenAnswer(new Answer<Recording>() { @Override public Recording answer(InvocationOnMock invocation) throws Throwable { Object[] args = invocation.getArguments(); Recording r = (Recording) args[0]; r.setId(1L); return r; } }); PowerMockito.mockStatic(LabelDao.class); BDDMockito.given(LabelDao.getLanguage(any(Long.class))).willReturn(new OmLanguage(Locale.ENGLISH)); c = getClientFull(); when(roomDao.get(ROOM_ID)).thenReturn(c.getRoom()); doReturn(null).when(streamProcessor).startBroadcast(any(), any(), any()); }

Target:
public void setup() { super.setup(); when(client.createMediaPipeline(any(Transaction.class))).thenReturn(mock(MediaPipeline.class)); User u = new User(); u.setId(USER_ID); u.setFirstname("firstname"); u.setLastname("lastname"); when(userDao.get(USER_ID)).thenReturn(u); doReturn(true).when(handler).isConnected(); when(recDao.update(any(Recording.class))).thenAnswer((invocation) -> { Object[] args = invocation.getArguments(); Recording r = (Recording) args[0]; r.setId(1L); return r; }); PowerMockito.mockStatic(LabelDao.class); BDDMockito.given(LabelDao.getLanguage(any(Long.class))).willReturn(new OmLanguage(Locale.ENGLISH)); c = getClientFull(); when(roomDao.get(ROOM_ID)).thenReturn(c.getRoom()); doReturn(null).when(streamProcessor).startBroadcast(any(), any(), any()); }
Source:
int read(byte b[], int off, int length, int timeout) throws IOException { int n; if (eof) { return -1; } if (impl.isConnectionReset()) { throw new SocketException("Connection reset"); } if (length <= 0 || off < 0 || off + length > b.length) { if (length == 0) { return 0; } throw new ArrayIndexOutOfBoundsException(); } boolean gotReset = false; FileDescriptor fd = impl.acquireFD(); try { BlockGuard.getThreadPolicy().onNetwork(); n = socketRead0(fd, b, off, length, timeout); if (n > 0) { return n; } } catch (ConnectionResetException rstExc) { gotReset = true; } if (gotReset) { impl.setConnectionResetPending(); try { n = socketRead(fd, b, off, length, timeout); if (n > 0) { return n; } } catch (ConnectionResetException rstExc) { } } if (impl.isClosedOrPending()) { throw new SocketException("Socket closed"); } if (impl.isConnectionResetPending()) { impl.setConnectionReset(); } if (impl.isConnectionReset()) { throw new SocketException("Connection reset"); } eof = true; return -1; }

Target:
int read(byte b[], int off, int length, int timeout) throws IOException { int n; if (eof) { return -1; } if (impl.isConnectionReset()) { throw new SocketException("Connection reset"); } if (length <= 0 || off < 0 || off + length > b.length) { if (length == 0) { return 0; } throw new ArrayIndexOutOfBoundsException(); } boolean gotReset = false; FileDescriptor fd = impl.acquireFD(); try { BlockGuard.getThreadPolicy().onNetwork(); n = socketRead(fd, b, off, length, timeout); if (n > 0) { return n; } } catch (ConnectionResetException rstExc) { gotReset = true; } if (gotReset) { impl.setConnectionResetPending(); try { n = socketRead(fd, b, off, length, timeout); if (n > 0) { return n; } } catch (ConnectionResetException rstExc) { } } if (impl.isClosedOrPending()) { throw new SocketException("Socket closed"); } if (impl.isConnectionResetPending()) { impl.setConnectionReset(); } if (impl.isConnectionReset()) { throw new SocketException("Connection reset"); } eof = true; return -1; }
Source:
protected HashMap<Guid, DiskImage> getDiskToDestinationMap(VM vm, Guid storageDomainId, boolean isDomainSet) { HashMap<Guid, DiskImage> diskToDestinationMap = null; if (vm.isSetDisks() && vm.getDisks().isSetDisks()) { diskToDestinationMap = new HashMap<Guid, DiskImage>(); for (Disk disk : vm.getDisks().getDisks()) { if (disk.isSetId()) { org.ovirt.engine.core.common.businessentities.Disk sourceDisk = queryDisk(disk); if (sourceDisk.isDiskImage()) { DiskImage destinationDisk = (DiskImage) DiskMapper.map(disk, sourceDisk); if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() && disk.getStorageDomains().getStorageDomains().get(0).isSetId()) { destinationDisk.setStorageIds(new ArrayList<Guid>()); Guid newStorageDomainId = isDomainSet ? storageDomainId : asGuid(disk.getStorageDomains(). getStorageDomains().get(0).getId()); destinationDisk.getStorageIds().add(newStorageDomainId); } diskToDestinationMap.put(destinationDisk.getId(), destinationDisk); } } } } return diskToDestinationMap; }

Target:
protected HashMap<Guid, DiskImage> getDiskToDestinationMap(VM vm, Guid storageDomainId, boolean isDomainSet) { HashMap<Guid, DiskImage> diskToDestinationMap = null; if (vm.isSetDisks() && vm.getDisks().isSetDisks()) { diskToDestinationMap = new HashMap<Guid, DiskImage>(); Map<Guid, org.ovirt.engine.core.common.businessentities.Disk> vmSourceDisks = queryVMDiskList(vm); for (Disk disk : vm.getDisks().getDisks()) { Guid currDiskID = asGuid(disk.getId()); if (disk.isSetId() && vmSourceDisks.containsKey(currDiskID)) { org.ovirt.engine.core.common.businessentities.Disk sourceDisk = vmSourceDisks.get(currDiskID); if (sourceDisk.isDiskImage()) { DiskImage destinationDisk = (DiskImage) DiskMapper.map(disk, sourceDisk); if (disk.isSetStorageDomains() && disk.getStorageDomains().isSetStorageDomains() ) { List<org.ovirt.engine.api.model.StorageDomain> diskStorageDomains = disk.getStorageDomains().getStorageDomains(); if (!diskStorageDomains.isEmpty() && diskStorageDomains.get(0).isSetId()) { destinationDisk.setStorageIds(new ArrayList<Guid>(1)); Guid newStorageDomainId = isDomainSet ? storageDomainId : asGuid(diskStorageDomains.get(0).getId()); destinationDisk.getStorageIds().add(newStorageDomainId); } diskToDestinationMap.put(destinationDisk.getId(), destinationDisk); } } } } } return diskToDestinationMap; }
Source:
public String toString() { StringBuilder str = new StringBuilder(55); str.append("(id=") .append(getId()); str.append(", displayName=") .append(getDisplayName()); str.append(", dbTableName=") .append(getDbTableName()); str.append(", supported=") .append(isSupported().toString()); str.append(", enabled=") .append(isEnabled().toString()); str.append(")"); return str.toString(); }

Target:
public String toString() { StringBuilder str = new StringBuilder(55); str.append("(id=") .append(getId()) .append(", displayName=") .append(getDisplayName()) .append(", dbTableName=") .append(getDbTableName()) .append(", supported=") .append(isSupported().toString()) .append(", enabled=") .append(isEnabled().toString()) .append(')'); return str.toString(); }
Source:
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__BEGIN_LABEL_STYLE, DiagramFactory.eINSTANCE.createBeginLabelStyle())); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__CENTER_LABEL_STYLE, DiagramFactory.eINSTANCE.createCenterLabelStyle())); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__END_LABEL_STYLE, DiagramFactory.eINSTANCE.createEndLabelStyle())); newChildDescriptors .add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__STROKE_COLOR, ViewpointFactory.eINSTANCE.createFromString(ViewpointPackage.Literals.RGB_VALUES, "209,209,209"))); }

Target:
protected void collectNewChildDescriptors(Collection<Object> newChildDescriptors, Object object) { super.collectNewChildDescriptors(newChildDescriptors, object); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__BEGIN_LABEL_STYLE, DiagramFactory.eINSTANCE.createBeginLabelStyle())); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__CENTER_LABEL_STYLE, DiagramFactory.eINSTANCE.createCenterLabelStyle())); newChildDescriptors.add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__END_LABEL_STYLE, DiagramFactory.eINSTANCE.createEndLabelStyle())); newChildDescriptors .add(createChildParameter(DiagramPackage.Literals.EDGE_STYLE__STROKE_COLOR, ViewpointFactory.eINSTANCE.createFromString(ViewpointPackage.Literals.RGB_VALUES, "136,136,136"))); }
Source:
public void testSaveChanges() { onView(withId(R.id.brick_set_variable_edit_text)).perform(click()); onView(withId(R.id.formula_editor_keyboard_0)).perform(click()); pressBack(); onView(withText(R.string.formula_editor_discard_changes_dialog_title)).check(matches(isDisplayed())); onView(withId(android.R.id.button1)).perform(click()); onBrickAtPosition(1).checkShowsText(R.string.brick_set_variable); onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)).perform(click()); onView(withId(R.id.formula_editor_edit_field)).check(matches(withText("0 "))); }

Target:
public void testSaveChanges() { onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .performEnterNumber(0); pressBack(); onView(withText(R.string.formula_editor_discard_changes_dialog_title)) .check(matches(isDisplayed())); onView(withId(android.R.id.button1)) .perform(click()); onBrickAtPosition(1).onChildView(withId(R.id.brick_set_variable_edit_text)) .perform(click()); onFormulaEditor() .checkValue("0"); }
Source:
public Integer convert(String s) { try{ return Integer.parseInt(s); }catch(NumberFormatException e){ GWT.log("Impossible to convert the string'"+s+"' to an integer."); return null; } }

Target:
public Integer convert(String s) { try{ return Integer.parseInt(s); }catch(NumberFormatException e){ return null; } }
Source:
public void testWriteBehindWithoutCacheLoaderWriter() { WriteBehindConfiguration writeBehindConfiguration = WriteBehindConfigurationBuilder.newWriteBehindConfiguration().build(); WriteBehindDecoratorLoaderWriterProviderFactory factory = new WriteBehindDecoratorLoaderWriterProviderFactory(); factory.create(mock(ServiceConfiguration.class), null).createWriteBehindDecoratorLoaderWriter(null, writeBehindConfiguration); }

Target:
public void testWriteBehindWithoutCacheLoaderWriter() { expectedEx.expect(NullPointerException.class); expectedEx.expectMessage("WriteBehind requires non null CacheLoaderWriter"); WriteBehindDecoratorLoaderWriterProviderFactory factory = new WriteBehindDecoratorLoaderWriterProviderFactory(); factory.create(null, null).createWriteBehindDecoratorLoaderWriter(null, null); }
Source:
public static KubernetesToleration fromMap(Map<String, String> stringMap) { final TolerationBuilder tolerationBuilder = new TolerationBuilder(); stringMap.forEach((k, v) -> { switch (k) { case "effect": tolerationBuilder.withEffect(v); break; case "key": tolerationBuilder.withKey(v); break; case "operator": tolerationBuilder.withOperator(v); break; case "tolerationSeconds": tolerationBuilder.withTolerationSeconds(Long.valueOf(v)); break; case "value": tolerationBuilder.withValue(v); break; default: LOG.warn("Unrecognized key({}) of toleration, will ignore.", k); break; } }); return new KubernetesToleration(tolerationBuilder.build()); }

Target:
public static KubernetesToleration fromMap(Map<String, String> stringMap) { final TolerationBuilder tolerationBuilder = new TolerationBuilder(); stringMap.forEach((k, v) -> { switch (k.toLowerCase()) { case "effect": tolerationBuilder.withEffect(v); break; case "key": tolerationBuilder.withKey(v); break; case "operator": tolerationBuilder.withOperator(v); break; case "tolerationseconds": tolerationBuilder.withTolerationSeconds(Long.valueOf(v)); break; case "value": tolerationBuilder.withValue(v); break; default: LOG.warn("Unrecognized key({}) of toleration, will ignore.", k); break; } }); return new KubernetesToleration(tolerationBuilder.build()); }
Source:
public void run() { try { Injector injector = makeInjector(); try { final Lifecycle lifecycle = initLifecycle(injector); Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() { @Override public void run() { log.info("Running shutdown hook"); lifecycle.stop(); } } ) ); injector.getInstance(ExecutorLifecycle.class).join(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } log.info("Finished peon task"); } catch (Exception e) { throw Throwables.propagate(e); } }

Target:
public void run() { try { Injector injector = makeInjector(); try { final Lifecycle lifecycle = initLifecycle(injector); Runtime.getRuntime().addShutdownHook( new Thread( new Runnable() { @Override public void run() { log.info("Running shutdown hook"); lifecycle.stop(); } } ) ); injector.getInstance(ExecutorLifecycle.class).join(); lifecycle.stop(); } catch (Throwable t) { log.error(t, "Error when starting up. Failing."); System.exit(1); } log.info("Finished peon task"); } catch (Exception e) { throw Throwables.propagate(e); } }
Source:
public String toString() { return "PlanImpl{" + "evaluatorsToAdd=" + evaluatorsToAdd + ", evaluatorsToDelete=" + evaluatorsToDelete + ", transferSteps=" + transferSteps + '}'; }

Target:
public String toString() { final StringBuilder sb = new StringBuilder("PlanImpl{"); sb.append("evaluatorsToAdd=").append(evaluatorsToAdd); sb.append(", evaluatorsToDelete=").append(evaluatorsToDelete); sb.append(", transferSteps=").append(transferSteps); sb.append('}'); return sb.toString(); }
Source:
public void update(StyleRange[] ranges) { updateStyles = true; int oldMaxRise = maxRise; int oldMaxFontHeight = maxFontHeight; int oldMaxMetricsWidth = maxMetricsWidth; maxRise = 0; maxMetricsWidth = 0; maxFontHeight = defaultFontHeight; if (ranges != null) { for (int i = 0; i < ranges.length; i++) { StyleRange style = ranges[i]; if (style.isVariableHeight()) { if (style.font != null) { Integer height = getMaxFontHeight(style.font); if (height != null && height > maxFontHeight) { maxFontHeight = height; } } if (style.metrics != null) { int width = style.metrics.width; if (width > maxMetricsWidth) { maxMetricsWidth = width; } } if (style.rise > maxRise) { maxRise = style.rise; } } } } if (oldMaxRise != maxRise || (oldMaxFontHeight != maxFontHeight)) { height = -1; } if (oldMaxMetricsWidth != maxMetricsWidth) { width = -1; } }

Target:
public void update(StyleRange[] ranges) { updateStyles = true; int oldMaxRise = maxRise; int oldMaxFontHeight = maxFontHeight; int oldMaxMetricsWidth = maxMetricsWidth; int oldMaxMetricsHeight = maxMetricsHeight; List<Font> oldFonts = fonts; maxRise = 0; maxMetricsWidth = 0; maxMetricsHeight = 0; maxFontHeight = defaultFontHeight; if (fonts != null) { fonts.clear(); } if (ranges != null) { for (int i = 0; i < ranges.length; i++) { StyleRange style = ranges[i]; if (style.isVariableHeight()) { if (style.font != null) { Integer height = getMaxFontHeight(style.font); if (height != null && height > maxFontHeight) { maxFontHeight = height; } if (fonts == null) { fonts = new ArrayList<>(); } fonts.add(style.font); } if (style.metrics != null) { int width = style.metrics.width; if (width > maxMetricsWidth) { maxMetricsWidth = width; } int height = style.metrics.ascent + style.metrics.descent; if (height > maxMetricsHeight) { maxMetricsHeight = height; } } if (style.rise > maxRise) { maxRise = style.rise; } } } } if (oldMaxRise != maxRise || oldMaxFontHeight != maxFontHeight || oldMaxMetricsHeight != maxMetricsHeight) { height = -1; } if (oldMaxMetricsWidth != maxMetricsWidth || !isSameFonts(fonts, oldFonts)) { width = -1; } }
Source:
public JGroupsAddress doReadObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException { try { org.jgroups.Address address = org.jgroups.util.Util.readAddress(unmarshaller); return (JGroupsAddress) JGroupsAddressCache.fromJGroupsAddressUnchecked(address); } catch (Exception e) { throw new IOException(e); } }

Target:
public JGroupsAddress doReadObject(ObjectInput unmarshaller) throws IOException, ClassNotFoundException { try { org.jgroups.Address address = org.jgroups.util.Util.readAddress(unmarshaller); return (JGroupsAddress) JGroupsAddressCache.fromJGroupsAddress(address); } catch (Exception e) { throw new IOException(e); } }
Source:
public ParseFile(File file) { this(null, file, null); }

Target:
public ParseFile(File file) { this(file, null); }
Source:
@Test void testSortProject() { final String sql = "select mgr from sales.emp order by mgr desc nulls last"; Query.create(sql) .removeRules(SORT_PROJECT_TRANSPOSE_RULES) .removeRule(EnumerableRules.ENUMERABLE_SORT_RULE) .check(); }

Target:
@Test void testSortProject() { final String sql = "select mgr from sales.emp order by mgr desc nulls last"; Query.create(sql) .removeRule(EnumerableRules.ENUMERABLE_SORT_RULE) .check(); }
Source:
protected void executeQueryCommand() { Provider<?> provider = getProvider(); try { ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); if (!chain.isEmpty()) { List<CertificateInfo> results = new ArrayList<CertificateInfo>(); for (Certificate cert : chain) { results.add(createCertificateInfo((X509Certificate) cert)); } getQueryReturnValue().setReturnValue(results); } } catch (Exception e) { log.error("Error in encoding certificate. Error is " + e.getMessage()); log.debug("Exeption:", e); } }

Target:
protected void executeQueryCommand() { Provider<?> provider = getProvider(); try { ProviderProxy proxy = ProviderProxyFactory.getInstance().create(provider); List<? extends Certificate> chain = proxy.getCertificateChain(); if (!chain.isEmpty()) { List<CertificateInfo> results = new ArrayList<CertificateInfo>(); for (Certificate cert : chain) { if (cert instanceof X509Certificate) { results.add(createCertificateInfo((X509Certificate) cert)); } } getQueryReturnValue().setReturnValue(results); } } catch (Exception e) { log.error("Error in encoding certificate. Error is " + e.getMessage()); log.debug("Exeption:", e); } }
Source:
public void slicesOfTwo() { Series series = new Series("35"); List<List<String>> expected = Arrays.asList(Arrays.asList("3", "5")); List<List<String>> actual = series.slices(2); assertNotNull(actual); assertFalse(actual.isEmpty()); assertEquals(expected, actual); }

Target:
public void slicesOfTwo() { Series series = new Series("35"); List<List<String>> expected = Arrays.asList(Arrays.asList("3", "5")); List<List<String>> actual = series.slices(2); assertEquals(expected, actual); }
Source:
public ArtifactToken createArtifact(BranchId branch, IArtifactType artifactType, ArtifactId parent, String name) { TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "rest - create artifacts"); ArtifactToken token = tx.createArtifact(parent, artifactType, name); tx.commit(); return token; }

Target:
public ArtifactToken createArtifact(BranchId branch, IArtifactType artifactType, ArtifactId parent, String name) { TransactionBuilder tx = orcsApi.getTransactionFactory().createTransaction(branch, account, "rest - create artifact"); ArtifactToken token = tx.createArtifact(parent, artifactType, name); tx.commit(); return token; }
Source:
public void process(ClusterEvent event) throws Exception { _eventId = event.getEventId(); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); if (cache == null) { throw new StageException("Missing attributes in event:" + event + ". Requires DataCache"); } Map<String, Resource> resourceMap = new LinkedHashMap<>(); Map<String, Resource> resourceToRebalance = new LinkedHashMap<>(); Map<String, IdealState> idealStates = cache.getIdealStates(); boolean isTaskCache = cache instanceof WorkflowControllerDataProvider; processIdealStates(cache, resourceMap, resourceToRebalance, idealStates, isTaskCache); if (isTaskCache) { WorkflowControllerDataProvider taskDataCache = event.getAttribute(AttributeName.ControllerDataProvider.name()); processWorkflowConfigs(taskDataCache, resourceMap, resourceToRebalance); processJobConfigs(taskDataCache, resourceMap, resourceToRebalance, idealStates); } Map<String, LiveInstance> availableInstances = cache.getLiveInstances(); for (LiveInstance instance : availableInstances.values()) { String instanceName = instance.getInstanceName(); String clientSessionId = instance.getEphemeralOwner(); Map<String, CurrentState> currentStateMap = cache.getCurrentState(instanceName, clientSessionId); processCurrentStates(currentStateMap, resourceMap, resourceToRebalance, idealStates, isTaskCache); if (isTaskCache) { Map<String, CurrentState> taskCurrentStateMap = ((WorkflowControllerDataProvider) cache) .getTaskCurrentState(instanceName, clientSessionId); processCurrentStates(taskCurrentStateMap, resourceMap, resourceToRebalance, idealStates, true); } } event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceToRebalance); }

Target:
public void process(ClusterEvent event) throws Exception { _eventId = event.getEventId(); BaseControllerDataProvider cache = event.getAttribute(AttributeName.ControllerDataProvider.name()); if (cache == null) { throw new StageException("Missing attributes in event:" + event + ". Requires DataCache"); } Map<String, Resource> resourceMap = new LinkedHashMap<>(); Map<String, Resource> resourceToRebalance = new LinkedHashMap<>(); Map<String, IdealState> idealStates = cache.getIdealStates(); boolean isTaskCache = cache instanceof WorkflowControllerDataProvider; processIdealStates(cache, resourceMap, resourceToRebalance, idealStates, isTaskCache); if (isTaskCache) { WorkflowControllerDataProvider taskDataCache = event.getAttribute(AttributeName.ControllerDataProvider.name()); processWorkflowConfigs(taskDataCache, resourceMap, resourceToRebalance); processJobConfigs(taskDataCache, resourceMap, resourceToRebalance, idealStates); } processCurrentStates(cache, resourceMap, resourceToRebalance, idealStates, isTaskCache); event.addAttribute(AttributeName.RESOURCES.name(), resourceMap); event.addAttribute(AttributeName.RESOURCES_TO_REBALANCE.name(), resourceToRebalance); }
Source:
public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (TracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = TracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); if (spanContext == null) { spanContext = span.context(); } try (Scope scope = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }

Target:
public void accept(Event<? extends Payload> event) { String key = (String) event.getKey(); Payload payload = event.getData(); String flowId = getFlowId(event); String flowChainId = getFlowChainId(event); String flowTriggerUserCrn = getFlowTriggerUserCrn(event); Span activeSpan = tracer.activeSpan(); SpanContext spanContext = event.getHeaders().get(FlowConstants.SPAN_CONTEXT); String operationName = event.getKey().toString(); if (TracingUtil.isActiveSpanReusable(activeSpan, spanContext, operationName)) { LOGGER.debug("Reusing existing span. {}", activeSpan.context()); doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } else { Span span = TracingUtil.getSpan(tracer, operationName, spanContext, flowId, flowChainId, flowTriggerUserCrn); spanContext = TracingUtil.useOrCreateSpanContext(spanContext, span); try (Scope ignored = tracer.activateSpan(span)) { doAccept(event, key, payload, flowId, flowChainId, flowTriggerUserCrn, spanContext); } finally { span.finish(); } } }
Source:
private boolean glusterHostRemove(Guid sourceClusterId) { String hostName = (getVds().getHostName().isEmpty()) ? getVds().getManagementIp() : getVds().getHostName(); VDS runningHostInSourceCluster = getClusterUtils().getUpServer(sourceClusterId); if (runningHostInSourceCluster == null) { log.error("Cannot remove host from source cluster, no host in Up status found in source cluster"); handleError(-1, "No host in Up status found in source cluster"); errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; return false; } Guid serverId = runningHostInSourceCluster.getId(); GlusterServer glusterServer = getDbFacade().getGlusterServerDao().getByServerId(serverId); Guid glusterHostId = (glusterServer != null) ? glusterServer.getGlusterServerUuid() : null; if (glusterHostId == null) { handleError(-1, "Failed to get gluser UUID for the host:" + hostName); errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; return false; } VDSReturnValue returnValue = runVdsCommand( VDSCommandType.RemoveGlusterServer, new RemoveGlusterServerVDSParameters(serverId, hostName, false, glusterHostId)); if (!returnValue.getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; return false; } return true; }

Target:
private boolean glusterHostRemove(Guid sourceClusterId) { String hostName = (getVds().getHostName().isEmpty()) ? getVds().getManagementIp() : getVds().getHostName(); VDS runningHostInSourceCluster = getClusterUtils().getUpServer(sourceClusterId); if (runningHostInSourceCluster == null) { log.error("Cannot remove host from source cluster, no host in Up status found in source cluster"); handleError(-1, "No host in Up status found in source cluster"); errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; return false; } GlusterServer glusterServer = getDbFacade().getGlusterServerDao().getByServerId(getVds().getId()); Guid glusterHostId = (glusterServer != null) ? glusterServer.getGlusterServerUuid() : null; if (glusterHostId == null) { log.warnFormat("Could not find gluster host uuid for the node {0}", hostName); } VDSReturnValue returnValue = runVdsCommand( VDSCommandType.RemoveGlusterServer, new RemoveGlusterServerVDSParameters(runningHostInSourceCluster.getId(), hostName, false, glusterHostId)); if (!returnValue.getSucceeded()) { handleVdsError(returnValue); errorType = AuditLogType.GLUSTER_SERVER_REMOVE_FAILED; return false; } return true; }
Source:
private void startSyncOperation(OCFile availableOfflineFile, String accountName) { Log_OC.i( TAG, String.format( "Requested synchronization for file %1s", availableOfflineFile.getFileName() ) ); Account mAccount = AccountUtils.getOwnCloudAccountByName(mAvailableOfflineJobService, accountName); FileDataStorageManager storageManager = new FileDataStorageManager( mAvailableOfflineJobService, mAccount, mAvailableOfflineJobService.getContentResolver() ); SynchronizeFileOperation synchronizeFileOperation = new SynchronizeFileOperation(availableOfflineFile, null, mAccount, false, mAvailableOfflineJobService); RemoteOperationResult result = synchronizeFileOperation. execute(storageManager, mAvailableOfflineJobService); if (result.getCode() == RemoteOperationResult.ResultCode.SYNC_CONFLICT) { Intent i = new Intent(mAvailableOfflineJobService, ConflictsResolveActivity.class); i.setFlags(i.getFlags() | Intent.FLAG_ACTIVITY_NEW_TASK); i.putExtra(ConflictsResolveActivity.EXTRA_FILE, availableOfflineFile); i.putExtra(ConflictsResolveActivity.EXTRA_ACCOUNT, mAccount); mAvailableOfflineJobService.startActivity(i); } }

Target:
private void startSyncOperation(OCFile availableOfflineFile, String accountName) { if (BuildConfig.DEBUG || MainApp.isBeta()) { Log_OC.i( TAG, String.format( "Requested synchronization for file %1s in account %2s", availableOfflineFile.getRemotePath(), accountName ) ); } Account account = AccountUtils.getOwnCloudAccountByName(mAvailableOfflineJobService, accountName); FileDataStorageManager storageManager = new FileDataStorageManager( mAvailableOfflineJobService, account, mAvailableOfflineJobService.getContentResolver() ); SynchronizeFileOperation synchronizeFileOperation = new SynchronizeFileOperation(availableOfflineFile, null, account, false, mAvailableOfflineJobService, true); RemoteOperationResult result = synchronizeFileOperation. execute(storageManager, mAvailableOfflineJobService); if (result.getCode() == RemoteOperationResult.ResultCode.SYNC_CONFLICT) { notifyConflict(availableOfflineFile, account); } }
Source:
public void stop() { for (Map.Entry<Task.Priority, ListeningExecutorService> entry : exec.entrySet()) { entry.getValue().shutdownNow(); } }

Target:
public void stop() { for (Map.Entry<Integer, ListeningExecutorService> entry : exec.entrySet()) { try { entry.getValue().shutdown(); } catch (SecurityException ex) { log.wtf(ex, "I can't control my own threads!"); } } for (ThreadPoolTaskRunnerWorkItem item : runningItems) { final Task task = item.getTask(); final long start = System.currentTimeMillis(); final boolean graceful; final long elapsed; boolean error = false; if (taskConfig.isRestoreTasksOnRestart() && task.canRestore()) { graceful = true; log.info("Starting graceful shutdown of task[%s].", task.getId()); try { task.stopGracefully(); final TaskStatus taskStatus = item.getResult().get( new Interval(new DateTime(start), taskConfig.getGracefulShutdownTimeout()).toDurationMillis(), TimeUnit.MILLISECONDS ); log.info( "Graceful shutdown of task[%s] finished in %,dms with status[%s].", task.getId(), System.currentTimeMillis() - start, taskStatus.getStatusCode() ); } catch (Exception e) { log.makeAlert(e, "Graceful task shutdown failed: %s", task.getDataSource()) .addData("taskId", task.getId()) .addData("dataSource", task.getDataSource()) .emit(); log.warn(e, "Graceful shutdown of task[%s] aborted with exception."); error = true; } } else { graceful = false; } elapsed = System.currentTimeMillis() - start; final ServiceMetricEvent.Builder metricBuilder = ServiceMetricEvent .builder() .setDimension("task", task.getId()) .setDimension("dataSource", task.getDataSource()) .setDimension("graceful", String.valueOf(graceful)) .setDimension("error", String.valueOf(error)); emitter.emit(metricBuilder.build("task/interrupt/count", 1L)); emitter.emit(metricBuilder.build("task/interrupt/elapsed", elapsed)); } for (Map.Entry<Integer, ListeningExecutorService> entry : exec.entrySet()) { try { entry.getValue().shutdownNow(); } catch (SecurityException ex) { log.wtf(ex, "I can't control my own threads!"); } } }
Source:
public String getAsText() throws OseeCoreException { IOseeBranch branch = TokenFactory.createBranch(branchUuid, ""); QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null); ArtifactReadable exactlyOne = factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).getResults().getExactlyOne(); AttributeReadable<Object> item = Iterables.find(exactlyOne.getAttributes(), new Predicate<AttributeReadable<Object>>() { @Override public boolean apply(AttributeReadable<Object> attribute) { return attribute.getId() == attrId; } }); return item.getValue().toString(); }

Target:
public String getAsText() throws OseeCoreException { IOseeBranch branch = TokenFactory.createBranch(branchUuid, ""); QueryFactory factory = OrcsApplication.getOrcsApi().getQueryFactory(null); ArtifactReadable exactlyOne = factory.fromBranch(branch).andGuidsOrHrids(artifactUuid).getResults().getExactlyOne(); Optional<AttributeReadable<Object>> item = Iterables.tryFind(exactlyOne.getAttributes(), new Predicate<AttributeReadable<Object>>() { @Override public boolean apply(AttributeReadable<Object> attribute) { return attribute.getId() == attrId; } }); String toReturn = ""; if (item.isPresent()) { Object value = item.get().getValue(); if (value != null) { toReturn = value.toString(); } } return toReturn; }
Source:
public void testUniqueHitPolicyRedundantAndSubsumptantRows() throws Exception, UpdateException { analyze("uniqueHitPolicyRedundantAndSubsumptantRows.gdst"); assertContains("SubsumptantRows", new HashSet<Integer>() {{ add(1); add(2); }}, Severity.ERROR, analyzerProvider.getAnalysisReport()); assertContains("SubsumptantRows", new HashSet<Integer>() {{ add(2); add(3); }}, Severity.ERROR, analyzerProvider.getAnalysisReport()); assertContains("RedundantRows", new HashSet<Integer>() {{ add(1); add(3); }}, Severity.ERROR, analyzerProvider.getAnalysisReport()); }

Target:
public void testUniqueHitPolicyRedundantAndSubsumptantRows() throws Exception, UpdateException { analyze("uniqueHitPolicyRedundantAndSubsumptantRows.gdst"); assertContains(analyzerProvider.getAnalysisReport(), SUBSUMPTANT_ROWS, Severity.ERROR, 1, 2); assertContains(analyzerProvider.getAnalysisReport(), SUBSUMPTANT_ROWS, Severity.ERROR, 2, 3); assertContains(analyzerProvider.getAnalysisReport(), REDUNDANT_ROWS, Severity.ERROR, 1, 3); }
Source:
public boolean isEnabled(Session session) { FeaturesConfig.JoinReorderingStrategy joinReorderingStrategy = getJoinReorderingStrategy(session); return joinReorderingStrategy == ELIMINATE_CROSS_JOINS || joinReorderingStrategy == COST_BASED; }

Target:
public boolean isEnabled(Session session) { JoinReorderingStrategy joinReorderingStrategy = getJoinReorderingStrategy(session); return joinReorderingStrategy == ELIMINATE_CROSS_JOINS || joinReorderingStrategy == COST_BASED; }
Source:
public void setTaskLimitExceeded(boolean exceeded) { this.taskLimitExceeded.set(exceeded); }

Target:
public void setTaskLimitExceeded(boolean exceeded) { taskLimitExceeded.set(exceeded); }
Source:
protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException { JobInstance jobInstance = stepExecution.getJobExecution().getJobInstance(); String stepName = stepExecution.getStepName(); StepExecution lastStepExecution = jobRepository.getLastStepExecution(jobInstance, stepName); boolean isRestart = (lastStepExecution != null && lastStepExecution.getStatus() != BatchStatus.COMPLETED); if (isRestart) { stepExecution.setExecutionContext(lastStepExecution.getExecutionContext()); } else { stepExecution.setExecutionContext(context); } return shouldStart(allowStartIfComplete, stepExecution, lastStepExecution) || isRestart; }

Target:
protected boolean isStartable(StepExecution stepExecution, ExecutionContext context) throws JobExecutionException { return getStartable(stepExecution, context); }
Source:
public void includeResource_shouldNotIncludeDuplicateResources() { Resource first = new Resource(Resource.CATEGORY_JS, "source", "z_first", 1); Resource second = new Resource(Resource.CATEGORY_JS, "mergepatientdata", "path", 2); Resource duplicateResource = new Resource(Resource.CATEGORY_JS, "mergepatientdata", "path", 3); PageContext pageContext = new PageContext(null); pageContext.includeResource(first); pageContext.includeResource(second); pageContext.includeResource(duplicateResource); List<Resource> jsResourcesToIncluude = pageContext.getResourcesToInclude(Resource.CATEGORY_JS); assertEquals(2, jsResourcesToIncluude.size()); assertEquals(3, (int) jsResourcesToIncluude.get(0).getPriority()); }

Target:
public void includeResource_shouldNotIncludeDuplicateResources() { Resource first = new Resource(Resource.CATEGORY_JS, "source", "z_first", 1); Resource second = new Resource(Resource.CATEGORY_JS, "mergepatientdata", "path", 2); Resource duplicateResource = new Resource(Resource.CATEGORY_JS, "mergepatientdata", "path", 3); PageContext pageContext = new PageContext(null); pageContext.includeResource(first); pageContext.includeResource(second); pageContext.includeResource(duplicateResource); List<Resource> jsResourcesToIncluude = pageContext.getResourcesToInclude(Resource.CATEGORY_JS); assertEquals(2, jsResourcesToIncluude.size()); assertEquals(3, (int) jsResourcesToIncluude.get(0).getPriority()); assertEquals(1, (int) jsResourcesToIncluude.get(1).getPriority()); }
Source:
protected void validateAuthenticationState(HttpClient httpClient) throws GerritLoginException { Optional<Cookie> cookie = findCookieWithName(LOGIN_COOKIE_NAME, httpClient); setXsrfCookie(nonNullOrThrow(cookie, () -> new GerritLoginException(), httpClient).get()); }

Target:
protected void validateAuthenticationState(HttpClient httpClient) throws GerritLoginException { Optional<Cookie> cookie = findCookieWithName(LOGIN_COOKIE_NAME, httpClient); if (cookie.isPresent()) { setXsrfCookie(cookie.get()); return; } if (CoreUtil.TEST_MODE) { System.err.println(" Authentication failed: " + httpClient.getState()); } throw new GerritLoginException(); }
Source:
private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator ) { ItemStack handle = api.definitions().blocks().crankHandle().maybeStack(1).orNull(); Slot[] grinderSlots = new ItemSlot[] { new ItemSlot( 3, 21, 16, 16 ).drawOwnBackground(), new ItemSlot( 41, 21, 16, 16, true ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), new ChanceSlot( 59, 12, 16, 16, true).setRatio( 10000 ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), new ChanceSlot( 59, 30, 16, 16, true).setRatio( 10000 ).setFormatString( " (%1$.2f%% chance)" ).drawOwnBackground().setSlotType( SlotType.OUTPUT_SLOT ), new ExtraSlot( 22, 12, 16, 16, handle ).clickable( true ).showName( true ).setSlotType( SlotType.MACHINE_SLOT ), new ExtraSlot( 22, 30, 16, 16, grindstone ).clickable( true ).showName( true ).setSlotType( SlotType.MACHINE_SLOT ) }; RecipeTemplate grinderTemplate = generator.createRecipeTemplate( grinderSlots, grindstone ); for( IGrinderEntry recipe : api.registries().grinder().getRecipes() ) { generator.addRecipe( grinderTemplate, new Object[] { recipe.getInput(), recipe.getOutput(), new Object[] { recipe.getOptionalOutput(), (int)(recipe.getOptionalChance() * 10000) }, new Object[] { recipe.getSecondOptionalOutput(), (int)(recipe.getOptionalChance() * 10000) }, handle, grindstone }); } }

Target:
private void addGrinderRecipes( IAppEngApi api, ItemStack grindstone, RecipeGenerator generator ) { ItemStack handle = api.definitions().blocks().crankHandle().maybeStack(1).orNull(); RecipeTemplate grinderTemplate = generator.createRecipeTemplate( grinderSlots, grindstone ); for( IGrinderEntry recipe : api.registries().grinder().getRecipes() ) { generator.addRecipe( grinderTemplate, new Object[] { recipe.getInput(), recipe.getOutput(), new Object[] { recipe.getOptionalOutput(), (int)(recipe.getOptionalChance() * 10000) }, new Object[] { recipe.getSecondOptionalOutput(), (int)(recipe.getOptionalChance() * 10000) }, handle, grindstone }); } }
Source:
public static void stop(String igniteInstanceName, boolean cancel) { final IgniteProcessProxy proxy = gridProxies.get(igniteInstanceName); if (proxy != null) { final CountDownLatch rmtNodeStoppedLatch = new CountDownLatch(1); final UUID rmNodeId = proxy.id; proxy.locJvmGrid.events().localListen(new IgnitePredicateX<Event>() { @Override public boolean applyx(Event e) { if (((DiscoveryEvent)e).eventNode().id().equals(rmNodeId)) { rmtNodeStoppedLatch.countDown(); return false; } return true; } }, EventType.EVT_NODE_LEFT); proxy.remoteCompute().runAsync(new StopGridTask(igniteInstanceName, cancel)); try { assert rmtNodeStoppedLatch.await(NODE_LEFT_TIMEOUT, TimeUnit.MILLISECONDS) : "Remote node has not stopped [id=" + rmNodeId + ']'; } catch (InterruptedException e) { throw new IgniteException(e); } gridProxies.remove(igniteInstanceName, proxy); } }

Target:
public static void stop(String igniteInstanceName, boolean cancel) throws Exception { final IgniteProcessProxy proxy = gridProxies.get(igniteInstanceName); if (proxy != null) { final CountDownLatch rmtNodeStoppedLatch = new CountDownLatch(1); final UUID rmNodeId = proxy.getId(); proxy.locJvmGrid.events().localListen(new IgnitePredicateX<Event>() { @Override public boolean applyx(Event e) { if (((DiscoveryEvent)e).eventNode().id().equals(rmNodeId)) { rmtNodeStoppedLatch.countDown(); return false; } return true; } }, EventType.EVT_NODE_LEFT); try { proxy.remoteCompute().runAsync(new StopGridTask(igniteInstanceName, cancel)); if (!rmtNodeStoppedLatch.await(NODE_LEFT_TIMEOUT, TimeUnit.MILLISECONDS)) throw new IllegalStateException("Remote node has not stopped [id=" + rmNodeId + ']'); } catch (Throwable t) { proxy.log().error("Failed to stop grid [igniteInstanceName=" + igniteInstanceName + ", cancel=" + cancel + ']', t); throw t; } gridProxies.remove(igniteInstanceName, proxy); } }