Skip to content

Commit

Permalink
[update][core] Minor code change
Browse files Browse the repository at this point in the history
  • Loading branch information
wgzhao committed Oct 14, 2024
1 parent 7d45b9e commit cb5e75f
Show file tree
Hide file tree
Showing 14 changed files with 181 additions and 123 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

/**
* 扫描给定目录的所有一级子目录,每个子目录当作一个Hook的目录。
* 对于每个子目录,必须符合ServiceLoader的标准目录格式,见http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html。
* 对于每个子目录,必须符合ServiceLoader的标准目录格式,见
* <a href="http://docs.oracle.com/javase/6/docs/api/java/util/ServiceLoader.html">ServiceLoader</a>。
* 加载里头的jar,使用ServiceLoader机制调用。
*/
public class HookInvoker
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,19 +43,20 @@ private JobAssignUtil()
* 公平体现在:会考虑 task 中对资源负载作的 load 标识进行更均衡的作业分配操作。
*
* @param configuration configuration
* @param channelNumber the number of channel
* @param channelNumber the number of channel
* @param channelsPerTaskGroup the channel of task group
* @return list of configuration
*/
public static List<Configuration> assignFairly(Configuration configuration, int channelNumber, int channelsPerTaskGroup)
{
Validate.isTrue(configuration != null, "框架获得的 Job 不能为 null.");
Validate.isTrue(configuration != null, "The `job.content` can not be null.");

List<Configuration> contentConfig = configuration.getListConfiguration(CoreConstant.JOB_CONTENT);
Validate.isTrue(!contentConfig.isEmpty(), "框架获得的切分后的 Job 无内容.");
Validate.isTrue(!contentConfig.isEmpty(), "The `job.content` is empty");

Validate.isTrue(channelNumber > 0 && channelsPerTaskGroup > 0,
"每个channel的平均task数[averTaskPerChannel],channel数目[channelNumber],每个taskGroup的平均channel数[channelsPerTaskGroup]都应该为正数");
"The average number of tasks per channel [averTaskPerChannel], the number of channels [channelNumber], and the average number of channels per task group " +
"[channelsPerTaskGroup] should all be positive numbers.");

int taskGroupNumber = (int) Math.ceil(1.0 * channelNumber / channelsPerTaskGroup);

Expand Down Expand Up @@ -142,7 +143,6 @@ private static LinkedHashMap<String, List<Integer>> parseAndGetResourceMarkAndTa
}

/**
*
* 需要实现的效果通过例子来说是:
* <pre>
* a 库上有表:0, 1, 2
Expand All @@ -158,8 +158,8 @@ private static LinkedHashMap<String, List<Integer>> parseAndGetResourceMarkAndTa
*
* </pre>
*
* @param resourceMarkAndTaskIdMap resource map
* @param jobConfiguration configuration
* @param resourceMarkAndTaskIdMap resource map
* @param jobConfiguration configuration
* @param taskGroupNumber the number of group
* @return list of configuration
*/
Expand Down
Loading

0 comments on commit cb5e75f

Please sign in to comment.