Source:
<code>private void addClientAssignments(final Map<String, Assignment> assignment, final ClientMetadata clientMetadata, final Map<TaskId, Set<TopicPartition>> partitionsForTask, final Map<HostInfo, Set<TopicPartition>> partitionsByHostState, final Map<HostInfo, Set<TopicPartition>> standbyPartitionsByHost, final Set<TopicPartition> allOwnedPartitions, final Map<String, List<TaskId>> activeTaskAssignments, final Map<String, List<TaskId>> standbyTaskAssignments, final int minUserMetadataVersion, final int minSupportedMetadataVersion, final boolean versionProbing, final boolean followupRebalanceNeeded) { boolean encodeNextRebalanceTime = followupRebalanceNeeded; boolean stableAssignment = !followupRebalanceNeeded && !versionProbing; for (final String consumer : clientMetadata.consumers) { final List<TaskId> activeTasksForConsumer = activeTaskAssignments.get(consumer); final List<TopicPartition> activePartitionsList = new ArrayList<>(); final List<TaskId> assignedActiveList = new ArrayList<>(); if (populateActiveTaskAndPartitionsLists( activePartitionsList, assignedActiveList, consumer, clientMetadata.state, activeTasksForConsumer, partitionsForTask, allOwnedPartitions)) { stableAssignment = false; } final Map<TaskId, Set<TopicPartition>> standbyTaskMap = buildStandbyTaskMap(standbyTaskAssignments.get(consumer), partitionsForTask); final AssignmentInfo info = new AssignmentInfo( minUserMetadataVersion, minSupportedMetadataVersion, assignedActiveList, standbyTaskMap, partitionsByHostState, standbyPartitionsByHost, AssignorError.NONE.code() ); if (encodeNextRebalanceTime) { <START> final long nextRebalanceTimeMs = System.currentTimeMillis() + probingRebalanceIntervalMs(); <END> encodeNextRebalanceTime = false; info.setNextRebalanceTime(nextRebalanceTimeMs); } assignment.put( consumer, new Assignment( activePartitionsList, info.encode() ) ); } if (stableAssignment) { log.info("Finished stable assignment of tasks, no followup rebalances required."); } }</code><technical_language>Ideally, Time#milliseconds() instead of System.currentTimeMillis(), pass time instance in configure. aid in testability, strictly necessary. leave you</technical_language>

Target:
private void addClientAssignments(final Map<String, Assignment> assignment, final ClientMetadata clientMetadata, final Map<TaskId, Set<TopicPartition>> partitionsForTask, final Map<HostInfo, Set<TopicPartition>> partitionsByHostState, final Map<HostInfo, Set<TopicPartition>> standbyPartitionsByHost, final Set<TopicPartition> allOwnedPartitions, final Map<String, List<TaskId>> activeTaskAssignments, final Map<String, List<TaskId>> standbyTaskAssignments, final int minUserMetadataVersion, final int minSupportedMetadataVersion, final boolean versionProbing, final boolean followupRebalanceNeeded) { boolean encodeNextRebalanceTime = followupRebalanceNeeded; boolean stableAssignment = !followupRebalanceNeeded && !versionProbing; for (final String consumer : clientMetadata.consumers) { final List<TaskId> activeTasksForConsumer = activeTaskAssignments.get(consumer); final List<TopicPartition> activePartitionsList = new ArrayList<>(); final List<TaskId> assignedActiveList = new ArrayList<>(); if (populateActiveTaskAndPartitionsLists( activePartitionsList, assignedActiveList, consumer, clientMetadata.state, activeTasksForConsumer, partitionsForTask, allOwnedPartitions) ) { stableAssignment = false; } final Map<TaskId, Set<TopicPartition>> standbyTaskMap = buildStandbyTaskMap(standbyTaskAssignments.get(consumer), partitionsForTask); final AssignmentInfo info = new AssignmentInfo( minUserMetadataVersion, minSupportedMetadataVersion, assignedActiveList, standbyTaskMap, partitionsByHostState, standbyPartitionsByHost, AssignorError.NONE.code() ); if (encodeNextRebalanceTime) { final long nextRebalanceTimeMs = time.milliseconds() + probingRebalanceIntervalMs(); info.setNextRebalanceTime(nextRebalanceTimeMs); log.info("Scheduled a followup probing rebalance for ms.", nextRebalanceTimeMs); encodeNextRebalanceTime = false; } assignment.put( consumer, new Assignment( activePartitionsList, info.encode() ) ); } if (stableAssignment) { log.info("Finished stable assignment of tasks, no followup rebalances required."); } else { log.info("Finished unstable assignment of tasks, a followup rebalance will be triggered."); } }