static Map<TopicPartitionReplica, LogDirMoveState> findLogDirMoveStates(Admin adminClient,
                                                                            Map<TopicPartitionReplica, String> targetMoves
    ) throws ExecutionException, InterruptedException {
        Map<TopicPartitionReplica, DescribeReplicaLogDirsResult.ReplicaLogDirInfo> replicaLogDirInfos = adminClient
            .describeReplicaLogDirs(targetMoves.keySet()).all().get();

        return targetMoves.entrySet().stream().collect(Collectors.toMap(Entry::getKey, e -> {
            TopicPartitionReplica replica = e.getKey();
            String targetLogDir = e.getValue();

            if (!replicaLogDirInfos.containsKey(replica))
                return new MissingReplicaMoveState(targetLogDir);

            DescribeReplicaLogDirsResult.ReplicaLogDirInfo info = replicaLogDirInfos.get(replica);

            if (info.getCurrentReplicaLogDir() == null)
                return new MissingLogDirMoveState(targetLogDir);

            if (info.getFutureReplicaLogDir() == null) {
                if (info.getCurrentReplicaLogDir().equals(targetLogDir))
                    return new CompletedMoveState(targetLogDir);

                return new CancelledMoveState(info.getCurrentReplicaLogDir(), targetLogDir);
            }

            return new ActiveMoveState(info.getCurrentReplicaLogDir(), targetLogDir, info.getFutureReplicaLogDir());
        }));
    }
Find the state of the specified partition reassignments.

@param adminClient           The AdminClient to use.
@param targetMoves           The movements we want to learn about.  The map is keyed
                             by TopicPartitionReplica, and its values are target log
                             directories.

@return                      The states for each replica movement.
tools/src/main/java/org/apache/kafka/tools/reassign/ReassignPartitionsCommand.java