mivanac commented on code in PR #7856: URL: https://github.com/apache/geode/pull/7856#discussion_r972559431
########## geode-gfsh/src/main/java/org/apache/geode/management/internal/cli/commands/StartGatewaySenderCommand.java: ########## @@ -77,6 +77,49 @@ public ResultModel startGatewaySender(@CliOption(key = CliStrings.START_GATEWAYS return ResultModel.createError(CliStrings.NO_MEMBERS_FOUND_MESSAGE); } + if (cleanQueues) { + + Set<DistributedMember> allServers = findMembers(null, null); + + if (dsMembers.size() != allServers.size()) { + return ResultModel.createError(CliStrings.EXECUTE_ON_ALL_MEMBERS); + } + + GatewaySenderMXBean bean; + boolean commmandRejected = false; + + ResultModel rejectResultModel = + ResultModel.createError(CliStrings.START_GATEWAYSENDER_REJECTED); + TabularResultModel rejectResultData = + rejectResultModel.addTable(CliStrings.REJECT_START_GATEWAYSENDER_REASON); + + for (DistributedMember member : dsMembers) { + if (cache.getDistributedSystem().getDistributedMember().getId().equals(member.getId())) { + bean = service.getLocalGatewaySenderMXBean(senderId); + } else { + ObjectName objectName = service.getGatewaySenderMBeanName(member, senderId); + bean = service.getMBeanProxy(objectName, GatewaySenderMXBean.class); + } + if (bean != null) { + if (bean.isRunning()) { + commmandRejected = true; + rejectResultData.addMemberStatusResultRow(member.getId(), CliStrings.GATEWAY_ERROR, + CliStrings.format( + CliStrings.GATEWAY_SENDER_0_IS_ALREADY_STARTED_ON_MEMBER_1, id, + member.getId())); + } + } else { + commmandRejected = true; + rejectResultData.addMemberStatusResultRow(member.getId(), CliStrings.GATEWAY_ERROR, + CliStrings.format( + CliStrings.GATEWAY_SENDER_0_IS_NOT_AVAILABLE_ON_MEMBER_1, id, member.getId())); + } + } Review Comment: This check needs to be executed prior to execution of callables, since they are executed in parallel on all desired members. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: notifications-unsubscr...@geode.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org