/** * Add {@link Node} to the target {@link Group}. * * @param targetGroupName the target group name where to add the node. */ public void joinGroup(String targetGroupName) { Node node = clusterManager.getNode(); Map<String, Group> groups = groupManager.listGroups(); if (groups != null && !groups.isEmpty()) { Group targetGroup = groups.get(targetGroupName); if (targetGroup == null) { groupManager.registerGroup(targetGroupName); } else if (!targetGroup.getNodes().contains(node)) { targetGroup.getNodes().add(node); groupManager.listGroups().put(targetGroupName, targetGroup); groupManager.registerGroup(targetGroup); } } }
/** * Add {@link Node} to the target {@link Group}. * * @param targetGroupName the target group name where to add the node. */ public void joinGroup(String targetGroupName) { Node node = clusterManager.getNode(); Map<String, Group> groups = groupManager.listGroups(); if (groups != null && !groups.isEmpty()) { Group targetGroup = groups.get(targetGroupName); if (targetGroup == null) { groupManager.registerGroup(targetGroupName); } else if (!targetGroup.getNodes().contains(node)) { targetGroup.getNodes().add(node); groupManager.listGroups().put(targetGroupName, targetGroup); groupManager.registerGroup(targetGroup); } } }