All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.dadiyang.httpinvoker.annotation.RetryPolicy Maven / Gradle / Ivy

There is a newer version: 1.2.4
Show newest version
package com.github.dadiyang.httpinvoker.annotation;

import com.github.dadiyang.httpinvoker.requestor.Status;

import java.io.IOException;
import java.lang.annotation.*;

import static com.github.dadiyang.httpinvoker.requestor.Status.NOT_FOUND;
import static com.github.dadiyang.httpinvoker.requestor.Status.REDIRECT;
import static com.github.dadiyang.httpinvoker.requestor.Status.SERVER_ERROR;

@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.TYPE, ElementType.METHOD})
@Documented
public @interface RetryPolicy {
    /**
     * retry times.
     * 

* Default to 3 * * @return retry times */ int times() default 3; /** * Default for IOException * * @return retry if the provided exception occur */ Class[] retryFor() default IOException.class; /** * Default for all not 20x code * * @return retry if the status codes gotten */ Status[] retryForStatus() default {NOT_FOUND, REDIRECT, SERVER_ERROR}; /** * fixed milli to sleep before retry *

* Default for 0 * * @return fixed milli */ long fixedBackOffPeriod() default 0; }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy