EMMA Coverage Report (generated Tue May 06 07:28:24 PDT 2008)
[all classes][org.springframework.batch.retry.policy]

COVERAGE SUMMARY FOR SOURCE FILE [AbstractStatelessRetryPolicy.java]

nameclass, %method, %block, %line, %
AbstractStatelessRetryPolicy.java100% (1/1)100% (3/3)100% (18/18)100% (3/3)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class AbstractStatelessRetryPolicy100% (1/1)100% (3/3)100% (18/18)100% (3/3)
AbstractStatelessRetryPolicy (): void 100% (1/1)100% (3/3)100% (1/1)
handleRetryExhausted (RetryContext): Object 100% (1/1)100% (7/7)100% (1/1)
shouldRethrow (RetryContext): boolean 100% (1/1)100% (8/8)100% (1/1)

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 
17package org.springframework.batch.retry.policy;
18 
19import org.springframework.batch.retry.ExhaustedRetryException;
20import org.springframework.batch.retry.RetryContext;
21import org.springframework.batch.retry.RetryPolicy;
22 
23/**
24 * Base class for "normal" retry policies: those that operate in the context of
25 * a callback that is called repeatedly in a loop until it succeeds, or the
26 * policy decides to terminate. There is no need for such policies to store
27 * state outside the context.
28 * 
29 * @see RetryPolicy#handleRetryExhausted(RetryContext)
30 * @see AbstractStatefulRetryPolicy
31 * 
32 * @author Dave Syer
33 * 
34 */
35public abstract class AbstractStatelessRetryPolicy implements RetryPolicy {
36 
37        /**
38         * Just returns the negative of {@link RetryPolicy#canRetry(RetryContext)},
39         * i.e. if we cannot retry then the exception should be thrown.
40         * 
41         * @see org.springframework.batch.retry.RetryPolicy#shouldRethrow(org.springframework.batch.retry.RetryContext)
42         */
43        public boolean shouldRethrow(RetryContext context) {
44                return !canRetry(context);
45        }
46 
47        /**
48         * Throw an exception.
49         * 
50         * @see org.springframework.batch.retry.RetryPolicy#handleRetryExhausted(org.springframework.batch.retry.RetryContext)
51         */
52        public Object handleRetryExhausted(RetryContext context) throws Exception, ExhaustedRetryException {
53                throw new ExhaustedRetryException("Retry exhausted after last attempt with no recovery path.", context
54                                .getLastThrowable());
55        }
56 
57}

[all classes][org.springframework.batch.retry.policy]
EMMA 2.0.5312 (C) Vladimir Roubtsov