報(bào)錯(cuò):Cause: com.kingbase8.util.KSQLException: 錯(cuò)誤: 堆棧深度超過(guò)限制 Hint: 在確定了平臺(tái)的堆棧深度限制是足夠大后,增加配置參數(shù) "max_stack_depth"的值(當(dāng)前值為2048kB).; 錯(cuò)誤: 堆棧深度超過(guò)限制 Hint: 在確定了平臺(tái)的堆棧深度限制是足夠大后,增加配置參數(shù) "max_stack_depth"的值(當(dāng)前值為2048kB).; nested exception is com.kingbase8.util.KSQLException: 錯(cuò)誤: 堆棧深度超過(guò)限制 Hint: 在確定了平臺(tái)的堆棧深度限制是足夠大后,增加配置參數(shù) "max_stack_depth"的值(當(dāng)前值為2048kB).]
經(jīng)過(guò)以下改進(jìn)仍沒(méi)能解決:文章來(lái)源:http://www.zghlxwxcb.cn/news/detail-687667.html
List<String> sampleInfoIds = sampleInfoList.parallelStream()
.map(BaseEntity::getId).collect(Collectors.toList());//sampleInfoIds過(guò)大
List<String> subList1 = sampleInfoIds.subList(0, sampleInfoIds.size() / 2);
List<String> subList2 = sampleInfoIds.subList(sampleInfoIds.size() / 2, sampleInfoIds.size()-1);
List<SampleInfoDTO> sampleInfoDTOList = sampleInfoMapper.getSampleInfoDTOByIds(subList1);
List<SampleInfoDTO> sampleInfoDTOList1 =sampleInfoMapper.getSampleInfoDTOByIds(subList2);
sampleInfoDTOList.addAll(sampleInfoDTOList1);
以下解決了該問(wèn)題文章來(lái)源地址http://www.zghlxwxcb.cn/news/detail-687667.html
List<String> sampleInfoIds = sampleInfoList.parallelStream()
.map(BaseEntity::getId).collect(Collectors.toList());
int batch=7000;
int c=(int) Math.ceil((sampleInfoIds.size()*1.0)/batch);
List<SampleInfoDTO> sampleInfoDTOList=new ArrayList<>();
List<CompletableFuture> completableFutures=new ArrayList<>();
for (int i=0;i<c;i++){
int fromIndex=i*batch;
int endIndex=(i+1)*batch-1;
List<String> ids=sampleInfoIds.subList(fromIndex,Math.min(endIndex, sampleInfoIds.size()-1));
CompletableFuture<List<SampleInfoDTO>> future = CompletableFuture.supplyAsync(() -> {
return sampleInfoMapper.getSampleInfoDTOByIds(ids);
}, executor);
completableFutures.add(future);
}
CompletableFuture.allOf(completableFutures.toArray(new CompletableFuture[0])).join();
for (CompletableFuture future : completableFutures) {
try {
sampleInfoDTOList.addAll((List<SampleInfoDTO>) future.get());
} catch (InterruptedException e) {
throw new RuntimeException(e);
} catch (ExecutionException e) {
throw new RuntimeException(e);
}
}
到了這里,關(guān)于堆棧深度超過(guò)限制的文章就介紹完了。如果您還想了解更多內(nèi)容,請(qǐng)?jiān)谟疑辖撬阉鱐OY模板網(wǎng)以前的文章或繼續(xù)瀏覽下面的相關(guān)文章,希望大家以后多多支持TOY模板網(wǎng)!