public final class OdevitySortByNameJobShardingStrategy extends Object implements JobShardingStrategy
IP address asc if job name' hashcode is odd; IP address desc if job name' hashcode is even. Used to average assign to job server. For example: 1. If there are 3 job servers with 2 sharding item, and the hash value of job name is odd, then each server is divided into: 1 = [0], 2 = [1], 3 = []; 2. If there are 3 job servers with 2 sharding item, and the hash value of job name is even, then each server is divided into: 3 = [0], 2 = [1], 1 = [].
| 构造器和说明 |
|---|
OdevitySortByNameJobShardingStrategy() |
public Map<JobInstance,List<Integer>> sharding(List<JobInstance> jobInstances, String jobName, int shardingTotalCount)
JobShardingStrategysharding 在接口中 JobShardingStrategyjobInstances - all job instances which participate in shardingjobName - job nameshardingTotalCount - sharding total countCopyright © 2020 The Apache Software Foundation. All rights reserved.