Skip to content

Commit cc3ec30

Browse files
committed
rename invoke signature
1 parent 4f6c367 commit cc3ec30

File tree

3 files changed

+10
-10
lines changed

3 files changed

+10
-10
lines changed

spring-boot-data-aggregator-core/src/main/java/io/github/lvyahui8/spring/aggregate/model/InvokeSign.java renamed to spring-boot-data-aggregator-core/src/main/java/io/github/lvyahui8/spring/aggregate/model/InvokeSignature.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,11 @@
1111
* @since 2019/6/28 22:42
1212
*/
1313
@Data
14-
public class InvokeSign {
14+
public class InvokeSignature {
1515
private Method method;
1616
private Object[] args;
1717

18-
public InvokeSign(Method method, Object[] args) {
18+
public InvokeSignature(Method method, Object[] args) {
1919
this.method = method;
2020
this.args = args;
2121
}
@@ -24,7 +24,7 @@ public InvokeSign(Method method, Object[] args) {
2424
public boolean equals(Object o) {
2525
if (this == o) return true;
2626
if (o == null || getClass() != o.getClass()) return false;
27-
InvokeSign that = (InvokeSign) o;
27+
InvokeSignature that = (InvokeSignature) o;
2828
return Objects.deepEquals(method, that.method) &&
2929
Arrays.deepEquals(args, that.args);
3030
}

spring-boot-data-aggregator-core/src/main/java/io/github/lvyahui8/spring/aggregate/service/DataBeanAggregateQueryService.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
package io.github.lvyahui8.spring.aggregate.service;
22

3-
import io.github.lvyahui8.spring.aggregate.model.InvokeSign;
3+
import io.github.lvyahui8.spring.aggregate.model.InvokeSignature;
44

55
import java.lang.reflect.InvocationTargetException;
66
import java.util.Map;
@@ -21,6 +21,6 @@ public interface DataBeanAggregateQueryService {
2121
* @param queryCache Used to cache data during the query
2222
* @return final result
2323
*/
24-
<T> T get(String id, Map<String,Object> invokeParams, Class<T> resultType,final Map<InvokeSign,Object> queryCache)
24+
<T> T get(String id, Map<String,Object> invokeParams, Class<T> resultType,final Map<InvokeSignature,Object> queryCache)
2525
throws InterruptedException, InvocationTargetException, IllegalAccessException;
2626
}

spring-boot-data-aggregator-core/src/main/java/io/github/lvyahui8/spring/aggregate/service/impl/DataBeanAggregateQueryServiceImpl.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public DataBeanAggregateQueryServiceImpl(DataProviderRepository repository) {
3838
}
3939

4040
@Override
41-
public <T> T get(String id, Map<String, Object> invokeParams, Class<T> resultType,final Map<InvokeSign,Object> queryCache)
41+
public <T> T get(String id, Map<String, Object> invokeParams, Class<T> resultType,final Map<InvokeSignature,Object> queryCache)
4242
throws InterruptedException, InvocationTargetException, IllegalAccessException {
4343
Assert.isTrue(repository.contains(id),"id not exisit");
4444
long startTime = System.currentTimeMillis();
@@ -94,16 +94,16 @@ public <T> T get(String id, Map<String, Object> invokeParams, Class<T> resultTyp
9494
}
9595
try {
9696
/* 如果调用方法是幂等的, 那么当方法签名和方法参数完全一致时, 可以直接使用缓存结果 */
97-
InvokeSign invokeSign = new InvokeSign(provider.getMethod(),args);
97+
InvokeSignature invokeSignature = new InvokeSignature(provider.getMethod(),args);
9898
Object resultModel;
99-
if(queryCache.containsKey(invokeSign)) {
100-
resultModel = queryCache.get(invokeSign);
99+
if(queryCache.containsKey(invokeSignature)) {
100+
resultModel = queryCache.get(invokeSignature);
101101
}
102102
else {
103103
resultModel = provider.getMethod()
104104
.invoke(applicationContext.getBean(provider.getMethod().getDeclaringClass()), args);
105105
/* Map 中可能不能放空value */
106-
queryCache.put(invokeSign,resultModel != null ? resultModel : AggregatorConstant.EMPTY_MODEL);
106+
queryCache.put(invokeSignature,resultModel != null ? resultModel : AggregatorConstant.EMPTY_MODEL);
107107
}
108108

109109
return resultType.cast(resultModel != AggregatorConstant.EMPTY_MODEL ? resultModel : null);

0 commit comments

Comments
 (0)