Skip to content

Commit 0533f72

Browse files
committed
Pipeline & optimize
1 parent 1241d60 commit 0533f72

File tree

3 files changed

+72
-2
lines changed

3 files changed

+72
-2
lines changed

spring-boot-data-aggregator-autoconfigure/src/main/java/io/github/lvyahui8/spring/autoconfigure/BeanAggregateAutoConfiguration.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,13 @@ private void scanProviders(DataProviderRepository repository) {
8787
Reflections reflections = new Reflections(basePackage, new MethodAnnotationsScanner());
8888
Set<Method> providerMethods = reflections.getMethodsAnnotatedWith(DataProvider.class);
8989
for (Method method : providerMethods) {
90-
dealProvideMethod(repository, method);
90+
dealProviderMethod(repository, method);
9191
}
9292
}
9393
}
9494
}
9595

96-
private void dealProvideMethod(DataProviderRepository repository, Method method) {
96+
private void dealProviderMethod(DataProviderRepository repository, Method method) {
9797
DataProvider beanProvider = AnnotationUtils.findAnnotation(method, DataProvider.class);
9898
@SuppressWarnings("ConstantConditions")
9999
String dataId = beanProvider.id();
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package io.github.lvyahui8.spring.aggregate.context;
2+
3+
import lombok.Data;
4+
5+
/**
6+
* @author lvyahui (lvyahui8@gmail.com,lvyahui8@126.com)
7+
* @since 2019/7/21 22:37
8+
*/
9+
@Data
10+
public class AggregateContext {
11+
/**
12+
* 发起一次递归查询的主调线程
13+
*/
14+
Thread rootThread;
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
package io.github.lvyahui8.spring.aggregate.interceptor;
2+
3+
import io.github.lvyahui8.spring.aggregate.context.AggregateContext;
4+
import io.github.lvyahui8.spring.aggregate.model.DataProvideDefinition;
5+
6+
/**
7+
* 查询过程中各个生命周期的拦截处理
8+
*
9+
* @author lvyahui (lvyahui8@gmail.com,lvyahui8@126.com)
10+
* @since 2019/7/21 22:28
11+
*/
12+
public interface AbstractAggregateQueryInterceptor {
13+
/**
14+
* 查询正常提交, Context已经创建
15+
*
16+
* @param aggregateContext 查询上下文
17+
* @return 返回为true才继续执行
18+
*/
19+
boolean querySubmitted(AggregateContext aggregateContext) ;
20+
21+
/**
22+
* 每个Provider方法执行前, 将调用此方法
23+
*
24+
* @param aggregateContext 查询上下文
25+
* @param provideDefinition 将被执行的Provider
26+
* @return 返回为true才继续执行
27+
*/
28+
boolean queryBefore(AggregateContext aggregateContext, DataProvideDefinition provideDefinition);
29+
30+
/**
31+
* 每个Provider方法执行成功之后, 调用此方法
32+
*
33+
* @param aggregateContext 查询上下文
34+
* @param provideDefinition 被执行的Provider
35+
* @param result 查询结果
36+
* @return 返回结果, 如不修改不, 请直接返回参数中的result
37+
*/
38+
Object queryAfter(AggregateContext aggregateContext,DataProvideDefinition provideDefinition,Object result);
39+
40+
/**
41+
* 每个Provider执行时, 如果抛出异常, 将调用此方法
42+
*
43+
* @param aggregateContext 查询上下文
44+
* @param provideDefinition 被执行的Provider
45+
* @param e Provider抛出的异常
46+
*/
47+
void exceptionHandle(AggregateContext aggregateContext,DataProvideDefinition provideDefinition,Exception e);
48+
49+
/**
50+
* 一次查询全部完成.
51+
*
52+
* @param aggregateContext 查询上下文
53+
*/
54+
void queryFinished(AggregateContext aggregateContext);
55+
}

0 commit comments

Comments
 (0)