View Javadoc

1   /*
2    * Copyright 2006-2009 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.batch.core.partition.support;
18  
19  import java.util.Collection;
20  
21  /**
22   * <p>
23   * Optional interface for {@link Partitioner} implementations that need to use a
24   * custom naming scheme for partitions. It is not necessary to implement this
25   * interface if a partitioner extends {@link SimplePartitioner} and re-uses the
26   * default partition names.
27   * </p>
28   * <p>
29   * If a partitioner does implement this interface, however, on a restart the
30   * {@link Partitioner#partition(int)} method will not be called again, instead
31   * the partitions will be re-used from the last execution, and matched by name
32   * with the results of {@link PartitionNameProvider#getPartitionNames(int)}.
33   * This can be a useful performance optimisation if the partitioning process is
34   * expensive.
35   * </p>
36   * 
37   * @author Dave Syer
38   * 
39   * @since 2.1.3
40   * 
41   */
42  public interface PartitionNameProvider {
43  
44  	Collection<String> getPartitionNames(int gridSize);
45  
46  }