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

COVERAGE SUMMARY FOR SOURCE FILE [RetryContextSupport.java]

nameclass, %method, %block, %line, %
RetryContextSupport.java100% (1/1)100% (7/7)100% (37/37)100% (14/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class RetryContextSupport100% (1/1)100% (7/7)100% (37/37)100% (14/14)
RetryContextSupport (RetryContext): void 100% (1/1)100% (9/9)100% (4/4)
getLastThrowable (): Throwable 100% (1/1)100% (3/3)100% (1/1)
getParent (): RetryContext 100% (1/1)100% (3/3)100% (1/1)
getRetryCount (): int 100% (1/1)100% (3/3)100% (1/1)
isExhaustedOnly (): boolean 100% (1/1)100% (3/3)100% (1/1)
registerThrowable (Throwable): void 100% (1/1)100% (12/12)100% (4/4)
setExhaustedOnly (): void 100% (1/1)100% (4/4)100% (2/2)

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.context;
18 
19import org.springframework.batch.retry.RetryContext;
20import org.springframework.batch.retry.RetryPolicy;
21import org.springframework.core.AttributeAccessorSupport;
22 
23public class RetryContextSupport extends AttributeAccessorSupport implements RetryContext {
24 
25        private boolean terminate = false;
26 
27        private int count;
28 
29        private Throwable lastException;
30 
31        private RetryContext parent;
32 
33        public RetryContextSupport(RetryContext parent) {
34                super();
35                this.parent = parent;
36        }
37 
38        public RetryContext getParent() {
39                return this.parent;
40        }
41 
42        public boolean isExhaustedOnly() {
43                return terminate;
44        }
45 
46        public void setExhaustedOnly() {
47                terminate = true;
48        }
49 
50        public int getRetryCount() {
51                return count;
52        }
53 
54        public Throwable getLastThrowable() {
55                return lastException;
56        }
57 
58        /**
59         * Set the exception for the public interface {@link RetryContext}, and
60         * also increment the retry count if the throwable is non-null.<br/>
61         * 
62         * All {@link RetryPolicy} implementations should use this method when they
63         * register the throwable. It should only be called once per retry attempt
64         * because it increments the conter.<br/>
65         * 
66         * Use of this method is not enforced by the framework - it is a service
67         * provider contract for authors of policies.
68         * 
69         * @param throwable the exception that caused the current retry attempt to
70         * fail.
71         */
72        public void registerThrowable(Throwable throwable) {
73                this.lastException = throwable;
74                if (throwable != null)
75                        count++;
76        }
77 
78}

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