Skip to content

Commit

Permalink
@Retry @logging @Resilience4jDegrade @SentinelDegrade支持Inherited
Browse files Browse the repository at this point in the history
  • Loading branch information
chentianming11 committed May 5, 2022
1 parent 33e64e5 commit 732dab4
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
Expand All @@ -16,6 +17,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
@Documented
@Inherited
public @interface RetrofitClient {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,7 @@ private okhttp3.ConnectionPool parseConnectionPool() {
return connectionPool;
}

private OkHttpClient createOkHttpClient()
throws IllegalAccessException, InstantiationException, InvocationTargetException {
private OkHttpClient createOkHttpClient() throws IllegalAccessException, InvocationTargetException {
OkHttpClient.Builder okHttpClientBuilder = createOkHttpClientBuilder();
RetrofitClient retrofitClient = retrofitInterface.getAnnotation(RetrofitClient.class);
if (isEnableDegrade(retrofitInterface)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
Expand All @@ -23,6 +24,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
@Inherited
public @interface Resilience4jDegrade {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
Expand All @@ -12,6 +13,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
@Inherited
public @interface SentinelDegrade {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
Expand All @@ -13,6 +14,7 @@
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
@Inherited
public @interface Logging {

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
package com.github.lianjiatech.retrofit.spring.boot.retry;

import java.lang.annotation.*;
import java.lang.annotation.Documented;
import java.lang.annotation.ElementType;
import java.lang.annotation.Inherited;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
* @author 陈添明
*/
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD, ElementType.TYPE})
@Documented
@Inherited
public @interface Retry {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,16 +38,6 @@ public interface HttpApi {
@GET("person")
Result<Person> getPerson(@Query("id") Long id);

/**
* Void <br>
* 不关注返回类型可以使用Void。如果http状态码不是2xx,直接抛错!
*
* @param id id
* @return Void
*/
@GET("person")
Void getPersonVoid(@Query("id") Long id);

/**
* CompletableFuture<T> <br>
* 将响应体内容适配成CompletableFuture<T>对象返回,异步调用
Expand Down

0 comments on commit 732dab4

Please sign in to comment.