Open zbird opened 5 years ago
Seems if use in the thread of executorservice, it will loss the trace context. private static ExecutorService executorService = Executors .newCachedThreadPool();
Map<String, Future> iFutureHashMap = new HashMap<>(); if (c.isAppro()) { Future approFuture = executorService.submit(() -> { ThreadContext.putAll(ctx); JSONObject appro = generatorAppro(appId, "uniappro", clientId, clientType, c.getProdCode(), params, c.getOrderId(), checkEsign); return appro; }); iFutureHashMap.put("appro", approFuture); } if (c.isProd()) { Future prodFuture = executorService.submit(() -> { ThreadContext.putAll(ctx); JSONObject prod = generatorAgreement(appId, EsignConstants.CATEGORY_PROD_PREFIX + c.getProdCode(), null, clientId, clientType, c.getOrderId(), params, false, c.getOrderId()); return prod; }); iFutureHashMap.put("prod", prodFuture); } if (StringUtils.isNotEmpty(c.getAddition())) { Future additionFuture = executorService.submit(() -> { ThreadContext.putAll(ctx); JSONObject addition = generatorAgreement(appId, c.getAddition(), null, clientId, clientType, c.getOrderId(), params, false, c.getOrderId()); return addition; }); iFutureHashMap.put("addition", additionFuture); }
Seems if use in the thread of executorservice, it will loss the trace context. private static ExecutorService executorService = Executors .newCachedThreadPool();
Map<String, Future> iFutureHashMap = new HashMap<>();
if (c.isAppro()) {
Future approFuture = executorService.submit(() -> {
ThreadContext.putAll(ctx);
JSONObject appro = generatorAppro(appId, "uniappro", clientId, clientType, c.getProdCode(), params, c.getOrderId(), checkEsign);
return appro;
});
iFutureHashMap.put("appro", approFuture);
}
if (c.isProd()) {
Future prodFuture = executorService.submit(() -> {
ThreadContext.putAll(ctx);
JSONObject prod = generatorAgreement(appId, EsignConstants.CATEGORY_PROD_PREFIX + c.getProdCode(), null, clientId, clientType, c.getOrderId(), params, false, c.getOrderId());
return prod;
});
iFutureHashMap.put("prod", prodFuture);
}
if (StringUtils.isNotEmpty(c.getAddition())) {
Future additionFuture = executorService.submit(() -> {
ThreadContext.putAll(ctx);
JSONObject addition = generatorAgreement(appId, c.getAddition(), null, clientId, clientType, c.getOrderId(), params, false, c.getOrderId());
return addition;
});
iFutureHashMap.put("addition", additionFuture);
}
Requirement - what kind of business use case are you trying to solve?
Problem - what in Jaeger blocks you from solving the requirement?
Proposal - what do you suggest to solve the problem or improve the existing situation?
Any open questions to address