View Javadoc

1   /*
2    * Copyright 2006-2007 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  package org.springframework.batch.core.step.skip;
17  
18  /**
19   * Policy for determining whether or not some processing should be skipped.
20   * 
21   * @author Lucas Ward
22   * @author Dave Syer
23   */
24  public interface SkipPolicy {
25  
26  	/**
27  	 * Returns true or false, indicating whether or not processing should
28  	 * continue with the given throwable. Clients may use
29  	 * <code>skipCount<0</code> to probe for exception types that are skippable,
30  	 * so implementations should be able to handle gracefully the case where
31  	 * <code>skipCount<0</code>. Implementations should avoid throwing any
32  	 * undeclared exceptions.
33  	 * 
34  	 * @param t exception encountered while reading
35  	 * @param skipCount currently running count of skips
36  	 * @return true if processing should continue, false otherwise.
37  	 * @throws SkipLimitExceededException if a limit is breached
38  	 * @throws IllegalArgumentException if the exception is null
39  	 */
40  	boolean shouldSkip(Throwable t, int skipCount) throws SkipLimitExceededException;
41  
42  }