DL1231 commented on code in PR #19900:
URL: https://github.com/apache/kafka/pull/19900#discussion_r2131283934
##########
group-coordinator/src/main/java/org/apache/kafka/coordinator/group/GroupCoordinatorConfig.java:
##########
@@ -550,6 +565,43 @@ protected List<ConsumerGroupPartitionAssignor>
consumerGroupAssignors(
return assignors;
}
+ protected List<ShareGroupPartitionAssignor> shareGroupAssignors(
+ AbstractConfig config
+ ) {
+ List<ShareGroupPartitionAssignor> assignors = new ArrayList<>();
+
+ try {
+ for (String kclass :
config.getList(GroupCoordinatorConfig.SHARE_GROUP_ASSIGNORS_CONFIG)) {
+ ShareGroupPartitionAssignor assignor;
+
+ if (Objects.equals(kclass, SHARE_GROUP_ASSIGNORS_DEFAULT)) {
+ assignor = SHARE_GROUP_BUILTIN_ASSIGNOR;
+ } else {
+ try {
+ assignor = Utils.newInstance(kclass,
ShareGroupPartitionAssignor.class);
+ } catch (ClassNotFoundException e) {
+ throw new KafkaException("Class " + kclass + " cannot
be found", e);
+ } catch (ClassCastException e) {
+ throw new KafkaException(kclass + " is not an instance
of " + ShareGroupPartitionAssignor.class.getName());
+ }
+ }
Review Comment:
```suggestion
ShareGroupPartitionAssignor assignor =
SHARE_GROUP_BUILTIN_ASSIGNOR;
if (!Objects.equals(kclass, SHARE_GROUP_ASSIGNORS_DEFAULT)) {
try {
assignor = Utils.newInstance(kclass,
ShareGroupPartitionAssignor.class);
} catch (ClassNotFoundException e) {
throw new KafkaException("Class " + kclass + "
cannot be found", e);
} catch (ClassCastException e) {
throw new KafkaException(kclass + " is not an
instance of " + ShareGroupPartitionAssignor.class.getName());
}
}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]