public class TaskPartitionerForRandom extends java.lang.Object implements TaskPartitioner<byte[]>
Modifier and Type | Field and Description |
---|---|
protected int[] |
destinationsList |
protected int |
keysToOneTask |
Constructor and Description |
---|
TaskPartitionerForRandom() |
Modifier and Type | Method and Description |
---|---|
void |
commit(int source,
int partition)
Indicate that we are using this partition
|
protected int |
getIndex(byte[] array) |
int |
partition(int source,
byte[] data)
Get a partition id, it should be from the set of
destinations |
void |
prepare(java.util.Set<java.lang.Integer> sources,
java.util.Set<java.lang.Integer> destinations)
Prepare the partition with sources and destinations.
|
protected int keysToOneTask
protected int[] destinationsList
public void prepare(java.util.Set<java.lang.Integer> sources, java.util.Set<java.lang.Integer> destinations)
TaskPartitioner
prepare
in interface TaskPartitioner<byte[]>
protected int getIndex(byte[] array)
public int partition(int source, byte[] data)
TaskPartitioner
destinations
partition
in interface TaskPartitioner<byte[]>
source
- source of the datadata
- data to be partitionedpublic void commit(int source, int partition)
TaskPartitioner
commit
in interface TaskPartitioner<byte[]>
source
- source of the partitionpartition
- partition to commit