T- type of item the partitioner accepts
@FunctionalInterface public interface Partitioner<T> extends Serializable
DAGedge that decides on the partition ID of an item traveling over it. The partition ID determines which cluster member and which instance of
Processoron that member an item will be forwarded to.
Jet's partitioning piggybacks on Hazelcast partitioning. Standard Hazelcast protocols are used to distribute partition ownership over the members of the cluster. However, if a DAG edge is configured as non-distributed, then on each member there will be some destination processor responsible for any given partition.
|Modifier and Type||Interface and Description|
Partitioner which applies the default Hazelcast partitioning strategy.
|Modifier and Type||Field and Description|
Partitioner which calls
|Modifier and Type||Method and Description|
Returns a partitioner which applies the default Hazelcast partitioning.
Returns the partition ID of the given item.
Callback that injects the Hazelcast's default partitioning strategy into this partitioner so it can be consulted by the
static final Partitioner<Object> HASH_CODE
Object.hashCode()and coerces it with the modulo operation into the allowed range of partition IDs. The primary reason to prefer this over the default is performance and it's a safe choice on local edges.
WARNING: this is a dangerous strategy to use on
distributed edges. Care must be taken to ensure that the produced
hashcode remains stable across serialization-deserialization cycles as
well as across all JVM processes. Consider a
that is correct with respect to its contract, but not with respect to
the stricter contract given above. Take the following scenario:
default void init(@Nonnull DefaultPartitionStrategy strat)
The creation of instances of the
Partitioner type is done in
user's code, but the Hazelcast partitioning strategy only becomes
available after the partitioner is deserialized on each target member.
This method solves the lifecycle mismatch.
partitionCount- the total number of partitions in use by the underlying Hazelcast instance
static Partitioner<Object> defaultPartitioner()
MurmurHash-based algorithm to retrieve the partition ID. This is quite a bit of work, but has stable results across all JVM processes, making it a safe default.
Copyright © 2020 Hazelcast, Inc.. All rights reserved.