mirror of
https://github.com/didi/KnowStreaming.git
synced 2025-12-24 03:42:07 +08:00
[Bugfix]修复job更新中的数组越界报错(#744)
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.xiaojukeji.know.streaming.km.common.bean.entity.reassign;
|
||||
|
||||
import com.xiaojukeji.know.streaming.km.common.utils.CommonUtils;
|
||||
import lombok.Data;
|
||||
import org.apache.kafka.common.TopicPartition;
|
||||
|
||||
@@ -20,10 +19,4 @@ public class ReassignResult {
|
||||
|
||||
return state.isDone();
|
||||
}
|
||||
|
||||
public boolean checkPreferredReplicaElectionUnNeed(String reassignBrokerIds, String originalBrokerIds) {
|
||||
Integer targetLeader = CommonUtils.string2IntList(reassignBrokerIds).get(0);
|
||||
Integer originalLeader = CommonUtils.string2IntList(originalBrokerIds).get(0);
|
||||
return originalLeader.equals(targetLeader);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -261,4 +261,20 @@ public class CommonUtils {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 校验两个list的第一个元素是否相等,以","分隔元素。
|
||||
* @param str1
|
||||
* @param str2
|
||||
* @return
|
||||
*/
|
||||
public static boolean checkFirstElementIsEquals(String str1, String str2) {
|
||||
if (ValidateUtils.anyBlank(str1, str2)) {
|
||||
return false;
|
||||
}
|
||||
Integer targetLeader = CommonUtils.string2IntList(str1).get(0);
|
||||
Integer originalLeader = CommonUtils.string2IntList(str2).get(0);
|
||||
return originalLeader.equals(targetLeader);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user