1 /**
2 * Copyright 2007 Björn Voß
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
5 * use this file except in compliance with the License. You may obtain a copy of
6 * 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, WITHOUT
12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13 * License for the specific language governing permissions and limitations under
14 * the License.
15 */
16 package net.sf.oxclient.aspects.retry;
17
18 import java.lang.annotation.Documented;
19 import java.lang.annotation.ElementType;
20 import java.lang.annotation.Inherited;
21 import java.lang.annotation.Retention;
22 import java.lang.annotation.RetentionPolicy;
23 import java.lang.annotation.Target;
24
25 /**
26 * @author Björn Voß
27 */
28 @Documented
29 @Retention(RetentionPolicy.RUNTIME)
30 @Target(value= {ElementType.METHOD})
31 @Inherited
32 public @interface RetryIt {
33
34 /**
35 * How often should the execution be retried.
36 * <p>Defaults to 2
37 */
38 int numberOfRetries() default 2;
39
40 /**
41 * Milliseconds to wait before the next execution.
42 * <p>Defaults to 100
43 */
44 int delay() default 100;
45
46 /**
47 * Should either the values for {@link #numberOfRetries()}
48 * and {@link #delay()} of this annotation be used, or the global settings
49 * in {@link RetryHandler}.
50 * <p>Defaults to <code>true</code> for global Settings.
51 * <p><b>Note: </b><br>This has nothing to do with the default values for
52 * {@link #numberOfRetries()} and {@link #delay()}
53 * @see RetryHandler
54 */
55 boolean useGlobalSettings() default true;
56
57 Class<? extends Throwable>[] retryFor() default {RuntimeException.class};
58 ParameterSaveType saverType();
59 Class<? extends IParameterSaver> customSaver() default IParameterSaver.class;
60 }