Class Partitioner.Default

    • Method Detail

      • init

        public void init​(@Nonnull
                         DefaultPartitionStrategy defaultPartitioning)
        Description copied from interface: Partitioner
        Callback that injects the Hazelcast's default partitioning strategy into this partitioner so it can be consulted by the Partitioner.getPartition(Object, int) method.

        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.

        Specified by:
        init in interface Partitioner<java.lang.Object>
      • getPartition

        public int getPartition​(@Nonnull
                                java.lang.Object item,
                                int partitionCount)
        Description copied from interface: Partitioner
        Returns the partition ID of the given item.
        Specified by:
        getPartition in interface Partitioner<java.lang.Object>
        partitionCount - the total number of partitions in use by the underlying Hazelcast instance