开发者

why I cannot get right response if I have if statement

I am modifing other's code to get the right response, here is the code structure. The problem I have here is; When I do if statement, "response.setOptions(ccResp.getValue().getOptions());" response did not have options value even if the if statement get true. When I remove the if statement, I can find options value in my response. I don't understand why I cannot do if statement here. Thanks for any help.

public class service {

@Autowired
@Qualifier(value = "threadPoolTaskExecutor")
private TaskExecutor threadPoolTaskExecutor;

public response processcode (Request request) throws Exception {
  return getResponse(callCode(request), request);
}

public Map<String, Response> callCode(Request request) throws Exception {

ASInjectedCallable<Map<String, Response>> codeCallable = new ASInjectedCallable<>(
  new Callable<Map<String, Response>>() {
     @Override
     public Map<String, Response> call() {};
  }
);
ASCFutureTask<Map<String, Response>> codeFutureTask = codeCallable
                .toFutureTask();
threadPoolTaskExecutor.execute(codeFutureTask);

return codeFutureTask.get();
开发者_如何转开发
}

private RestResponse getResponse(Map<String, Response> ccMap, Request request) {
  
    Map<String, Response> respMap = new HashMap<>();
    ccMap.entrySet().stream().forEach(ccResp -> {
       if (MapUtils.isNotEmpty(ccResp.getValue()getOptions())) {        
         # response.setOptions(ccResp.getValue().getOptions());     ***here*                              
       }
    ..........
    }
  return 
}
}

I think the problem maybe is realted to mutilthreading. so I checked how mutilthread working in Java.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜