1 /*
2 * EL4J, the Extension Library for the J2EE, adds incremental enhancements to
3 * the spring framework, http://el4j.sf.net
4 * Copyright (C) 2005 by ELCA Informatique SA, Av. de la Harpe 22-24,
5 * 1000 Lausanne, Switzerland, http://www.elca.ch
6 *
7 * EL4J is published under the GNU Lesser General Public License (LGPL)
8 * Version 2.1. See http://www.gnu.org/licenses/
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU Lesser General Public License for more details.
14 *
15 * For alternative licensing, please contact info@elca.ch
16 */
17
18 package ch.elca.el4j.services.exceptionhandler;
19
20 import org.springframework.aop.target.HotSwappableTargetSource;
21
22 /**
23 * This exception signals a retry.
24 *
25 * @svnLink $Revision: 3883 $;$Date: 2009-08-04 15:35:01 +0200 (Di, 04. Aug 2009) $;$Author: swismer $;$URL: https://el4j.svn.sourceforge.net/svnroot/el4j/branches/el4j_3_1/el4j/framework/modules/exception_handling/src/main/java/ch/elca/el4j/services/exceptionhandler/RetryException.java $
26 *
27 * @author Andreas Bur (ABU)
28 */
29 public class RetryException extends Exception {
30
31 /** The number of retries. */
32 private int m_retries;
33
34 /**
35 * The hot swappable target source which target has to be used in the
36 * next invocation.
37 */
38 private HotSwappableTargetSource m_swapper;
39
40 /**
41 * Creates a new retry exception.
42 *
43 * @param retries
44 * The number of expected retries. Catchers are free to use another
45 * value.
46 */
47 public RetryException(int retries) {
48 this(retries, null);
49 }
50
51 /**
52 * Creates a new retry exception with the given number of retires and the
53 * target source, which target has to be used in the next invocation.
54 *
55 * @param retries
56 * The number of expected retries.
57 *
58 * @param swapper
59 * The target source that points to the target which has to be used in
60 * the next invocation.
61 */
62 public RetryException(int retries, HotSwappableTargetSource swapper) {
63 m_retries = retries;
64 m_swapper = swapper;
65 }
66
67 /**
68 * @return Returns the number of retries.
69 */
70 public int getRetries() {
71 return m_retries;
72 }
73
74 /**
75 * @return Returns the target source which target has to be used in the
76 * next invocation.
77 */
78 public HotSwappableTargetSource getSwapper() {
79 return m_swapper;
80 }
81 }