我正在SocketConnectionException
为批量数据(超过 50 万条记录)生成 Excel 文件。
我的 Web 应用程序的代码写入 `outputstream. 这是一段代码:
while (sr.next()) {
counter++; //advance counter
view = (DataClass) sr.get(0);
try {
//writing fields values for Activity Report file
reportService.writeExcelFieldsValue(rowCounter,sheet,view,user,exportedFields);
rowCounter++;
} catch (Exception e) {
throw new RuntimeException(e);
}
if (counter == chunkSize || sr.isLast()) {
counter = 0; //reset counter
//Clear the session after a chunk and before next chunk
getSession().clear();
}
}
wb.write(bos);
bos.flush();