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 = [].
| Constructor and Description |
|---|
OdevitySortByNameJobShardingStrategy() |
| Modifier and Type | Method and Description |
|---|---|
String |
getType()
Get type.
|
Map<JobInstance,List<Integer>> |
sharding(List<JobInstance> jobInstances,
String jobName,
int shardingTotalCount)
Sharding job.
|
public OdevitySortByNameJobShardingStrategy()
public Map<JobInstance,List<Integer>> sharding(List<JobInstance> jobInstances, String jobName, int shardingTotalCount)
JobShardingStrategysharding in interface JobShardingStrategyjobInstances - all job instances which participate in shardingjobName - job nameshardingTotalCount - sharding total countCopyright © 2021 The Apache Software Foundation. All rights reserved.