void fromNotifyJson(JsonNode partitionNode, boolean fire) { ArrayNode partitionsNode = (ArrayNode) partitionNode.get("partitions"); if (partitionsNode != null) { for (JsonNode jsonNode : partitionsNode) { Optional<Partition> optionalPartition = getPartition(jsonNode.get("name").asText()); Preconditions.checkState(optionalPartition.isPresent(), "committed partition %s on partition %s must be present", jsonNode.get("name").asText(), this.getName()); Partition committedPartition = optionalPartition.get(); committedPartition.fromNotifyJson(jsonNode, fire); } } ArrayNode uncommittedPartitionsNode = (ArrayNode) partitionNode.get("uncommittedPartitions"); if (uncommittedPartitionsNode != null) { for (JsonNode jsonNode : uncommittedPartitionsNode) { this.fromUncommittedPartitionNotifyJson(jsonNode); } } ArrayNode uncommittedRemovedPartitions = (ArrayNode) partitionNode.get("uncommittedRemovedPartitions"); if (uncommittedRemovedPartitions != null) { for (JsonNode jsonNode : uncommittedRemovedPartitions) { String pName = jsonNode.asText(); Partition old = this.partitions.remove(pName); if (fire && old != null) { this.getAbstractLabel().getSchema().getTopology().fire(old, "", TopologyChangeAction.DELETE); } } } }
void fromNotifyJson(JsonNode partitionNode, boolean fire) { ArrayNode partitionsNode = (ArrayNode) partitionNode.get("partitions"); if (partitionsNode != null) { for (JsonNode jsonNode : partitionsNode) { Optional<Partition> optionalPartition = getPartition(jsonNode.get("name").asText()); Preconditions.checkState(optionalPartition.isPresent(), "committed partition %s on partition %s must be present", jsonNode.get("name").asText(), this.getName()); Partition committedPartition = optionalPartition.get(); committedPartition.fromNotifyJson(jsonNode, fire); } } ArrayNode uncommittedPartitionsNode = (ArrayNode) partitionNode.get("uncommittedPartitions"); if (uncommittedPartitionsNode != null) { for (JsonNode jsonNode : uncommittedPartitionsNode) { this.fromUncommittedPartitionNotifyJson(jsonNode); } } ArrayNode uncommittedRemovedPartitions = (ArrayNode) partitionNode.get("uncommittedRemovedPartitions"); if (uncommittedRemovedPartitions != null) { for (JsonNode jsonNode : uncommittedRemovedPartitions) { String pName = jsonNode.asText(); Partition old = this.partitions.remove(pName); if (fire && old != null) { this.getAbstractLabel().getSchema().getTopology().fire(old, "", TopologyChangeAction.DELETE); } } } }
if (optionalPartition.isPresent()) { Partition committedPartition = optionalPartition.get(); committedPartition.fromNotifyJson(partitionNode, fire); Partition old = this.partitions.put(committedPartition.getName(), committedPartition); if (fire && old == null) {
if (optionalPartition.isPresent()) { Partition committedPartition = optionalPartition.get(); committedPartition.fromNotifyJson(partitionNode, fire); Partition old = this.partitions.put(committedPartition.getName(), committedPartition); if (fire && old == null) {