我越來越SocketConnectionException
而產生的大量數據(超過0.5萬條記錄)Excel文件Excel文件。插座異常而產生批量使用Apache POI
我的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();