diff --git a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/PartitionNameProvider.java b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/PartitionNameProvider.java index fa1457302..19571d404 100644 --- a/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/PartitionNameProvider.java +++ b/spring-batch-core/src/main/java/org/springframework/batch/core/partition/support/PartitionNameProvider.java @@ -25,6 +25,14 @@ import java.util.Collection; * interface if a partitioner extends {@link SimplePartitioner} and re-uses the * default partition names. *

+ *

+ * If a partitioner does implement this interface, however, on a restart the + * {@link Partitioner#partition(int)} method will not be called again, instead + * the partitions will be re-used from the last execution, and matched by name + * with the results of {@link PartitionNameProvider#getPartitionNames(int)}. + * This can be a useful performance optimisation if the partitioning process is + * expensive. + *

* * @author Dave Syer * diff --git a/src/site/docbook/reference/scalability.xml b/src/site/docbook/reference/scalability.xml index a34516490..fec314c81 100644 --- a/src/site/docbook/reference/scalability.xml +++ b/src/site/docbook/reference/scalability.xml @@ -340,6 +340,17 @@ Job), and the suffix is just a counter. There is a SimplePartitioner in the framework that uses this convention. + + An optional interface + PartitioneNameProvider can be used to + provide the partition names separately from the partitions + themselves. If a Partitioner implements + this interface then on a restart only the names will be queried. + If partitioning is expensive this can be a useful optimisation. + Obviously the names provided by the + PartitioneNameProvider must match those + provided by the Partitioner. +