Skip to content
This repository has been archived by the owner on Sep 13, 2022. It is now read-only.

Seems if use in the thread of executorservice, it will loss the trace context. #21

Open
zbird opened this issue Jan 9, 2019 · 0 comments

Comments

@zbird
Copy link

zbird commented Jan 9, 2019

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant