refactor(listIdentity): 调整计时;trace跨线程
This commit is contained in:
parent
54b2ecf030
commit
a354d44b39
@ -4,6 +4,7 @@ import cn.axzo.basics.common.BeanMapper;
|
||||
import cn.axzo.basics.common.util.AssertUtil;
|
||||
import cn.axzo.framework.domain.ServiceException;
|
||||
import cn.axzo.pokonyan.config.mybatisplus.BaseEntity;
|
||||
import cn.axzo.pokonyan.util.TraceSupplier;
|
||||
import cn.axzo.thrones.client.saas.ServicePkgClient;
|
||||
import cn.axzo.thrones.client.saas.entity.serivicepgkproduct.ServicePkgProduct;
|
||||
import cn.axzo.thrones.client.saas.entity.servicepkg.ServicePkgDetailRes;
|
||||
@ -643,16 +644,15 @@ public class TyrSaasAuthServiceImpl implements TyrSaasAuthService {
|
||||
public List<ListIdentityFromPermissionResp> batchListIdentityFromPermission(List<ListIdentityFromPermissionReq> reqList) {
|
||||
//异步处理
|
||||
StopWatch watch = StopWatch.create("batchListIdentityFromPermission");
|
||||
watch.start("addFeature");
|
||||
watch.start("addFuture");
|
||||
List<CompletableFuture<ListIdentityFromPermissionResp>> futureList = new ArrayList<>();
|
||||
for (ListIdentityFromPermissionReq req : reqList) {
|
||||
CompletableFuture<ListIdentityFromPermissionResp> future = CompletableFuture.supplyAsync(
|
||||
() -> {
|
||||
long start = System.currentTimeMillis();
|
||||
ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req);
|
||||
log.info("------trace-B-L-I-F-P----> code:{},task cost:{}", req.getFeatureCode(), System.currentTimeMillis() - start);
|
||||
return resp;
|
||||
}, executor);
|
||||
long start = System.currentTimeMillis();
|
||||
CompletableFuture<ListIdentityFromPermissionResp> future = CompletableFuture.supplyAsync(TraceSupplier.create(() -> {
|
||||
ListIdentityFromPermissionResp resp = this.listIdentityFromPermission(req);
|
||||
log.info("------trace-B-L-I-F-P----> code:{},task cost:{}", req.getFeatureCode(), System.currentTimeMillis() - start);
|
||||
return resp;
|
||||
}), executor);
|
||||
futureList.add(future);
|
||||
}
|
||||
watch.stop();
|
||||
|
||||
Loading…
Reference in New Issue
Block a user