public class LoadBalancePartitioner<T> extends java.lang.Object implements PartitionFunc<T>
Constructor and Description |
---|
LoadBalancePartitioner() |
Modifier and Type | Method and Description |
---|---|
void |
commit(int source,
int partition)
Commit the partition
|
int |
partition(int sourceIndex,
T val)
Computes the partition for the given key.
|
void |
prepare(java.util.Set<java.lang.Integer> sources,
java.util.Set<java.lang.Integer> destinations)
Prepare the function
|
public void prepare(java.util.Set<java.lang.Integer> sources, java.util.Set<java.lang.Integer> destinations)
PartitionFunc
prepare
in interface TaskPartitioner<T>
prepare
in interface PartitionFunc<T>
sources
- sourcedestinations
- destinationspublic int partition(int sourceIndex, T val)
PartitionFunc
partition
in interface TaskPartitioner<T>
partition
in interface PartitionFunc<T>
sourceIndex
- source of the dataval
- value.public void commit(int source, int partition)
PartitionFunc
commit
in interface TaskPartitioner<T>
commit
in interface PartitionFunc<T>
source
- the sourcepartition
- partition