auphong2707/dl4se-code-review-dataset huggingface dataset:
Source:
public Object wrap(final ProceedingJoinPoint point) throws Throwable { final int threadCount = ((MethodSignature) point.getSignature()) .getMethod().getAnnotation(Parallel.class).threads(); final Collection<Callable<Throwable>> callables = new ArrayList<Callable<Throwable>>(); final CountDownLatch start = new CountDownLatch(1); for (int thread = 0; thread < threadCount; ++thread) { callables.add(this.callable(point, start)); } final ExecutorService executor = Executors .newFixedThreadPool(threadCount); final List<Future<Throwable>> futures = new ArrayList<Future<Throwable>>(); for (Callable<Throwable> callable : callables) { futures.add(executor.submit(callable)); } start.countDown(); for (Future<Throwable> future : futures) { final Throwable exception = future.get(); if (exception != null) { executor.shutdownNow(); throw exception; } } return null; }

Target:
public Object wrap(final ProceedingJoinPoint point) throws ParallelException { final int total = ((MethodSignature) point.getSignature()) .getMethod().getAnnotation(Parallel.class).threads(); final Collection<Callable<Throwable>> callables = new ArrayList<Callable<Throwable>>(total); final CountDownLatch start = new CountDownLatch(1); for (int thread = 0; thread < total; ++thread) { callables.add(this.callable(point, start)); } final ExecutorService executor = Executors .newFixedThreadPool(total, new VerboseThreads()); final List<Future<Throwable>> futures = new ArrayList<Future<Throwable>>(total); for (Callable<Throwable> callable : callables) { futures.add(executor.submit(callable)); } start.countDown(); final Collection<Throwable> failures = new LinkedList<Throwable>(); for (Future<Throwable> future : futures) { final Throwable exception; try { exception = future.get(); if (exception != null) { failures.add(exception); } } catch (InterruptedException ex) { failures.add(ex); } catch (ExecutionException ex) { failures.add(ex); } } if (!failures.isEmpty()) { throw this.exceptions(failures); } return null; }
Source:
public void theGetActualMeterReadsRequestIsReceived(final Map<String, String> settings) throws Throwable { final ActualMeterReadsRequest request = ActualMeterReadsRequestFactory.forDevice(); final ActualMeterReadsAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncRespone should not be null", asyncResponse); ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }

Target:
public void theGetActualMeterReadsRequestIsReceived(final Map<String, String> settings) throws Throwable { final ActualMeterReadsRequest request = ActualMeterReadsRequestFactory.fromParameterMap(settings); final ActualMeterReadsAsyncResponse asyncResponse = this.requestClient.doRequest(request); assertNotNull("asyncRespone should not be null", asyncResponse); ScenarioContext.current().put(PlatformKeys.KEY_CORRELATION_UID, asyncResponse.getCorrelationUid()); }
Source:
ResultRowImpl( ) { this( new HashMap<>() ); }

Target:
public ResultRowImpl() { this( new HashMap<>() ); }
Source:
private void discoverFilter(final FunctionCall filter, final List<QueryModelNode> unmatched) { try { filter.visit(new FilterVisitor()); } catch (final Exception e) { e.printStackTrace(); } }

Target:
private void discoverFilter(final FunctionCall filter, final List<QueryModelNode> unmatched) { try { filter.visit(new FilterVisitor()); } catch (final Exception e) { LOG.error("Failed to match the filter object.", e); } }
Source:
public void saveStructureQuotaStructure(final HttpServerRequest request) { request.bodyHandler(new Handler<Buffer>() { @Override public void handle(Buffer event) { try { String obj = XSSUtils.stripXSS(event.toString("UTF-8")); JsonObject jsonStructure = new JsonObject(obj); quotaService.updateQuotaForStructure(jsonStructure, new Handler<Either<String,JsonObject>>() { public void handle(Either<String, JsonObject> result) { if (result.isLeft()) { log.error("Error saving structure quota."); } } }); } catch (Exception e) { log.error("Failed to save Structure Quota"); } } }); }

Target:
public void saveStructureQuotaStructure(final HttpServerRequest request) { bodyToJson(request, new Handler<JsonObject>() { @Override public void handle(final JsonObject jsonStructure) { quotaService.updateQuotaForStructure(jsonStructure, new Handler<Either<String,JsonObject>>() { public void handle(Either<String, JsonObject> result) { if (result.isRight()) { ok(request); } else { log.error("Error saving structure quota."); badRequest(request, result.left().getValue()); } } }); } }); }
Source:
public void parse(String status) throws PSQLException { if (!Parser.isDigitAt(status, status.length() - 1)) { set(0, 0); } long oid = 0; long count = 0; try { int lastSpace = status.lastIndexOf(' '); if (Parser.isDigitAt(status, lastSpace + 1)) { count = Parser.parseLong(status, lastSpace + 1, status.length()); if (Parser.isDigitAt(status, lastSpace - 1)) { int penultimateSpace = status.lastIndexOf(' ', lastSpace - 1); if (Parser.isDigitAt(status, penultimateSpace + 1)) { oid = Parser.parseLong(status, penultimateSpace + 1, lastSpace); } } } } catch (NumberFormatException e) { throw new PSQLException( GT.tr("Unable to parse the count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE, e); } set(oid, count); }

Target:
public void parse(String status) throws PSQLException { if (!Parser.isDigitAt(status, status.length() - 1)) { set(0, 0); return; } long oid = 0; long rows = 0; try { int lastSpace = status.lastIndexOf(' '); if (Parser.isDigitAt(status, lastSpace + 1)) { rows = Parser.parseLong(status, lastSpace + 1, status.length()); if (Parser.isDigitAt(status, lastSpace - 1)) { int penultimateSpace = status.lastIndexOf(' ', lastSpace - 1); if (Parser.isDigitAt(status, penultimateSpace + 1)) { oid = Parser.parseLong(status, penultimateSpace + 1, lastSpace); } } } } catch (NumberFormatException e) { throw new PSQLException( GT.tr("Unable to parse the count in command completion tag: {0}.", status), PSQLState.CONNECTION_FAILURE, e); } set(oid, rows); }
Source:
public FileCopyRecordWriter(Configuration conf) throws Exception { String uriString; if ((uriString = conf.get(FileCopyOutputFormat.FS_HOST_URI, null)) != null) { destFileSystem = FileSystem.get(URI.create(uriString), conf); } else { destFileSystem = FileSystem.get(conf); } basePath = conf.get(FileCopyOutputFormat.BASE_PATH); enableOverwrite = conf.getBoolean(FileCopyOutputFormat.ENABLE_OVERWRITE, false); preserveOwner = conf.getBoolean(FileCopyOutputFormat.PRESERVE_OWNER, false); fsCache = conf.getBoolean(FileCopyOutputFormat.FS_CACHE, true); bufferSize = conf.getInt(FileCopyOutputFormat.BUFFER_SIZE, defaultBufferSize); sourceFilesystemMap = new HashMap<>(); }

Target:
public FileCopyRecordWriter(Configuration conf) throws IOException { conf.set(String.format("fs.%s.impl.disable.cache", conf.get(FileCopyOutputFormat.FS_SCHEME)), String.valueOf(true)); String uriString = conf.get(FileCopyOutputFormat.FS_HOST_URI, null); if (uriString != null) { destFileSystem = FileSystem.get(URI.create(uriString), conf); } else { destFileSystem = FileSystem.get(conf); } basePath = conf.get(FileCopyOutputFormat.BASE_PATH); enableOverwrite = conf.getBoolean(FileCopyOutputFormat.ENABLE_OVERWRITE, false); preserveOwner = conf.getBoolean(FileCopyOutputFormat.PRESERVE_OWNER, false); bufferSize = conf.getInt(FileCopyOutputFormat.BUFFER_SIZE, DEFAULT_BUFFER_SIZE); sourceFilesystemMap = new HashMap<>(); }
Source:
public void testChannelMustBeClosedRegardlessError() { FileSystemProvider fsProvider = new K8SFileSystemProvider() { @Override public KubernetesClient createKubernetesClient() { return CLIENT_FACTORY.get(); } }; final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create("k8s:/ final Path valid = kfs.getPath("/test"); K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider); assertTrue(k8sfc.isOpen()); k8sfc.ccf = null; try { k8sfc.close(); } catch (Exception e) { } assertFalse(k8sfc.isOpen()); }

Target:
public void testChannelMustBeClosedRegardlessError() { FileSystemProvider fsProvider = new K8SFileSystemProvider() { @Override public KubernetesClient createKubernetesClient() { return CLIENT_FACTORY.get(); } }; final K8SFileSystem kfs = (K8SFileSystem) fsProvider.getFileSystem(URI.create("k8s:/ final Path valid = kfs.getPath("/test"); K8SFileChannel k8sfc = new K8SFileChannel(valid, (CloudClientFactory) fsProvider); assertTrue(k8sfc.isOpen()); k8sfc.ccf = null; try { k8sfc.close(); fail("Channel close should throw an exception."); } catch (Exception e) { } assertFalse(k8sfc.isOpen()); }
Source:
public void update() throws Exception { DomainNameList names = new DomainNameList(Lists.newArrayList("dName1", "dName2")); List<String> namesDTO = Lists.newArrayList("dName1", "dName2"); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "359", "44")); List<Network3GPPDTO> networkDTOs = Lists.newArrayList(new Network3GPPDTO("name", "359", "44")); List<RoamingConsortium> list = Lists.newArrayList(new RoamingConsortium("name", "0xAAFFAA")); List<RoamingConsortiumDTO> listDTO = Lists.newArrayList(new RoamingConsortiumDTO("name", "0xAAFFAA")); ServiceProviderDTO dto = new ServiceProviderDTO("id", "name", "description", networkDTOs, namesDTO, listDTO); final ServiceProvider provider = new ServiceProvider(new ID("id"), dto.name, dto.description, networks, names, list); Request request = makeRequestThatContains(dto); context.checking(new Expectations() {{ oneOf(repository).update(with(matching(provider))); }}); Reply<?> reply = service.update("id", request); assertThat(reply, isOk()); }

Target:
public void update() throws Exception { DomainNameList names = new DomainNameList(Lists.newArrayList("dName1", "dName2")); List<String> namesDTO = Lists.newArrayList("dName1", "dName2"); List<Network3GPP> networks = Lists.newArrayList(new Network3GPP("name", "359", "44")); List<Network3GPPDTO> networkDTOs = Lists.newArrayList(new Network3GPPDTO("name", "359", "44")); List<RoamingConsortium> list = Lists.newArrayList(new RoamingConsortium("name", "0xAAFFAA")); List<RoamingConsortiumDTO> listDTO = Lists.newArrayList(new RoamingConsortiumDTO("name", "0xAAFFAA")); ServiceProviderDTO dto = new ServiceProviderDTO("1234", "name", "description", networkDTOs, namesDTO, listDTO); final ServiceProvider provider = new ServiceProvider(new ID("id"), dto.name, dto.description, networks, names, list); Request request = makeRequestThatContains(dto); context.checking(new Expectations() {{ oneOf(repository).update(with(matching(provider))); }}); Reply<?> reply = service.update("id", request); assertThat(reply, isOk()); }
Source:
public void removeObserver(@NonNull Observer<T> observer) { throw new UnsupportedOperationException("removeObserver not supported."); }

Target:
public void removeObserver(@NonNull Observer<T> observer) { super.removeObserver(observer); }
Source:
public void dispose() { SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentProvider = null; menuManager = null; }

Target:
public void dispose() { SessionManager.INSTANCE.removeSessionsListener(this); session = null; treeViewer = null; manageSessionActionProvider = null; siriusCommonContentProvider = null; menuManager = null; toolkit = null; }
Source:
private List<TreeViewGroupMetricsToNodeRule> provideRulesForPlotsNode() { List<TreeViewGroupMetricsToNodeRule> result = new ArrayList<TreeViewGroupMetricsToNodeRule>(); String regex = "^(" + StandardMetricsNamesUtil.THROUGHPUT_ID + "|" + StandardMetricsNamesUtil.THROUGHPUT + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.THROUGHPUT_ID, StandardMetricsNamesUtil.THROUGHPUT, regex)); regex = "^(" + StandardMetricsNamesUtil.VIRTUAL_USERS_ID + "|" + StandardMetricsNamesUtil.VIRTUAL_USERS + ".*" + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.VIRTUAL_USERS_ID, StandardMetricsNamesUtil.VIRTUAL_USERS, regex)); regex = "^(" + StandardMetricsNamesUtil.LATENCY_ID + "|" + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID + "|" + StandardMetricsNamesUtil.LATENCY + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.LATENCY_ID + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID, StandardMetricsNamesUtil.LATENCY, regex)); regex = "^" + StandardMetricsNamesUtil.LATENCY_PERCENTILE_REGEX + "|" + StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "_id", StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE, regex)); return result; }

Target:
private List<TreeViewGroupMetricsToNodeRule> provideRulesForPlotsNode() { List<TreeViewGroupMetricsToNodeRule> result = new ArrayList<TreeViewGroupMetricsToNodeRule>(); String regex = "^(" + StandardMetricsNamesUtil.THROUGHPUT_ID + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.THROUGHPUT_ID, StandardMetricsNamesUtil.THROUGHPUT, regex)); regex = "^(" + StandardMetricsNamesUtil.VIRTUAL_USERS_ID + ".*" + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.VIRTUAL_USERS_ID, StandardMetricsNamesUtil.VIRTUAL_USERS, regex)); regex = "^(" + StandardMetricsNamesUtil.LATENCY_ID + "|" + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID + ")$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.LATENCY_ID + StandardMetricsNamesUtil.LATENCY_STD_DEV_ID, StandardMetricsNamesUtil.LATENCY, regex)); regex = "^" + StandardMetricsNamesUtil.LATENCY_PERCENTILE_REGEX + "|" + StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "$"; result.add(new TreeViewGroupMetricsToNodeRule( Rule.By.ID, StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE + "_id", StandardMetricsNamesUtil.TIME_LATENCY_PERCENTILE, regex)); return result; }
Source:
public void testReplaceDuplicateJavaDocComment() { CompilationUnit cu = parse("public class MyClass {" + EOL + EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL); MethodDeclaration methodDeclaration = cu.findFirst(MethodDeclaration.class).get(); Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); methodDeclaration.setJavadocComment("", javadoc); assertEquals("public class MyClass {" + EOL + EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL, cu.toString(prettyPrintConfig)); }

Target:
public void testReplaceDuplicateJavaDocComment() { CompilationUnit cu = parse("public class MyClass {" + EOL + EOL + " " + EOL + " public void oneMethod() {" + EOL + " }" + EOL + EOL + " " + EOL + " public void anotherMethod() {" + EOL + " }" + EOL + "}" + EOL); MethodDeclaration methodDeclaration = cu.findFirst(MethodDeclaration.class).get(); Javadoc javadoc = new Javadoc(JavadocDescription.parseText("Change Javadoc")); methodDeclaration.setJavadocComment("", javadoc); assertEqualsNoEol("public class MyClass {\n" + "\n" + " \n" + " public void oneMethod() {\n" + " }\n" + "\n" + " \n" + " public void anotherMethod() {\n" + " }\n" + "}\n", cu.toString(PRETTY_PRINTER_CONFIG_TWO_INDENT)); }
Source:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (GetVmToAttach(getParameters().getVmPoolId()).equals(Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDAO().getAllForUser(getAdUserId()); for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_USER_ATTACHED_TO_POOL); returnValue = false; } } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }

Target:
protected boolean canDoAction() { boolean returnValue = true; synchronized (_lockObject) { if (GetVmToAttach(getParameters().getVmPoolId()) == (Guid.Empty)) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_NO_AVAILABLE_POOL_VMS); returnValue = false; } } if (returnValue) { List<VM> vmsForUser = DbFacade.getInstance().getVmDAO().getAllForUser(getAdUserId()); for (VM vm : vmsForUser) { if (vm.getVmPoolId() != null && getVmPoolId().equals(vm.getVmPoolId())) { addCanDoActionMessage(VdcBllMessages.ACTION_TYPE_FAILED_USER_ATTACHED_TO_POOL); returnValue = false; } } } if (!returnValue) { addCanDoActionMessage(VdcBllMessages.VAR__ACTION__ALLOCATE_AND_RUN); addCanDoActionMessage(VdcBllMessages.VAR__TYPE__VM_FROM_VM_POOL); } return returnValue; }
Source:
public void enterVariableDeclaration(SwiftParser.VariableDeclarationContext ctx) { ParseTreeWalker walker = new ParseTreeWalker(); if (ctx.patternInitializerList() == null) { return; } for (SwiftParser.PatternInitializerContext context : ctx.patternInitializerList().patternInitializer()) { SwiftParser.PatternContext pattern = context.pattern(); listenerHelper.evaluatePattern(pattern, walker, new VariableDecListener(this.printer, this.maxLengths)); } }

Target:
public void enterVariableDeclaration(SwiftParser.VariableDeclarationContext ctx) { if (ctx.patternInitializerList() == null) { return; } listenerHelper.evaluatePatternInitializerList(ctx.patternInitializerList(), new VariableDecListener(this.printer, this.maxLengths)); }
Source:
public void shouldSaveRuleAction() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Rule rule = new RuleDataGen().host(host).nextPersisted(); this.addPermission(role, host, true); final RuleAction ruleAction = new RuleActionDataGen().rule(rule).next(); rulesAPI.saveRuleAction(ruleAction, user, false); final List<Rule> allRules = rulesAPI.getAllRules(user, false); assertEquals(1, allRules.size()); final List<RuleAction> ruleActions = allRules.get(0).getRuleActions(); assertEquals(1, ruleActions.size()); assertEquals(ruleAction.getActionDefinition(), ruleAction.getActionDefinition()); }

Target:
public void shouldSaveRuleAction() throws DotSecurityException, DotDataException { final Role role = new RoleDataGen().nextPersisted(); final User user = new UserDataGen().roles(role).nextPersisted(); final Host host = new SiteDataGen().nextPersisted(); final Rule rule = new RuleDataGen().host(host).nextPersisted(); this.addPermission(role, host, true); final RuleAction ruleAction = new RuleActionDataGen().rule(rule).next(); rulesAPI.saveRuleAction(ruleAction, user, false); final List<Rule> allRules = rulesAPI.getAllRules(user, false); final List<RuleAction> ruleActions = allRules.get(0).getRuleActions(); assertEquals(1, ruleActions.size()); assertEquals(ruleAction.getActionDefinition(), ruleActions.get(0).getActionDefinition()); }
Source:
void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { throw new SQLException("Connection.isValid() is not supported, configure connection test query."); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); connection.setAutoCommit(isAutoCommit); connection.setReadOnly(isReadOnly); if (transactionIsolation == -1) { transactionIsolation = connection.getTransactionIsolation(); } else if (transactionIsolation != Connection.TRANSACTION_NONE) { connection.setTransactionIsolation(transactionIsolation); } if (catalog != null) { connection.setCatalog(catalog); } executeSql(connection, config.getConnectionInitSql(), isAutoCommit); setNetworkTimeout(connection, networkTimeout); }

Target:
void setupConnection(final Connection connection, final long connectionTimeout) throws SQLException { if (isUseJdbc4Validation && !isJdbc4ValidationSupported(connection)) { throw new SQLException("Connection.isValid() is not supported, configure connection test query."); } networkTimeout = getAndSetNetworkTimeout(connection, connectionTimeout); connection.setAutoCommit(isAutoCommit); connection.setReadOnly(isReadOnly); final int defaultLevel = connection.getTransactionIsolation(); transactionIsolation = (transactionIsolation < 0 || defaultLevel == Connection.TRANSACTION_NONE) ? defaultLevel : transactionIsolation; if (transactionIsolation != defaultLevel) { connection.setTransactionIsolation(transactionIsolation); } if (catalog != null) { connection.setCatalog(catalog); } executeSql(connection, config.getConnectionInitSql(), isAutoCommit); setNetworkTimeout(connection, networkTimeout); }
Source:
public void sendToJail(final IUser user, final String jail) throws Exception { CompletableFuture<Exception> eFuture = new CompletableFuture<>(); CompletableFuture<Boolean> future = new CompletableFuture<>(); sendToJail(user, jail, eFuture, future); if (!future.get()) { throw eFuture.get(); } }

Target:
public void sendToJail(final IUser user, final String jail) throws Exception { acquireReadLock(); try { if (user.getBase().isOnline()) { Location loc = getJail(jail); user.getTeleport().now(loc, false, TeleportCause.COMMAND); } user.setJail(jail); } finally { unlock(); } }
Source:
public void requestEmailSignIn(SignIn signIn) { long startTime = System.currentTimeMillis(); Validate.entityThrowingException(SignInValidator.EMAIL_SIGNIN_REQUEST, signIn); Study study = studyService.getStudy(signIn.getStudyId()); if (!study.isEmailSignInEnabled()) { throw new UnauthorizedException("Email-based sign in not enabled for study: " + study.getName()); } String cacheKey = getEmailSignInCacheKey(study, signIn.getEmail()); if (cacheProvider.getString(cacheKey) != null) { throw new LimitExceededException("Email currently pending confirmation."); } if (accountDao.getAccountWithEmail(study, signIn.getEmail()) == null) { try { LOG.info("Email submitted for sign in that is not registered: " + signIn.getEmail()); TimeUnit.MILLISECONDS.sleep(emailSignInRequestInMillis.get()); } catch(InterruptedException e) { } return; } String token = getVerificationToken(); cacheProvider.setString(cacheKey, token, SESSION_SIGNIN_TIMEOUT); BasicEmailProvider provider = new BasicEmailProvider.Builder() .withEmailTemplate(study.getEmailSignInTemplate()) .withStudy(study) .withRecipientEmail(signIn.getEmail()) .withToken("email", BridgeUtils.encodeURIComponent(signIn.getEmail())) .withToken("token", token).build(); sendMailService.sendEmail(provider); this.emailSignInRequestInMillis.set(System.currentTimeMillis()-startTime); }

Target:
public void requestEmailSignIn(SignIn signIn) { long startTime = System.currentTimeMillis(); Validate.entityThrowingException(SignInValidator.EMAIL_SIGNIN_REQUEST, signIn); Study study = studyService.getStudy(signIn.getStudyId()); if (!study.isEmailSignInEnabled()) { throw new UnauthorizedException("Email-based sign in not enabled for study: " + study.getName()); } String cacheKey = getEmailSignInCacheKey(study, signIn.getEmail()); if (cacheProvider.getString(cacheKey) != null) { throw new LimitExceededException("Email currently pending confirmation."); } if (accountDao.getAccountWithEmail(study, signIn.getEmail()) == null) { try { TimeUnit.MILLISECONDS.sleep(emailSignInRequestInMillis.get()); } catch(InterruptedException e) { } return; } String token = getVerificationToken(); cacheProvider.setString(cacheKey, token, SESSION_SIGNIN_TIMEOUT); BasicEmailProvider provider = new BasicEmailProvider.Builder() .withEmailTemplate(study.getEmailSignInTemplate()) .withStudy(study) .withRecipientEmail(signIn.getEmail()) .withToken("email", BridgeUtils.encodeURIComponent(signIn.getEmail())) .withToken("token", token).build(); sendMailService.sendEmail(provider); this.emailSignInRequestInMillis.set(System.currentTimeMillis()-startTime); }
Source:
private KinesisSequenceNumber(@NotNull String sequenceNumber, boolean isExclusive) { super(sequenceNumber, isExclusive); if (OrderedPartitionableRecord.END_OF_SHARD_MARKER.equals(sequenceNumber) || SeekableStreamPartitions.NO_END_SEQUENCE_NUMBER.equals(sequenceNumber)) { isMaxSequenceNumber = true; this.intSequence = null; } else { isMaxSequenceNumber = false; this.intSequence = new BigInteger(sequenceNumber); } }

Target:
private KinesisSequenceNumber(@NotNull String sequenceNumber, boolean isExclusive) { super(sequenceNumber, isExclusive); if (END_OF_SHARD_MARKER.equals(sequenceNumber) || SeekableStreamPartitions.NO_END_SEQUENCE_NUMBER.equals(sequenceNumber)) { isMaxSequenceNumber = true; this.intSequence = null; } else { isMaxSequenceNumber = false; this.intSequence = new BigInteger(sequenceNumber); } }
Source:
public Set<String> getRunningTaskIds() { return getRunningTasks().keySet(); }

Target:
public Collection<String> getRunningTaskIds() { return getRunningTasks().keySet(); }
Source:
public void onSaveFile() { final SaveFilePanel outfilePanel = new SaveFilePanel( "bshConsoleOutFile", I18N.tr("Save script")); outfilePanel.addFilter("bsh", I18N.tr("BeanShell Script (*.bsh)")); outfilePanel.setConfirmOverwrite(true); outfilePanel.loadState(); if (UIFactory.showDialog(outfilePanel)) { try { FileUtils.write(outfilePanel.getSelectedFile(), scriptPanel.getText()); } catch (IOException e1) { LOGGER.error(I18N.tr("IO error."), e1); return; } setStatusMessage(I18N.tr("The file has been saved.")); } else { setStatusMessage(""); } }

Target:
public void onSaveFile() { final SaveFilePanel outfilePanel = new SaveFilePanel( "bshConsoleOutFile", I18N.tr("Save script")); outfilePanel.addFilter("bsh", I18N.tr("BeanShell Script (*.bsh)")); outfilePanel.loadState(); if (UIFactory.showDialog(outfilePanel)) { try { FileUtils.write(outfilePanel.getSelectedFile(), scriptPanel.getText()); } catch (IOException e1) { LOGGER.error(I18N.tr("IO error."), e1); return; } setStatusMessage(I18N.tr("The file has been saved.")); } else { setStatusMessage(""); } }
Source:
Mono<Response<Void>> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure, Context context) { return postProcessResponse(this.client.services().submitBatchWithRestResponseAsync( batch.getBody(), batch.getContentLength(), batch.getContentType(), context)) .flatMap(response -> BlobBatchHelper.mapBatchResponse(batch, response, throwOnAnyFailure)); }

Target:
Mono<Response<Void>> submitBatchWithResponse(BlobBatch batch, boolean throwOnAnyFailure, Context context) { return postProcessResponse(client.services().submitBatchWithRestResponseAsync( batch.getBody(), batch.getContentLength(), batch.getContentType(), context)) .flatMap(response -> BlobBatchHelper.mapBatchResponse(batch, response, throwOnAnyFailure, logger)); }
Source:
private String getCaller() { String userName = "admin"; PeopleQueryEvaluator pqe = HumanTaskServiceComponent.getHumanTaskServer(). getTaskEngine().getPeopleQueryEvaluator(); if (StringUtils.isNotEmpty(pqe.getLoggedInUser())) { userName = pqe.getLoggedInUser(); } if (StringUtils.isEmpty(userName)) { throw new HumanTaskRuntimeException("Cannot determine the user name of the user " + "performing the task operation!"); } List<String> roleList = pqe.getRoleNameListForUser(pqe.getLoggedInUser()); for (String roleName : roleList) { List<String> userList = pqe.getUserNameListForRole(roleName); for (String user : userList) { if (user.equalsIgnoreCase(userName)) { return user; } } } return userName; }

Target:
private String getCaller() { String userName = "admin"; PeopleQueryEvaluator pqe = HumanTaskServiceComponent.getHumanTaskServer(). getTaskEngine().getPeopleQueryEvaluator(); if (StringUtils.isNotEmpty(pqe.getLoggedInUser())) { userName = pqe.getLoggedInUser(); } if (StringUtils.isEmpty(userName)) { throw new HumanTaskRuntimeException("Cannot determine the user name of the user " + "performing the task operation!"); } return userName; }
Source:
public void test2() { DynamicGraph<Node> dg = new DynamicGraph<>(); Node a1 = new Node("a1"); Node a2 = new Node("a2"); Node b1 = new Node("b1"); dg.addNode(a1); dg.addNode(a2); dg.addNode(b1); dg.addEdge(1, b1, a1, a2); dg.addEdge(0, a2, a1, b1); Node x = new Node("x"); dg.addNode(x); dg.addEdge(0, a1, x); dg.addEdge(0, b1, x); assertFreeNodesEquals(dg, x); dg.setStatus(dg.getFreeNodes(), Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(x, Status.FINISHED); assertFreeNodesEquals(dg,a1); dg.setStatus(dg.getFreeNodes(), Status.RUNNING); dg.setStatus(a1, Status.FINISHED); assertFreeNodesEquals(dg,a2); dg.setStatus(a2, Status.FINISHED); assertFreeNodesEquals(dg, b1); Node b2 = new Node("b2"); dg.setStatus(b2, Status.RUNNING); dg.setStatus(b1, Status.FINISHED); assertFreeNodesEquals(dg); }

Target:
public void test2() { DynamicGraph<Node> dg = new DynamicGraph<>(); Node a1 = new Node("a1"); Node a2 = new Node("a2"); Node b1 = new Node("b1"); dg.addNode(a1); dg.addNode(a2); dg.addNode(b1); dg.addEdge(1, b1, a1, a2); dg.addEdge(0, a2, a1, b1); Node x = new Node("x"); dg.addNode(x); dg.addEdge(0, a1, x); dg.addEdge(0, b1, x); assertFreeNodesEquals(dg, x); dg.setStatus(x, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(x, Status.FINISHED); assertFreeNodesEquals(dg, a1); dg.setStatus(a1, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(a1, Status.FINISHED); assertFreeNodesEquals(dg, a2); dg.setStatus(a2, Status.RUNNING); assertFreeNodesEquals(dg); dg.setStatus(a2, Status.FINISHED); assertFreeNodesEquals(dg, b1); Node b2 = new Node("b2"); dg.setStatus(b2, Status.RUNNING); dg.setStatus(b1, Status.FINISHED); assertFreeNodesEquals(dg); }
Source:
private String getJumbuneScheduleTaskInfo(String scheduledJobDateTime, String jumbuneScheduleTaskCommand) { StringBuilder jumbuneSchedulerdBuilder = new StringBuilder( scheduledJobDateTime).append(SPACE) .append(jumbuneScheduleTaskCommand).append(NEW_LINE) .append("#"); LOGGER.info("jumbuneTaskCommand " + jumbuneSchedulerdBuilder.toString()); return jumbuneSchedulerdBuilder.toString(); }

Target:
private String getJumbuneScheduleTaskInfo(String scheduledJobDateTime, String jumbuneScheduleTaskCommand) { StringBuilder jumbuneSchedulerdBuilder = new StringBuilder( scheduledJobDateTime).append(SPACE) .append(jumbuneScheduleTaskCommand).append(NEW_LINE) .append("#"); return jumbuneSchedulerdBuilder.toString(); }
Source:
public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters) { Map<String, Object> parameters = getNamedParameterValuesConvertedByGridType( queryParameters ); String nativeQuery = buildNativeQuery( backendQuery, queryParameters ); Result result = dataBase.execute( nativeQuery, parameters ); if ( backendQuery.isSingleEntity() ) { OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( backendQuery.getSingleIndexedTypeNameOrNull() ); return new NodesTupleIterator( result, backendQuery.getSingleEntityKeyMetadataOrNull(), persister.getTupleContext() ); } return new MapsTupleIterator( result ); }

Target:
public ClosableIterator<Tuple> executeBackendQuery(BackendQuery<String> backendQuery, QueryParameters queryParameters) { Map<String, Object> parameters = getNamedParameterValuesConvertedByGridType( queryParameters ); String nativeQuery = buildNativeQuery( backendQuery, queryParameters ); Result result = dataBase.execute( nativeQuery, parameters ); EntityMetadataInformation entityMetadataInformation = backendQuery.getSingleEntityMetadataInformationOrNull(); if ( entityMetadataInformation != null ) { OgmEntityPersister persister = (OgmEntityPersister) sessionFactory.getEntityPersister( entityMetadataInformation.getTypeName() ); return new NodesTupleIterator( result, entityMetadataInformation.getEntityKeyMetadata(), persister.getTupleContext() ); } return new MapsTupleIterator( result ); }
Source:
void initialize(XMLReader xmlReader, Transformer transformer) throws IOException; } private Transformer buildTransformer(Site site, XMLReader xmlReader, TransformerInitialization initialization) throws IOException { Theme theme = site.getTheme(); log.debug("Building transformer for: {}", site); TransformerFactory factory = newTransformerFactory(); Transformer transformer; try (ThemeUriResolver resolver = new ThemeUriResolver(theme); InputStream transformFile = theme.getStaticResource(TRANSFORM_TEMPLATE_PATH)) { factory.setURIResolver(resolver); transformer = factory.newTransformer(new StreamSource(transformFile)); } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } initialization.initialize(xmlReader, transformer); return transformer; }

Target:
void initialize(XMLReader xmlReader, Transformer transformer) throws IOException; } private Transformer buildTransformer(Site site, XMLReader xmlReader, TransformerInitializer initialization) throws IOException { Theme theme = site.getTheme(); log.debug("Building transformer for: {}", site); TransformerFactory factory = newTransformerFactory(); Transformer transformer; try (ThemeUriResolver resolver = new ThemeUriResolver(theme); InputStream transformFile = theme.getStaticResource(TRANSFORM_TEMPLATE_PATH)) { factory.setURIResolver(resolver); transformer = factory.newTransformer(new StreamSource(transformFile)); } catch (TransformerConfigurationException e) { throw new RuntimeException(e); } initialization.initialize(xmlReader, transformer); return transformer; }
Source:
public void testBackgroundUpdater() throws Exception { helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "account.service.polling.interval.ms", "1"); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); MockHelixAccountServiceFactory mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, shouldUseMockHelixStore); accountService = mockHelixAccountServiceFactory.getAccountService(); Thread.sleep(2); assertTrue("Wrong number of reads to the store.", ((MockHelixPropertyStore) mockHelixAccountServiceFactory.getHelixStore(storeConfig)).getReadCount() > 1); }

Target:
public void testBackgroundUpdater() throws Exception { helixConfigProps.setProperty( HelixPropertyStoreConfig.HELIX_PROPERTY_STORE_PREFIX + "account.updater.polling.interval.ms", "1"); vHelixConfigProps = new VerifiableProperties(helixConfigProps); storeConfig = new HelixPropertyStoreConfig(vHelixConfigProps); String updaterThreadPrefix = UUID.randomUUID().toString(); MockHelixAccountServiceFactory mockHelixAccountServiceFactory = new MockHelixAccountServiceFactory(vHelixConfigProps, new MetricRegistry(), notifier, updaterThreadPrefix); accountService = mockHelixAccountServiceFactory.getAccountService(); CountDownLatch latch = new CountDownLatch(1); mockHelixAccountServiceFactory.getHelixStore(storeConfig).setReadLatch(latch); assertEquals("Wrong number of thread for account updater.", 1, numThreadsByThisName(updaterThreadPrefix)); awaitLatchOrTimeout(latch, 100); }
Source:
private static List<AbstractContainerEnvVar> combineEnvVars(ContainerTemplate parent, ContainerTemplate template) { List<AbstractContainerEnvVar> combinedSimpleEnvVars = new ArrayList<>(); combinedSimpleEnvVars.addAll(parent.getEnvVars()); combinedSimpleEnvVars.addAll(template.getEnvVars()); return combinedSimpleEnvVars.stream().filter(envVar -> !Strings.isNullOrEmpty(envVar.getKey())).collect(Collectors.toList()); }

Target:
private static List<TemplateEnvVar> combineEnvVars(ContainerTemplate parent, ContainerTemplate template) { List<TemplateEnvVar> combinedEnvVars = new ArrayList<>(); combinedEnvVars.addAll(parent.getEnvVars()); combinedEnvVars.addAll(template.getEnvVars()); return combinedEnvVars.stream().filter(envVar -> !Strings.isNullOrEmpty(envVar.getKey())).collect(toList()); }
Source:
void handleResponseObject(Object response) throws ArgumentException; } private static final int BufferSize = 4096; public static boolean logAllWireBytes = false; private IHandleResponseObject responseHandler; private HttpWebRequest response; private HttpWebRequest request; private EwsServiceMultiResponseXmlReader ewsXmlReader; protected int heartbeatFrequencyMilliseconds; public interface IHangingRequestDisconnectHandler { void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args); }

Target:
void handleResponseObject(Object response) throws ArgumentException; } public static final int BUFFER_SIZE = 4096; private static volatile boolean logAllWireBytes = false; private IHandleResponseObject responseHandler; private HttpWebRequest response; protected int heartbeatFrequencyMilliseconds; public interface IHangingRequestDisconnectHandler { void hangingRequestDisconnectHandler(Object sender, HangingRequestDisconnectEventArgs args); }
Source:
String adjustPath(String path) throws Exception { if ( protectedMode.doProtected() ) { ZKPaths.PathAndNode pathAndNode = ZKPaths.getPathAndNode(path); String name = ProtectedUtils.getProtectedPrefix(protectedMode.protectedId()) + pathAndNode.getNode(); path = ZKPaths.makePath(pathAndNode.getPath(), name); } return path; }

Target:
String adjustPath(String path) throws Exception { return ProtectedUtils.toProtectedZNodePath(path, protectedMode.protectedId()); }
Source:
private short undeleteIfNeeded(BlobId blobId, short lifeVersion) throws CloudStorageException { if (!checkCacheState(blobId.getID(), lifeVersion, BlobState.CREATED)) { short newLifeVersion = cloudDestination.undeleteBlob(blobId, lifeVersion, (metadata, key, updateFields) -> preUndeleteValidation(metadata, key, updateFields)); addToCache(blobId.getID(), newLifeVersion, BlobState.CREATED); return newLifeVersion; } else { throw new CloudStorageException("Error updating blob metadata", new StoreException("Id " + blobId.getID() + " is already undeleted in cloud", StoreErrorCodes.ID_Undeleted)); } }

Target:
private short undeleteIfNeeded(BlobId blobId, short lifeVersion) throws CloudStorageException, StoreException { if (!checkCacheState(blobId.getID(), lifeVersion, BlobState.CREATED)) { short newLifeVersion = cloudDestination.undeleteBlob(blobId, lifeVersion, this::preUndeleteValidation); addToCache(blobId.getID(), newLifeVersion, BlobState.CREATED); return newLifeVersion; } else { throw new StoreException("Id " + blobId.getID() + " is already undeleted in cloud", StoreErrorCodes.ID_Undeleted); } }
Source:
protected boolean validateCqlNamesPresent(List<? extends VariableElement> parameters) { boolean valid = true; if (isFromClassFile()) { for (VariableElement parameter : parameters) { CqlName cqlName = parameter.getAnnotation(CqlName.class); if (cqlName == null) { context .getMessager() .error( parameter, "Method %s: parameter %s is declared in a compiled method " + "and refers to a bind marker " + "and thus must be annotated with @CqlName", methodElement, parameter.getSimpleName()); valid = false; } } } return valid; }

Target:
protected boolean validateCqlNamesPresent(List<? extends VariableElement> parameters) { boolean valid = true; if (isFromClassFile()) { for (VariableElement parameter : parameters) { CqlName cqlName = parameter.getAnnotation(CqlName.class); if (cqlName == null) { context .getMessager() .error( parameter, "Method %s: parameter %s is declared in a compiled method " + "and refers to a bind marker " + "and thus must be annotated with @%s", methodElement, parameter.getSimpleName(), CqlName.class.getSimpleName()); valid = false; } } } return valid; }
Source:
public ListMultimap<String, ParameterValue> getConfiguration() { ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create(); String crsAsString = null; if (crsDef != null) { if (crsDef instanceof CodeDefinition) { crsAsString = ((CodeDefinition)crsDef).getCode(); } else if (crsDef instanceof WKTDefinition) { crsAsString = ((WKTDefinition)crsDef).getWkt(); } } conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString)); return conf; }

Target:
public ListMultimap<String, ParameterValue> getConfiguration() { ListMultimap<String, ParameterValue> conf = ArrayListMultimap.create(); String crsAsString = null; if (crsDef != null) { crsAsString = CRSDefinitionManager.getInstance().asString(crsDef); } conf.put(PARAMETER_REFERENCE_SYSTEM, new ParameterValue(crsAsString)); return conf; }
Source:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree argument = mit.arguments().get(1); Type type = argument.symbolType(); if (type.isUnknown()) { return; } if (ExpressionsHelper.isNotSerializable(argument)) { String andParameters = JUtils.isParametrized(type) ? " and its parameters" : ""; reportIssue(argument, "Make \"" + type + "\"" + andParameters + " serializable or don't store it in the session."); } }

Target:
protected void onMethodInvocationFound(MethodInvocationTree mit) { ExpressionTree argument = mit.arguments().get(1); Type type = argument.symbolType(); if (ExpressionsHelper.isNotSerializable(argument)) { String andParameters = JUtils.isParametrized(type) ? " and its parameters" : ""; reportIssue(argument, "Make \"" + type.name() + "\"" + andParameters + " serializable or don't store it in the session."); } }
Source:
public void setUp() throws Exception { System.out.println("projectManagerTest: create temp dir"); synchronized (this) { workingDir = new File("_AzkabanTestDir_" + System.currentTimeMillis()); if (workingDir.exists()) { FileUtils.deleteDirectory(workingDir); } workingDir.mkdirs(); } }

Target:
public void setUp() throws Exception { Props props = new Props(); loader = mock(ProjectLoader.class); manager = new ProjectManager(loader, props); user = new User(TEST_USER); Project project1 = new Project(PROJECT_ID, PROJECT_NAME); project1.setDescription(PROJECT_DESCRIPTION); project1.setActive(true); project1.setVersion(PROJECT_VERSION); when(loader.createNewProject(PROJECT_NAME, PROJECT_DESCRIPTION, user)).thenReturn(project1); when(loader.fetchProjectById(PROJECT_ID)).thenReturn(project1); when(loader.fetchProjectByName(PROJECT_NAME)).thenReturn(project1); when(loader.fetchAllProjectFlows(project1)).thenReturn(new ArrayList<>()); when(loader.getLatestProjectVersion(project1)).thenReturn(PROJECT_VERSION); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { project1.setActive(false); return null; } }).when(loader).removeProject(project1, user.getUserId()); doAnswer(new Answer<Void>() { public Void answer(InvocationOnMock invocation) { project1.setVersion(PROJECT_VERSION + 1); return null; } }).when(loader).changeProjectVersion(project1, PROJECT_VERSION + 1, user.getUserId()); doThrow(ProjectManagerException.class).when(loader).fetchAllProjectFlows(null); }
Source:
public void start(Platform platform, WorkerStatusTracker status, KafkaFutureImpl<String> doneFuture) throws Exception { if (!running.compareAndSet(false, true)) { throw new IllegalStateException("ProducerBenchWorker is already running."); } log.info("{}: Activating ProduceBenchWorker with {}", id, spec); this.executor = Executors.newScheduledThreadPool(3, ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); this.status = status; this.doneFuture = doneFuture; executor.submit(new Prepare()); }

Target:
public void start(Platform platform, WorkerStatusTracker status, KafkaFutureImpl<String> doneFuture) throws Exception { if (!running.compareAndSet(false, true)) { throw new IllegalStateException("ProducerBenchWorker is already running."); } log.info("{}: Activating ProduceBenchWorker with {}", id, spec); if (spec.partitionRefreshRateMs() > 0) { this.executor = Executors.newScheduledThreadPool(3, ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); } else { this.executor = Executors.newScheduledThreadPool(2, ThreadUtils.createThreadFactory("ProduceBenchWorkerThread%d", false)); } this.status = status; this.doneFuture = doneFuture; executor.submit(new Prepare()); }
Source:
public void handleEvent(JSONObject event) { if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PING)) { lastPing = LocalDateTime.now(); interconnect.dispatch(getName(), new JSONObject().fluentPut(MESSAGE_TYPE, TYPE_PONG) .fluentPut(MESSAGE_NAME, CallContext.getNodeName()) .fluentPut(MESSAGE_ADDRESS, getLocalAddress())); } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PONG)) { String address = event.getString(MESSAGE_ADDRESS); if (!Strings.areEqual(address, getLocalAddress()) && Strings.isFilled(address)) { String nodeName = event.getString(MESSAGE_NAME); if (!Strings.areEqual(members.put(nodeName, address), address)) { Cluster.LOG.INFO("Discovered a new node: %s - %s", nodeName, address); members.put(nodeName, address); } } } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_KILL)) { members.remove(event.getString(MESSAGE_NAME)); } }

Target:
public void handleEvent(JSONObject event) { if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PING)) { lastPing = LocalDateTime.now(); interconnect.dispatch(getName(), new JSONObject().fluentPut(MESSAGE_TYPE, TYPE_PONG) .fluentPut(MESSAGE_NAME, CallContext.getNodeName()) .fluentPut(MESSAGE_ADDRESS, getLocalAddress())); } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_PONG)) { String address = event.getString(MESSAGE_ADDRESS); if (!Strings.areEqual(address, getLocalAddress()) && Strings.isFilled(address)) { String nodeName = event.getString(MESSAGE_NAME); if (!Strings.areEqual(members.put(nodeName, address), address)) { Cluster.LOG.INFO("Discovered a new node: %s - %s", nodeName, address); } } } else if (Strings.areEqual(event.getString(MESSAGE_TYPE), TYPE_KILL)) { members.remove(event.getString(MESSAGE_NAME)); } }
Source:
public void run() { synchronized (localMonitor) { subscriptionTaskRunning = true; } connection = connectionFactory.getConnection(); try { if (connection.isSubscribed()) { throw new IllegalStateException("Retrieved connection is already subscribed; aborting listening"); } synchronized (monitor) { monitor.notify(); } if (!channelMapping.isEmpty()) { if (!patternMapping.isEmpty()) { subscriptionExecutor.execute(new PatternSubscriptionTask()); } connection.subscribe(new DispatchMessageListener(), unwrap(channelMapping.keySet())); } else { connection.pSubscribe(new DispatchMessageListener(), unwrap(patternMapping.keySet())); } } catch (Throwable t) { if (logger.isErrorEnabled()) { logger.error("PatternSubscriptionTask abort with exception:", t); } handleSubscriptionTaskException(t); } finally { synchronized (localMonitor) { subscriptionTaskRunning = false; localMonitor.notify(); } } }

Target:
public void run() { synchronized (localMonitor) { subscriptionTaskRunning = true; } connection = connectionFactory.getConnection(); try { if (connection.isSubscribed()) { throw new IllegalStateException("Retrieved connection is already subscribed; aborting listening"); } synchronized (monitor) { monitor.notify(); } if (!channelMapping.isEmpty()) { if (!patternMapping.isEmpty()) { subscriptionExecutor.execute(new PatternSubscriptionTask()); } connection.subscribe(new DispatchMessageListener(), unwrap(channelMapping.keySet())); } else { connection.pSubscribe(new DispatchMessageListener(), unwrap(patternMapping.keySet())); } } catch (Throwable t) { logger.error("SubscriptionTask abort with exception:", t); refreshConnectionUntilSuccessful(t); } finally { synchronized (localMonitor) { subscriptionTaskRunning = false; localMonitor.notify(); } } }