private void maybeScheduleFollowupRebalance(final long encodedNextScheduledRebalanceMs,
                                                final int receivedAssignmentMetadataVersion,
                                                final int latestCommonlySupportedVersion,
                                                final Set<HostInfo> groupHostInfo) {
        if (maybeUpdateSubscriptionVersion(receivedAssignmentMetadataVersion, latestCommonlySupportedVersion)) {
            log.info("Requested to schedule immediate rebalance due to version probing.");
            nextScheduledRebalanceMs.set(0L);
        } else if (!verifyHostInfo(groupHostInfo)) {
            log.info("Requested to schedule immediate rebalance to update group with new host endpoint = {}.", userEndPoint);
            nextScheduledRebalanceMs.set(0L);
        } else if (encodedNextScheduledRebalanceMs == 0L) {
            log.info("Requested to schedule immediate rebalance for new tasks to be safely revoked from current owner.");
            nextScheduledRebalanceMs.set(0L);
        } else if (encodedNextScheduledRebalanceMs < Long.MAX_VALUE) {
            log.info(
                "Requested to schedule next probing rebalance at {} to try for a more balanced assignment.",
                Utils.toLogDateTimeFormat(encodedNextScheduledRebalanceMs)
            );
            nextScheduledRebalanceMs.set(encodedNextScheduledRebalanceMs);
        } else {
            log.info("No followup rebalance was requested, resetting the rebalance schedule.");
            nextScheduledRebalanceMs.set(Long.MAX_VALUE);
        }
    }
Generate an assignment that tries to preserve thread-level stickiness for stateful tasks without violating
balance. The tasks are balanced across threads. Stateful tasks without previous owners will be interleaved by
group id to spread subtopologies across threads and further balance the workload.
Stateless tasks are simply spread across threads without taking into account previous ownership.
threadLoad is a map that keeps track of task load per thread across multiple calls so active and standby
tasks are evenly distributed
streams/src/main/java/org/apache/kafka/streams/processor/internals/StreamsPartitionAssignor.java